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