diff --git a/0001-xen-balloon-don-t-online-new-memory-initially.patch b/0001-xen-balloon-don-t-online-new-memory-initially.patch new file mode 100644 index 0000000..df7cfec --- /dev/null +++ b/0001-xen-balloon-don-t-online-new-memory-initially.patch @@ -0,0 +1,116 @@ +From 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 Mon Sep 17 00:00:00 2001 +From: Juergen Gross +Date: Mon, 10 Jul 2017 10:10:45 +0200 +Subject: [PATCH] xen/balloon: don't online new memory initially + +When setting up the Xenstore watch for the memory target size the new +watch will fire at once. Don't try to reach the configured target size +by onlining new memory in this case, as the current memory size will +be smaller in almost all cases due to e.g. BIOS reserved pages. + +Onlining new memory will lead to more problems e.g. undesired conflicts +with NVMe devices meant to be operated as block devices. + +Instead remember the difference between target size and current size +when the watch fires for the first time and apply it to any further +size changes, too. + +In order to avoid races between balloon.c and xen-balloon.c init calls +do the xen-balloon.c initialization from balloon.c. + +Signed-off-by: Juergen Gross +Reviewed-by: Boris Ostrovsky +Signed-off-by: Juergen Gross +--- + drivers/xen/balloon.c | 3 +++ + drivers/xen/xen-balloon.c | 22 ++++++++++++---------- + include/xen/balloon.h | 8 ++++++++ + 3 files changed, 23 insertions(+), 10 deletions(-) + +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c +index 50dcb68d8070..ab609255a0f3 100644 +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -780,6 +780,9 @@ static int __init balloon_init(void) + } + #endif + ++ /* Init the xen-balloon driver. */ ++ xen_balloon_init(); ++ + return 0; + } + subsys_initcall(balloon_init); +diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c +index e7715cb62eef..e89136ab851e 100644 +--- a/drivers/xen/xen-balloon.c ++++ b/drivers/xen/xen-balloon.c +@@ -59,6 +59,8 @@ static void watch_target(struct xenbus_watch *watch, + { + unsigned long long new_target; + int err; ++ static bool watch_fired; ++ static long target_diff; + + err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target); + if (err != 1) { +@@ -69,7 +71,14 @@ static void watch_target(struct xenbus_watch *watch, + /* The given memory/target value is in KiB, so it needs converting to + * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10. + */ +- balloon_set_new_target(new_target >> (PAGE_SHIFT - 10)); ++ new_target >>= PAGE_SHIFT - 10; ++ if (watch_fired) { ++ balloon_set_new_target(new_target - target_diff); ++ return; ++ } ++ ++ watch_fired = true; ++ target_diff = new_target - balloon_stats.target_pages; + } + static struct xenbus_watch target_watch = { + .node = "memory/target", +@@ -94,22 +103,15 @@ static struct notifier_block xenstore_notifier = { + .notifier_call = balloon_init_watcher, + }; + +-static int __init balloon_init(void) ++void xen_balloon_init(void) + { +- if (!xen_domain()) +- return -ENODEV; +- +- pr_info("Initialising balloon driver\n"); +- + register_balloon(&balloon_dev); + + register_xen_selfballooning(&balloon_dev); + + register_xenstore_notifier(&xenstore_notifier); +- +- return 0; + } +-subsys_initcall(balloon_init); ++EXPORT_SYMBOL_GPL(xen_balloon_init); + + #define BALLOON_SHOW(name, format, args...) \ + static ssize_t show_##name(struct device *dev, \ +diff --git a/include/xen/balloon.h b/include/xen/balloon.h +index d1767dfb0d95..8906361bb50c 100644 +--- a/include/xen/balloon.h ++++ b/include/xen/balloon.h +@@ -35,3 +35,11 @@ static inline int register_xen_selfballooning(struct device *dev) + return -ENOSYS; + } + #endif ++ ++#ifdef CONFIG_XEN_BALLOON ++void xen_balloon_init(void); ++#else ++static inline void xen_balloon_init(void) ++{ ++} ++#endif +-- +2.13.3 + diff --git a/kernel.spec b/kernel.spec index b219e29..4251133 100644 --- a/kernel.spec +++ b/kernel.spec @@ -54,7 +54,7 @@ Summary: The Linux kernel %if 0%{?released_kernel} # Do we have a -stable update to apply? -%define stable_update 11 +%define stable_update 12 # Set rpm version accordingly %if 0%{?stable_update} %define stablerev %{stable_update} @@ -693,6 +693,12 @@ Patch716: md-raid-reset-bio-allocated-from-mempool.patch # CVE-2017-14051 rhbz 1487126 1487127 Patch717: v2-scsi-qla2xxx-Fix-an-integer-overflow-in-sysfs-code.patch +# Should fix our QXL issues +Patch718: qxl-fix-primary-surface-handling.patch + +# rhbz 1463000 +Patch719: 0001-xen-balloon-don-t-online-new-memory-initially.patch + # END OF PATCH DEFINITIONS %endif @@ -2267,6 +2273,11 @@ fi # # %changelog +* Mon Sep 11 2017 Justin M. Forbes - 4.12.12-200 +- Linux v4.12.12 +- QXL Fixes +- Fix for xen ballow with AWS (rhbz 1463000) + * Thu Sep 07 2017 Justin M. Forbes - 4.12.11-200 - Linux v4.12.11 diff --git a/qxl-fix-primary-surface-handling.patch b/qxl-fix-primary-surface-handling.patch new file mode 100644 index 0000000..457634d --- /dev/null +++ b/qxl-fix-primary-surface-handling.patch @@ -0,0 +1,87 @@ +From b16a0bb7a9d54d9dd256059b35adf6f96fddc22e Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Wed, 6 Sep 2017 11:31:51 +0200 +Subject: qxl: fix primary surface handling + +The atomic conversion of the qxl driver didn't got the primary surface +handling completely right. It works in the common simple cases, but +fails for example when changing the display resolution using xrandr or +in multihead setups. + +The rules are simple: There is one primary surface. Before defining a +new one you have to destroy the old one. + +This patch makes qxl_primary_atomic_update() destroy the primary surface +before defining a new one. It fixes is_primary flag updates. It adds +is_primary checks so we don't try to update the primary surface in case +it already has the state we want it being in. + +Signed-off-by: Gerd Hoffmann +--- + drivers/gpu/drm/qxl/qxl_display.c | 34 +++++++++++++++++++--------------- + 1 file changed, 19 insertions(+), 15 deletions(-) + +diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c +index 14c5613..e1dd054 100644 +--- a/drivers/gpu/drm/qxl/qxl_display.c ++++ b/drivers/gpu/drm/qxl/qxl_display.c +@@ -509,23 +509,25 @@ static void qxl_primary_atomic_update(struct drm_plane *plane, + .y2 = qfb->base.height + }; + +- if (!old_state->fb) { +- qxl_io_log(qdev, +- "create primary fb: %dx%d,%d,%d\n", +- bo->surf.width, bo->surf.height, +- bo->surf.stride, bo->surf.format); ++ if (old_state->fb) { ++ qfb_old = to_qxl_framebuffer(old_state->fb); ++ bo_old = gem_to_qxl_bo(qfb_old->obj); ++ } else { ++ bo_old = NULL; ++ } + +- qxl_io_create_primary(qdev, 0, bo); +- bo->is_primary = true; ++ if (bo == bo_old) + return; + +- } else { +- qfb_old = to_qxl_framebuffer(old_state->fb); +- bo_old = gem_to_qxl_bo(qfb_old->obj); ++ if (bo_old && bo_old->is_primary) { ++ qxl_io_destroy_primary(qdev); + bo_old->is_primary = false; + } + +- bo->is_primary = true; ++ if (!bo->is_primary) { ++ qxl_io_create_primary(qdev, 0, bo); ++ bo->is_primary = true; ++ } + qxl_draw_dirty_fb(qdev, qfb, bo, 0, 0, &norect, 1, 1); + } + +@@ -534,13 +536,15 @@ static void qxl_primary_atomic_disable(struct drm_plane *plane, + { + struct qxl_device *qdev = plane->dev->dev_private; + +- if (old_state->fb) +- { struct qxl_framebuffer *qfb = ++ if (old_state->fb) { ++ struct qxl_framebuffer *qfb = + to_qxl_framebuffer(old_state->fb); + struct qxl_bo *bo = gem_to_qxl_bo(qfb->obj); + +- qxl_io_destroy_primary(qdev); +- bo->is_primary = false; ++ if (bo->is_primary) { ++ qxl_io_destroy_primary(qdev); ++ bo->is_primary = false; ++ } + } + } + +-- +cgit v0.12 + diff --git a/sources b/sources index 7edd9c3..85d2d20 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (perf-man-4.12.tar.gz) = 4d3bbda1f520dba0007c351af46f45085fe4842074eb2e01aee736fd369df595f8f72ed6c1192715f1120bf3353279777f9dca1178fe93bffe5be2de700d409c SHA512 (linux-4.12.tar.xz) = 8e81b41b253e63233e92948941f44c6482acb52aa3a3fd172f03a38a86f2c35b2ad4fd407acd1bc3964673eba344fe104d3a03e3ff4bf9cd1f22bd44263bd728 -SHA512 (patch-4.12.11.xz) = 853ab6e3d6025d6a093ba9193fe3fe66fe82a6e7a59b840a16d460fe24b17d81a2d299edcd32a20e4da25412a60c43457565dd4b48c5709d1d924e3ee471d4ec +SHA512 (patch-4.12.12.xz) = 5c61d2f761385f24a64f218011ac4e0d620666aa19fa0b92eb3169f9a059d1d9a06cd6dd56bd4dff9d2d331c82b5f76b58349bdbf48e4e01e0c56932aaf5a7a7