From 34729bc70719d3215a34486fb57b026ea332fea7 Mon Sep 17 00:00:00 2001 From: Adrian Calianu Date: Thu, 20 May 2021 08:48:04 +0200 Subject: patches: update guest boot optimizations update patches according to updates done in ClearLinux[1] [1] https://github.com/clearlinux-pkgs/linux-kvm/tree/5.9.16-505 Change-Id: I4938aa57c52838036524b311f840b75d04be21f2 Signed-off-by: Adrian Calianu --- ...-Avoid-EFI-reboot-when-not-running-on-EFI.patch | 38 +++++++++ ...accept-in-LIFO-order-for-cache-efficiency.patch | 89 ++++++++++++++++++++++ .../0102-give-rdrand-some-credit.patch | 30 ++++++++ ...03-init-wait-for-partition-and-retry-scan.patch | 52 +++++++++++++ patches/boot_time_opt_guest/0104-ksm-wakeups.patch | 52 +++++++++++++ .../0105-locking-rwsem-spin-faster.patch | 35 +++++++++ ...e-systemd-defaults-to-the-kernel-defaults.patch | 45 +++++++++++ .../0107-smpboot-reuse-timer-calibration.patch | 39 +++------- .../0108-use-lfence-instead-of-rep-and-nop.patch | 25 ++++++ ...-setting-user.-attributes-on-symlinks-by-.patch | 55 +++++++++++++ .../0111-overload-on-wakeup.patch | 43 +++++++++++ .../boot_time_opt_guest/guest_boot_time_opt.scc | 25 +++--- 12 files changed, 486 insertions(+), 42 deletions(-) create mode 100644 patches/boot_time_opt_guest/0051-x86-reboot-Avoid-EFI-reboot-when-not-running-on-EFI.patch create mode 100644 patches/boot_time_opt_guest/0101-do-accept-in-LIFO-order-for-cache-efficiency.patch create mode 100644 patches/boot_time_opt_guest/0102-give-rdrand-some-credit.patch create mode 100644 patches/boot_time_opt_guest/0103-init-wait-for-partition-and-retry-scan.patch create mode 100644 patches/boot_time_opt_guest/0104-ksm-wakeups.patch create mode 100644 patches/boot_time_opt_guest/0105-locking-rwsem-spin-faster.patch create mode 100644 patches/boot_time_opt_guest/0106-Migrate-some-systemd-defaults-to-the-kernel-defaults.patch create mode 100644 patches/boot_time_opt_guest/0108-use-lfence-instead-of-rep-and-nop.patch create mode 100644 patches/boot_time_opt_guest/0109-xattr-allow-setting-user.-attributes-on-symlinks-by-.patch create mode 100644 patches/boot_time_opt_guest/0111-overload-on-wakeup.patch diff --git a/patches/boot_time_opt_guest/0051-x86-reboot-Avoid-EFI-reboot-when-not-running-on-EFI.patch b/patches/boot_time_opt_guest/0051-x86-reboot-Avoid-EFI-reboot-when-not-running-on-EFI.patch new file mode 100644 index 0000000..7cabf08 --- /dev/null +++ b/patches/boot_time_opt_guest/0051-x86-reboot-Avoid-EFI-reboot-when-not-running-on-EFI.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Rob Bradford +Date: Thu, 29 Aug 2019 11:11:18 +0100 +Subject: [PATCH] x86/reboot: Avoid EFI reboot when not running on EFI + +Replace the check using efi_runtime_disabled() which only checks if EFI +runtime was disabled on the kernel command line with a call to +efi_enabled(EFI_RUNTIME_SERVICES) to check if EFI runtime services are +available. + +In the situation where the kernel was booted without an EFI environment +then only efi_enabled(EFI_RUNTIME_SERVICES) correctly represents that no +EFI is available. Setting "noefi" or "efi=noruntime" on the commandline +continue to have the same effect as efi_enabled(EFI_RUNTIME_SERVICES) +will return false. + +Signed-off-by: Rob Bradford +Link: https://lore.kernel.org/lkml/20190829101119.7345-1-robert.bradford@intel.com +--- + arch/x86/kernel/reboot.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c +index a515e2d230b7..7bf48675d9fc 100644 +--- a/arch/x86/kernel/reboot.c ++++ b/arch/x86/kernel/reboot.c +@@ -508,7 +508,7 @@ static int __init reboot_init(void) + */ + rv = dmi_check_system(reboot_dmi_table); + +- if (!rv && efi_reboot_required() && !efi_runtime_disabled()) ++ if (!rv && efi_reboot_required() && efi_enabled(EFI_RUNTIME_SERVICES)) + reboot_type = BOOT_EFI; + + return 0; +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0101-do-accept-in-LIFO-order-for-cache-efficiency.patch b/patches/boot_time_opt_guest/0101-do-accept-in-LIFO-order-for-cache-efficiency.patch new file mode 100644 index 0000000..fa056c5 --- /dev/null +++ b/patches/boot_time_opt_guest/0101-do-accept-in-LIFO-order-for-cache-efficiency.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Arjan van de Ven +Date: Thu, 13 Dec 2018 01:00:49 +0000 +Subject: [PATCH] do accept() in LIFO order for cache efficiency + +--- + include/linux/wait.h | 2 ++ + kernel/sched/wait.c | 24 ++++++++++++++++++++++++ + net/ipv4/inet_connection_sock.c | 2 +- + 3 files changed, 27 insertions(+), 1 deletion(-) + +diff --git a/include/linux/wait.h b/include/linux/wait.h +index 27fb99cfeb02..9a2c36d081bf 100644 +--- a/include/linux/wait.h ++++ b/include/linux/wait.h +@@ -164,6 +164,7 @@ static inline bool wq_has_sleeper(struct wait_queue_head *wq_head) + + extern void add_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry); + extern void add_wait_queue_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry); ++extern void add_wait_queue_exclusive_lifo(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry); + extern void remove_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry); + + static inline void __add_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry) +@@ -1127,6 +1128,7 @@ do { \ + */ + void prepare_to_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state); + void prepare_to_wait_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state); ++void prepare_to_wait_exclusive_lifo(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state); + long prepare_to_wait_event(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state); + void finish_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry); + long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout); +diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c +index 01f5d3020589..6fb633f219c4 100644 +--- a/kernel/sched/wait.c ++++ b/kernel/sched/wait.c +@@ -37,6 +37,17 @@ void add_wait_queue_exclusive(struct wait_queue_head *wq_head, struct wait_queue + } + EXPORT_SYMBOL(add_wait_queue_exclusive); + ++void add_wait_queue_exclusive_lifo(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry) ++{ ++ unsigned long flags; ++ ++ wq_entry->flags |= WQ_FLAG_EXCLUSIVE; ++ spin_lock_irqsave(&wq_head->lock, flags); ++ __add_wait_queue(wq_head, wq_entry); ++ spin_unlock_irqrestore(&wq_head->lock, flags); ++} ++EXPORT_SYMBOL(add_wait_queue_exclusive_lifo); ++ + void remove_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry) + { + unsigned long flags; +@@ -263,6 +274,19 @@ prepare_to_wait_exclusive(struct wait_queue_head *wq_head, struct wait_queue_ent + } + EXPORT_SYMBOL(prepare_to_wait_exclusive); + ++void prepare_to_wait_exclusive_lifo(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state) ++{ ++ unsigned long flags; ++ ++ wq_entry->flags |= WQ_FLAG_EXCLUSIVE; ++ spin_lock_irqsave(&wq_head->lock, flags); ++ if (list_empty(&wq_entry->entry)) ++ __add_wait_queue(wq_head, wq_entry); ++ set_current_state(state); ++ spin_unlock_irqrestore(&wq_head->lock, flags); ++} ++EXPORT_SYMBOL(prepare_to_wait_exclusive_lifo); ++ + void init_wait_entry(struct wait_queue_entry *wq_entry, int flags) + { + wq_entry->flags = flags; +diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c +index b457dd2d6c75..500fdb1bb95b 100644 +--- a/net/ipv4/inet_connection_sock.c ++++ b/net/ipv4/inet_connection_sock.c +@@ -433,7 +433,7 @@ static int inet_csk_wait_for_connect(struct sock *sk, long timeo) + * having to remove and re-insert us on the wait queue. + */ + for (;;) { +- prepare_to_wait_exclusive(sk_sleep(sk), &wait, ++ prepare_to_wait_exclusive_lifo(sk_sleep(sk), &wait, + TASK_INTERRUPTIBLE); + release_sock(sk); + if (reqsk_queue_empty(&icsk->icsk_accept_queue)) +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0102-give-rdrand-some-credit.patch b/patches/boot_time_opt_guest/0102-give-rdrand-some-credit.patch new file mode 100644 index 0000000..c5abf02 --- /dev/null +++ b/patches/boot_time_opt_guest/0102-give-rdrand-some-credit.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Arjan van de Ven +Date: Fri, 29 Jul 2016 19:10:52 +0000 +Subject: [PATCH] give rdrand some credit + +try to credit rdrand/rdseed with some entropy + +In VMs but even modern hardware, we're super starved for entropy, and while we can +and do wear a tin foil hat, it's very hard to argue that +rdrand and rdtsc add zero entropy. +--- + drivers/char/random.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/char/random.c b/drivers/char/random.c +index 2a41b21623ae..d4ecc0e9aef7 100644 +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -1781,6 +1781,8 @@ static void __init init_std_data(struct entropy_store *r) + if (!arch_get_random_seed_long(&rv) && + !arch_get_random_long(&rv)) + rv = random_get_entropy(); ++ else ++ credit_entropy_bits(r, 1); + mix_pool_bytes(r, &rv, sizeof(rv)); + } + mix_pool_bytes(r, utsname(), sizeof(*(utsname()))); +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0103-init-wait-for-partition-and-retry-scan.patch b/patches/boot_time_opt_guest/0103-init-wait-for-partition-and-retry-scan.patch new file mode 100644 index 0000000..98b7b5f --- /dev/null +++ b/patches/boot_time_opt_guest/0103-init-wait-for-partition-and-retry-scan.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Arjan van de Ven +Date: Wed, 17 May 2017 01:52:11 +0000 +Subject: [PATCH] init: wait for partition and retry scan + +As Clear Linux boots fast the device is not ready when +the mounting code is reached, so a retry device scan will +be performed every 0.5 sec for at least 40 sec +and synchronize the async task. + +Signed-off-by: Miguel Bernal Marin +--- + init/do_mounts.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/init/do_mounts.c b/init/do_mounts.c +index b5f9604d0c98..6022ead20701 100644 +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -225,11 +225,19 @@ dev_t name_to_dev_t(const char *name) + char *p; + dev_t res = 0; + int part; ++ /* we will wait at least 40 sec */ ++ int needtowait = 40<<1; + + #ifdef CONFIG_BLOCK + if (strncmp(name, "PARTUUID=", 9) == 0) { + name += 9; + res = devt_from_partuuid(name); ++ while (!res && needtowait) { ++ /* waiting 0.5 sec */ ++ msleep(500); ++ res = devt_from_partuuid(name); ++ needtowait--; ++ } + if (!res) + goto fail; + goto done; +@@ -596,7 +604,9 @@ void __init prepare_namespace(void) + * For example, it is not atypical to wait 5 seconds here + * for the touchpad of a laptop to initialize. + */ ++ async_synchronize_full(); + wait_for_device_probe(); ++ async_synchronize_full(); + + md_run_setup(); + +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0104-ksm-wakeups.patch b/patches/boot_time_opt_guest/0104-ksm-wakeups.patch new file mode 100644 index 0000000..e0e909a --- /dev/null +++ b/patches/boot_time_opt_guest/0104-ksm-wakeups.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Arjan van de Ven +Date: Mon, 6 May 2019 12:57:09 -0500 +Subject: [PATCH] ksm-wakeups + +reduce wakeups in ksm by adding rounding (aligning) when +the sleep times are 1 second or longer + +Signed-off-by: Arjan van de Ven +--- + kernel/watchdog.c | 2 +- + mm/ksm.c | 11 ++++++++--- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/kernel/watchdog.c b/kernel/watchdog.c +index 71109065bd8e..44ae1e267d48 100644 +--- a/kernel/watchdog.c ++++ b/kernel/watchdog.c +@@ -41,7 +41,7 @@ unsigned long __read_mostly watchdog_enabled; + int __read_mostly watchdog_user_enabled = 1; + int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT; + int __read_mostly soft_watchdog_user_enabled = 1; +-int __read_mostly watchdog_thresh = 10; ++int __read_mostly watchdog_thresh = 40; + static int __read_mostly nmi_watchdog_available; + + struct cpumask watchdog_cpumask __read_mostly; +diff --git a/mm/ksm.c b/mm/ksm.c +index 9afccc36dbd2..42328775e989 100644 +--- a/mm/ksm.c ++++ b/mm/ksm.c +@@ -2423,9 +2423,14 @@ static int ksm_scan_thread(void *nothing) + + if (ksmd_should_run()) { + sleep_ms = READ_ONCE(ksm_thread_sleep_millisecs); +- wait_event_interruptible_timeout(ksm_iter_wait, +- sleep_ms != READ_ONCE(ksm_thread_sleep_millisecs), +- msecs_to_jiffies(sleep_ms)); ++ if (sleep_ms >= 1000) ++ wait_event_interruptible_timeout(ksm_iter_wait, ++ sleep_ms != READ_ONCE(ksm_thread_sleep_millisecs), ++ msecs_to_jiffies(round_jiffies_relative(sleep_ms))); ++ else ++ wait_event_interruptible_timeout(ksm_iter_wait, ++ sleep_ms != READ_ONCE(ksm_thread_sleep_millisecs), ++ msecs_to_jiffies(sleep_ms)); + } else { + wait_event_freezable(ksm_thread_wait, + ksmd_should_run() || kthread_should_stop()); +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0105-locking-rwsem-spin-faster.patch b/patches/boot_time_opt_guest/0105-locking-rwsem-spin-faster.patch new file mode 100644 index 0000000..502064e --- /dev/null +++ b/patches/boot_time_opt_guest/0105-locking-rwsem-spin-faster.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Arjan van de Ven +Date: Sun, 18 Feb 2018 23:35:41 +0000 +Subject: [PATCH] locking: rwsem: spin faster + +tweak rwsem owner spinning a bit +--- + kernel/locking/rwsem.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c +index f11b9bd3431d..1bbfcc1e0474 100644 +--- a/kernel/locking/rwsem.c ++++ b/kernel/locking/rwsem.c +@@ -717,6 +717,7 @@ rwsem_spin_on_owner(struct rw_semaphore *sem, unsigned long nonspinnable) + struct task_struct *new, *owner; + unsigned long flags, new_flags; + enum owner_state state; ++ int i = 0; + + owner = rwsem_owner_flags(sem, &flags); + state = rwsem_owner_state(owner, flags, nonspinnable); +@@ -750,7 +751,8 @@ rwsem_spin_on_owner(struct rw_semaphore *sem, unsigned long nonspinnable) + break; + } + +- cpu_relax(); ++ if (i++ > 1000) ++ cpu_relax(); + } + rcu_read_unlock(); + +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0106-Migrate-some-systemd-defaults-to-the-kernel-defaults.patch b/patches/boot_time_opt_guest/0106-Migrate-some-systemd-defaults-to-the-kernel-defaults.patch new file mode 100644 index 0000000..1a055a0 --- /dev/null +++ b/patches/boot_time_opt_guest/0106-Migrate-some-systemd-defaults-to-the-kernel-defaults.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Auke Kok +Date: Thu, 2 Aug 2018 12:03:22 -0700 +Subject: [PATCH] Migrate some systemd defaults to the kernel defaults. + +These settings are needed to prevent networking issues when +the networking modules come up by default without explicit +settings, which breaks some cases. + +We don't want the modprobe settings to be read at boot time +if we're not going to do anything else ever. +--- + drivers/net/dummy.c | 2 +- + include/uapi/linux/if_bonding.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c +index bab3a9bb5e6f..dcd8a33c4a33 100644 +--- a/drivers/net/dummy.c ++++ b/drivers/net/dummy.c +@@ -43,7 +43,7 @@ + + #define DRV_NAME "dummy" + +-static int numdummies = 1; ++static int numdummies = 0; + + /* fake multicast ability */ + static void set_multicast_list(struct net_device *dev) +diff --git a/include/uapi/linux/if_bonding.h b/include/uapi/linux/if_bonding.h +index 45f3750aa861..317f8326ddd7 100644 +--- a/include/uapi/linux/if_bonding.h ++++ b/include/uapi/linux/if_bonding.h +@@ -82,7 +82,7 @@ + #define BOND_STATE_ACTIVE 0 /* link is active */ + #define BOND_STATE_BACKUP 1 /* link is backup */ + +-#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ ++#define BOND_DEFAULT_MAX_BONDS 0 /* Default maximum number of devices to support */ + + #define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */ + +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0107-smpboot-reuse-timer-calibration.patch b/patches/boot_time_opt_guest/0107-smpboot-reuse-timer-calibration.patch index 23b873f..22c2b07 100644 --- a/patches/boot_time_opt_guest/0107-smpboot-reuse-timer-calibration.patch +++ b/patches/boot_time_opt_guest/0107-smpboot-reuse-timer-calibration.patch @@ -1,45 +1,28 @@ -From 12409839a8fcf30e6b83290f30f1187efe4a58b6 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Wed, 11 Feb 2015 17:28:14 -0600 -Subject: [PATCH 107/114] smpboot: reuse timer calibration +Subject: [PATCH] smpboot: reuse timer calibration -NO point recalibrating for known-constant tsc... saves 200ms+ of boot time. - -Author: Arjan van de Ven - -Signed-off-by: Miguel Bernal Marin +NO point recalibrating for known-constant tsc ... +saves 200ms+ of boot time. --- - arch/x86/kernel/smpboot.c | 2 +- - arch/x86/kernel/tsc.c | 3 +++ - 2 files changed, 4 insertions(+), 1 deletion(-) + arch/x86/kernel/tsc.c | 3 +++ + 1 file changed, 3 insertions(+) -diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c -index f04479a8f74f..6f41d74350ec 100644 ---- a/arch/x86/kernel/smpboot.c -+++ b/arch/x86/kernel/smpboot.c -@@ -764,7 +764,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip) - pr_debug("Waiting for send to finish...\n"); - send_status = safe_apic_wait_icr_idle(); - -- udelay(init_udelay); -+ udelay(100); - - pr_debug("Deasserting INIT\n"); - diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c -index 714dfba6a1e7..96cddaf0f48b 100644 +index 49d925043171..704733712ec4 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c -@@ -1438,6 +1438,9 @@ unsigned long calibrate_delay_is_known(void) - if (!mask) +@@ -1546,6 +1546,9 @@ unsigned long calibrate_delay_is_known(void) + if (!constant_tsc || !mask) return 0; -+ if (cpu !=0) ++ if (cpu != 0) + return cpu_data(0).loops_per_jiffy; + sibling = cpumask_any_but(mask, cpu); if (sibling < nr_cpu_ids) return cpu_data(sibling).loops_per_jiffy; -- -2.13.2 +https://clearlinux.org diff --git a/patches/boot_time_opt_guest/0108-use-lfence-instead-of-rep-and-nop.patch b/patches/boot_time_opt_guest/0108-use-lfence-instead-of-rep-and-nop.patch new file mode 100644 index 0000000..463f384 --- /dev/null +++ b/patches/boot_time_opt_guest/0108-use-lfence-instead-of-rep-and-nop.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Arjan van de Ven +Date: Sat, 8 Dec 2018 18:21:32 +0000 +Subject: [PATCH] use lfence instead of rep and nop + +--- + arch/x86/include/asm/vdso/processor.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/include/asm/vdso/processor.h b/arch/x86/include/asm/vdso/processor.h +index 57b1a7034c64..e2c45674f989 100644 +--- a/arch/x86/include/asm/vdso/processor.h ++++ b/arch/x86/include/asm/vdso/processor.h +@@ -10,7 +10,7 @@ + /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ + static __always_inline void rep_nop(void) + { +- asm volatile("rep; nop" ::: "memory"); ++ asm volatile("lfence" ::: "memory"); + } + + static __always_inline void cpu_relax(void) +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0109-xattr-allow-setting-user.-attributes-on-symlinks-by-.patch b/patches/boot_time_opt_guest/0109-xattr-allow-setting-user.-attributes-on-symlinks-by-.patch new file mode 100644 index 0000000..75960ce --- /dev/null +++ b/patches/boot_time_opt_guest/0109-xattr-allow-setting-user.-attributes-on-symlinks-by-.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alan Cox +Date: Thu, 10 Mar 2016 15:11:28 +0000 +Subject: [PATCH] xattr: allow setting user.* attributes on symlinks by owner + +Kvmtool and clear containers supports using user attributes to label host +files with the virtual uid/guid of the file in the container. This allows an +end user to manage their files and a complete uid space without all the ugly +namespace stuff. + +The one gap in the support is symlinks because an end user can change the +ownership of a symbolic link. We support attributes on these files as you +can already (as root) set security attributes on them. + +The current rules seem slightly over-paranoid and as we have a use case this +patch enables updating the attributes on a symbolic link IFF you are the +owner of the synlink (as permissions are not usually meaningful on the link +itself). + +Signed-off-by: Alan Cox +--- + fs/xattr.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/fs/xattr.c b/fs/xattr.c +index 386b45676d7e..cabada890bae 100644 +--- a/fs/xattr.c ++++ b/fs/xattr.c +@@ -119,15 +119,17 @@ xattr_permission(struct inode *inode, const char *name, int mask) + } + + /* +- * In the user.* namespace, only regular files and directories can have +- * extended attributes. For sticky directories, only the owner and +- * privileged users can write attributes. ++ * In the user.* namespace, only regular files, symbolic links, and ++ * directories can have extended attributes. For symbolic links and ++ * sticky directories, only the owner and privileged users can write ++ * attributes. + */ + if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) { +- if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) ++ if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) && !S_ISLNK(inode->i_mode)) + return (mask & MAY_WRITE) ? -EPERM : -ENODATA; +- if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) && +- (mask & MAY_WRITE) && !inode_owner_or_capable(inode)) ++ if (((S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX)) ++ || S_ISLNK(inode->i_mode)) && (mask & MAY_WRITE) ++ && !inode_owner_or_capable(inode)) + return -EPERM; + } + +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/0111-overload-on-wakeup.patch b/patches/boot_time_opt_guest/0111-overload-on-wakeup.patch new file mode 100644 index 0000000..724e9a9 --- /dev/null +++ b/patches/boot_time_opt_guest/0111-overload-on-wakeup.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: jplozi +Date: Fri, 11 Mar 2016 15:18:06 +0100 +Subject: [PATCH] overload on wakeup + +source https://github.com/jplozi/wastedcores + +as an experiment, apply the learnings from the wasted-cores paper +and see how the performance works out. With the data from this we should +be able to work with Peter and the rest of the scheduler folks on +a more permanent/elegant solution. +--- + kernel/sched/fair.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index c0c4d9ad7da8..a59694f24106 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -6693,6 +6693,20 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f + } + + rcu_read_lock(); ++ ++ if (cpu_rq(prev_cpu)->nr_running) { ++ int _cpu; ++ ++ for_each_online_cpu(_cpu) { ++ if (!cpumask_test_cpu(_cpu, p->cpus_ptr) || ++ cpu_rq(_cpu)->nr_running) ++ continue; ++ ++ rcu_read_unlock(); ++ return _cpu; ++ } ++ } ++ + for_each_domain(cpu, tmp) { + /* + * If both 'cpu' and 'prev_cpu' are part of this domain, +-- +https://clearlinux.org + diff --git a/patches/boot_time_opt_guest/guest_boot_time_opt.scc b/patches/boot_time_opt_guest/guest_boot_time_opt.scc index c571cbf..28ca225 100644 --- a/patches/boot_time_opt_guest/guest_boot_time_opt.scc +++ b/patches/boot_time_opt_guest/guest_boot_time_opt.scc @@ -1,17 +1,14 @@ -define KFEATURE_DESCRIPTION "Boot time optimization changes ported from ClearLinux , https://github.com/clearlinux-pkgs/linux-kvm" +define KFEATURE_DESCRIPTION "Boot time optimization changes ported from ClearLinux , https://github.com/clearlinux-pkgs/linux-kvm/tree/5.9.16-505" define KFEATURE_COMPATIBILITY all -patch 0102-sysrq-skip-synchronize_rcu-if-there-is-no-old-op.patch -patch 0103-fbcon-enable-no-blink-by-default.patch -patch 0104-mm-reduce-vmstat-wakeups.patch -patch 0106-cgroup-delayed-work.patch +patch 0051-x86-reboot-Avoid-EFI-reboot-when-not-running-on-EFI.patch +patch 0101-do-accept-in-LIFO-order-for-cache-efficiency.patch +patch 0102-give-rdrand-some-credit.patch +patch 0103-init-wait-for-partition-and-retry-scan.patch +patch 0104-ksm-wakeups.patch +patch 0105-locking-rwsem-spin-faster.patch +patch 0106-Migrate-some-systemd-defaults-to-the-kernel-defaults.patch patch 0107-smpboot-reuse-timer-calibration.patch -patch 0108-perf.patch -patch 0109-pci-probe-identify-known-devices.patch -patch 0110-init-no-wait-for-the-known-devices.patch -patch 0111-ksm-wakeups.patch - -patch 0151-mm-Export-do_madvise.patch -patch 0152-x86-kvm-Notify-host-to-release-pages.patch -patch 0153-x86-Return-memory-from-guest-to-host-kernel.patch -patch 0154-sysctl-vm-Fine-grained-cache-shrinking.patch +patch 0108-use-lfence-instead-of-rep-and-nop.patch +patch 0109-xattr-allow-setting-user.-attributes-on-symlinks-by-.patch +patch 0111-overload-on-wakeup.patch -- cgit v1.2.3-54-g00ecf