[tip: x86/platform] x86/platform/uv: Fix !KEXEC build failure

2021-04-20 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/platform branch of tip:

Commit-ID: c2209ea55612efac75de0a58ef5f7394fae7fa0f
Gitweb:
https://git.kernel.org/tip/c2209ea55612efac75de0a58ef5f7394fae7fa0f
Author:Ingo Molnar 
AuthorDate:Tue, 20 Apr 2021 09:47:42 +02:00
Committer: Ingo Molnar 
CommitterDate: Tue, 20 Apr 2021 10:08:23 +02:00

x86/platform/uv: Fix !KEXEC build failure

When KEXEC is disabled, the UV build fails:

  arch/x86/platform/uv/uv_nmi.c:875:14: error: ‘uv_nmi_kexec_failed’ undeclared 
(first use in this function)

Since uv_nmi_kexec_failed is only defined in the KEXEC_CORE #ifdef branch,
this code cannot ever have been build tested:

if (main)
pr_err("UV: NMI kdump: KEXEC not supported in this kernel\n");
atomic_set(_nmi_kexec_failed, 1);

Nor is this use possible in uv_handle_nmi():

atomic_set(_nmi_kexec_failed, 0);

These bugs were introduced in this commit:

d0a9964e9873: ("x86/platform/uv: Implement simple dump failover if kdump 
fails")

Which added the uv_nmi_kexec_failed assignments to !KEXEC code, while making the
definition KEXEC-only - apparently without testing the !KEXEC case.

Instead of complicating the #ifdef maze, simplify the code by requiring X86_UV
to depend on KEXEC_CORE. This pattern is present in other architectures as well.

( We'll remove the untested, 7 years old !KEXEC complications from the file in a
  separate commit. )

Fixes: d0a9964e9873: ("x86/platform/uv: Implement simple dump failover if kdump 
fails")
Signed-off-by: Ingo Molnar 
Cc: Mike Travis 
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 2792879..d9776c9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -571,6 +571,7 @@ config X86_UV
depends on X86_EXTENDED_PLATFORM
depends on NUMA
depends on EFI
+   depends on KEXEC_CORE
depends on X86_X2APIC
depends on PCI
help


[tip: x86/platform] x86/platform/uv: Remove dead !CONFIG_KEXEC_CORE code

2021-04-20 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/platform branch of tip:

Commit-ID: 27743f01e391ee1d80e3be2a09237507b965f91b
Gitweb:
https://git.kernel.org/tip/27743f01e391ee1d80e3be2a09237507b965f91b
Author:Ingo Molnar 
AuthorDate:Tue, 20 Apr 2021 10:03:02 +02:00
Committer: Ingo Molnar 
CommitterDate: Tue, 20 Apr 2021 10:08:34 +02:00

x86/platform/uv: Remove dead !CONFIG_KEXEC_CORE code

The !CONFIG_KEXEC_CORE code in arch/x86/platform/uv/uv_nmi.c was unused, 
untested
and didn't even build for 7 years. Since we fixed this by requiring X86_UV to
depend on CONFIG_KEXEC_CORE, remove the (now) dead code.

Also move the uv_nmi_kexec_failed definition back up to where the other 
file-scope
global variables are defined.

Signed-off-by: Ingo Molnar 
Cc: Mike Travis 
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/platform/uv/uv_nmi.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index f83810f..1556108 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -92,6 +92,8 @@ static atomic_t uv_nmi_cpus_in_nmi = ATOMIC_INIT(-1);
 static atomic_t uv_nmi_slave_continue;
 static cpumask_var_t uv_nmi_cpu_mask;
 
+static atomic_t uv_nmi_kexec_failed;
+
 /* Values for uv_nmi_slave_continue */
 #define SLAVE_CLEAR0
 #define SLAVE_CONTINUE 1
@@ -835,8 +837,6 @@ static void uv_nmi_touch_watchdogs(void)
touch_nmi_watchdog();
 }
 
-#if defined(CONFIG_KEXEC_CORE)
-static atomic_t uv_nmi_kexec_failed;
 static void uv_nmi_kdump(int cpu, int main, struct pt_regs *regs)
 {
/* Check if kdump kernel loaded for both main and secondary CPUs */
@@ -867,15 +867,6 @@ static void uv_nmi_kdump(int cpu, int main, struct pt_regs 
*regs)
}
 }
 
-#else /* !CONFIG_KEXEC_CORE */
-static inline void uv_nmi_kdump(int cpu, int main, struct pt_regs *regs)
-{
-   if (main)
-   pr_err("UV: NMI kdump: KEXEC not supported in this kernel\n");
-   atomic_set(_nmi_kexec_failed, 1);
-}
-#endif /* !CONFIG_KEXEC_CORE */
-
 #ifdef CONFIG_KGDB
 #ifdef CONFIG_KGDB_KDB
 static inline int uv_nmi_kdb_reason(void)


[tip: timers/core] timekeeping, clocksource: Fix various typos in comments

2021-03-22 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the timers/core branch of tip:

Commit-ID: 4bf07f6562a01a488877e05267808da7147f44a5
Gitweb:
https://git.kernel.org/tip/4bf07f6562a01a488877e05267808da7147f44a5
Author:Ingo Molnar 
AuthorDate:Mon, 22 Mar 2021 22:39:03 +01:00
Committer: Ingo Molnar 
CommitterDate: Mon, 22 Mar 2021 23:06:48 +01:00

timekeeping, clocksource: Fix various typos in comments

Fix ~56 single-word typos in timekeeping & clocksource code comments.

Signed-off-by: Ingo Molnar 
Cc: Thomas Gleixner 
Cc: John Stultz 
Cc: Stephen Boyd 
Cc: Daniel Lezcano 
Cc: linux-kernel@vger.kernel.org
---
 drivers/clocksource/clksrc-dbx500-prcmu.c   |  8 ++---
 drivers/clocksource/dw_apb_timer_of.c   |  2 +-
 drivers/clocksource/hyperv_timer.c  |  2 +-
 drivers/clocksource/timer-atmel-tcb.c   |  4 +--
 drivers/clocksource/timer-fsl-ftm.c |  2 +-
 drivers/clocksource/timer-microchip-pit64b.c|  2 +-
 drivers/clocksource/timer-of.c  |  4 +--
 drivers/clocksource/timer-ti-dm-systimer.c  |  2 +-
 drivers/clocksource/timer-vf-pit.c  |  2 +-
 include/linux/clocksource.h |  2 +-
 include/linux/timex.h   |  2 +-
 kernel/time/alarmtimer.c|  6 ++--
 kernel/time/clocksource.c   |  4 +--
 kernel/time/hrtimer.c   | 18 ++--
 kernel/time/jiffies.c   |  2 +-
 kernel/time/ntp.c   |  2 +-
 kernel/time/posix-cpu-timers.c  |  6 ++--
 kernel/time/tick-broadcast-hrtimer.c|  2 +-
 kernel/time/tick-broadcast.c|  4 +--
 kernel/time/tick-oneshot.c  |  2 +-
 kernel/time/tick-sched.c|  2 +-
 kernel/time/tick-sched.h|  2 +-
 kernel/time/time.c  |  2 +-
 kernel/time/timekeeping.c   | 10 +++
 kernel/time/timer.c |  4 +--
 kernel/time/vsyscall.c  |  2 +-
 tools/testing/selftests/timers/clocksource-switch.c |  4 +--
 tools/testing/selftests/timers/leap-a-day.c |  2 +-
 tools/testing/selftests/timers/leapcrash.c  |  4 +--
 tools/testing/selftests/timers/threadtest.c |  2 +-
 30 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/drivers/clocksource/clksrc-dbx500-prcmu.c 
b/drivers/clocksource/clksrc-dbx500-prcmu.c
index 996900d..2fc93e4 100644
--- a/drivers/clocksource/clksrc-dbx500-prcmu.c
+++ b/drivers/clocksource/clksrc-dbx500-prcmu.c
@@ -18,7 +18,7 @@
 
 #define RATE_32K   32768
 
-#define TIMER_MODE_CONTINOUS   0x1
+#define TIMER_MODE_CONTINUOUS  0x1
 #define TIMER_DOWNCOUNT_VAL0x
 
 #define PRCMU_TIMER_REF0
@@ -55,13 +55,13 @@ static int __init clksrc_dbx500_prcmu_init(struct 
device_node *node)
 
/*
 * The A9 sub system expects the timer to be configured as
-* a continous looping timer.
+* a continuous looping timer.
 * The PRCMU should configure it but if it for some reason
 * don't we do it here.
 */
if (readl(clksrc_dbx500_timer_base + PRCMU_TIMER_MODE) !=
-   TIMER_MODE_CONTINOUS) {
-   writel(TIMER_MODE_CONTINOUS,
+   TIMER_MODE_CONTINUOUS) {
+   writel(TIMER_MODE_CONTINUOUS,
   clksrc_dbx500_timer_base + PRCMU_TIMER_MODE);
writel(TIMER_DOWNCOUNT_VAL,
   clksrc_dbx500_timer_base + PRCMU_TIMER_REF);
diff --git a/drivers/clocksource/dw_apb_timer_of.c 
b/drivers/clocksource/dw_apb_timer_of.c
index 42e7e43..2b2c3b5 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -38,7 +38,7 @@ static int __init timer_get_base_and_rate(struct device_node 
*np,
}
 
/*
-* Not all implementations use a periphal clock, so don't panic
+* Not all implementations use a peripheral clock, so don't panic
 * if it's not present
 */
pclk = of_clk_get_by_name(np, "pclk");
diff --git a/drivers/clocksource/hyperv_timer.c 
b/drivers/clocksource/hyperv_timer.c
index 269a691..a02b0a2 100644
--- a/drivers/clocksource/hyperv_timer.c
+++ b/drivers/clocksource/hyperv_timer.c
@@ -457,7 +457,7 @@ void __init hv_init_clocksource(void)
 {
/*
 * Try to set up the TSC page clocksource. If it succeeds, we're
-* done. Otherwise, set up the MSR clocksoruce.  At least one of
+* done. Otherwise, set up the MSR clocksource.  At least one of
 * these will always be available except on very old versions of
 * Hyper-V on x86.  In that case we won't have a Hyper-V
 * clocksource, but Linux will still run with 

[tip: irq/core] irq: Fix typos in comments

2021-03-21 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the irq/core branch of tip:

Commit-ID: a359f757965aafd0f58570de95dc6bc06cf12a9c
Gitweb:
https://git.kernel.org/tip/a359f757965aafd0f58570de95dc6bc06cf12a9c
Author:Ingo Molnar 
AuthorDate:Mon, 22 Mar 2021 04:21:30 +01:00
Committer: Ingo Molnar 
CommitterDate: Mon, 22 Mar 2021 04:23:14 +01:00

irq: Fix typos in comments

Fix ~36 single-word typos in the IRQ, irqchip and irqdomain code comments.

Signed-off-by: Ingo Molnar 
Cc: Thomas Gleixner 
Cc: Marc Zyngier 
Cc: Borislav Petkov 
Cc: Peter Zijlstra 
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar 
---
 drivers/irqchip/irq-aspeed-vic.c   |  4 ++--
 drivers/irqchip/irq-bcm7120-l2.c   |  2 +-
 drivers/irqchip/irq-csky-apb-intc.c|  2 +-
 drivers/irqchip/irq-gic-v2m.c  |  2 +-
 drivers/irqchip/irq-gic-v3-its.c   | 10 +-
 drivers/irqchip/irq-gic-v3.c   |  2 +-
 drivers/irqchip/irq-loongson-pch-pic.c |  2 +-
 drivers/irqchip/irq-meson-gpio.c   |  2 +-
 drivers/irqchip/irq-mtk-cirq.c |  2 +-
 drivers/irqchip/irq-mxs.c  |  4 ++--
 drivers/irqchip/irq-sun4i.c|  2 +-
 drivers/irqchip/irq-ti-sci-inta.c  |  2 +-
 drivers/irqchip/irq-vic.c  |  4 ++--
 drivers/irqchip/irq-xilinx-intc.c  |  2 +-
 include/linux/irq.h|  4 ++--
 include/linux/irqdesc.h|  2 +-
 kernel/irq/chip.c  |  2 +-
 kernel/irq/dummychip.c |  2 +-
 kernel/irq/irqdesc.c   |  2 +-
 kernel/irq/irqdomain.c |  8 
 kernel/irq/manage.c|  6 +++---
 kernel/irq/msi.c   |  2 +-
 kernel/irq/timings.c   |  2 +-
 23 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/drivers/irqchip/irq-aspeed-vic.c b/drivers/irqchip/irq-aspeed-vic.c
index 6567ed7..58717cd 100644
--- a/drivers/irqchip/irq-aspeed-vic.c
+++ b/drivers/irqchip/irq-aspeed-vic.c
@@ -71,7 +71,7 @@ static void vic_init_hw(struct aspeed_vic *vic)
writel(0, vic->base + AVIC_INT_SELECT);
writel(0, vic->base + AVIC_INT_SELECT + 4);
 
-   /* Some interrupts have a programable high/low level trigger
+   /* Some interrupts have a programmable high/low level trigger
 * (4 GPIO direct inputs), for now we assume this was configured
 * by firmware. We read which ones are edge now.
 */
@@ -203,7 +203,7 @@ static int __init avic_of_init(struct device_node *node,
}
vic->base = regs;
 
-   /* Initialize soures, all masked */
+   /* Initialize sources, all masked */
vic_init_hw(vic);
 
/* Ready to receive interrupts */
diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index c7c9e97..ad59656 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -309,7 +309,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node 
*dn,
 
if (data->can_wake) {
/* This IRQ chip can wake the system, set all
-* relevant child interupts in wake_enabled mask
+* relevant child interrupts in wake_enabled mask
 */
gc->wake_enabled = 0x;
gc->wake_enabled &= ~gc->unused;
diff --git a/drivers/irqchip/irq-csky-apb-intc.c 
b/drivers/irqchip/irq-csky-apb-intc.c
index 5a2ec43..ab91afa 100644
--- a/drivers/irqchip/irq-csky-apb-intc.c
+++ b/drivers/irqchip/irq-csky-apb-intc.c
@@ -176,7 +176,7 @@ gx_intc_init(struct device_node *node, struct device_node 
*parent)
writel(0x0, reg_base + GX_INTC_NEN63_32);
 
/*
-* Initial mask reg with all unmasked, because we only use enalbe reg
+* Initial mask reg with all unmasked, because we only use enable reg
 */
writel(0x0, reg_base + GX_INTC_NMASK31_00);
writel(0x0, reg_base + GX_INTC_NMASK63_32);
diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c
index fbec07d..4116b48 100644
--- a/drivers/irqchip/irq-gic-v2m.c
+++ b/drivers/irqchip/irq-gic-v2m.c
@@ -371,7 +371,7 @@ static int __init gicv2m_init_one(struct fwnode_handle 
*fwnode,
 * the MSI data is the absolute value within the range from
 * spi_start to (spi_start + num_spis).
 *
-* Broadom NS2 GICv2m implementation has an erratum where the MSI data
+* Broadcom NS2 GICv2m implementation has an erratum where the MSI data
 * is 'spi_number - 32'
 *
 * Reading that register fails on the Graviton implementation
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index ed46e60..c3485b2 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1492,7 +1492,7 @@ static void its_vlpi_set_doorbell(struct irq_data *d, 
bool enable)
 *
 * 

[tip: core/entry] entry: Fix typos in comments

2021-03-21 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the core/entry branch of tip:

Commit-ID: 97258ce902d1e1c396a4d7c38f6ae7085adb73c5
Gitweb:
https://git.kernel.org/tip/97258ce902d1e1c396a4d7c38f6ae7085adb73c5
Author:Ingo Molnar 
AuthorDate:Mon, 22 Mar 2021 03:55:50 +01:00
Committer: Ingo Molnar 
CommitterDate: Mon, 22 Mar 2021 03:57:39 +01:00

entry: Fix typos in comments

Fix 3 single-word typos in the generic syscall entry code.

Signed-off-by: Ingo Molnar 
Cc: Borislav Petkov 
Cc: Thomas Gleixner 
Cc: Peter Zijlstra 
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar 
---
 include/linux/entry-common.h | 4 ++--
 kernel/entry/common.c| 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index 883acef..2e2b8d6 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -360,7 +360,7 @@ void syscall_exit_to_user_mode_work(struct pt_regs *regs);
  *
  * This is a combination of syscall_exit_to_user_mode_work() (1,2) and
  * exit_to_user_mode(). This function is preferred unless there is a
- * compelling architectural reason to use the seperate functions.
+ * compelling architectural reason to use the separate functions.
  */
 void syscall_exit_to_user_mode(struct pt_regs *regs);
 
@@ -381,7 +381,7 @@ void irqentry_enter_from_user_mode(struct pt_regs *regs);
  * irqentry_exit_to_user_mode - Interrupt exit work
  * @regs:  Pointer to current's pt_regs
  *
- * Invoked with interrupts disbled and fully valid regs. Returns with all
+ * Invoked with interrupts disabled and fully valid regs. Returns with all
  * work handled, interrupts disabled such that the caller can immediately
  * switch to user mode. Called from architecture specific interrupt
  * handling code.
diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 8442e5c..8d996dd 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -341,7 +341,7 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs 
*regs)
 * Checking for rcu_is_watching() here would prevent the nesting
 * interrupt to invoke rcu_irq_enter(). If that nested interrupt is
 * the tick then rcu_flavor_sched_clock_irq() would wrongfully
-* assume that it is the first interupt and eventually claim
+* assume that it is the first interrupt and eventually claim
 * quiescent state and end grace periods prematurely.
 *
 * Unconditionally invoke rcu_irq_enter() so RCU state stays


[tip: sched/core] sched: Fix various typos

2021-03-21 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the sched/core branch of tip:

Commit-ID: 3b03706fa621ce31a3e9ef6307020fde4e6aae16
Gitweb:
https://git.kernel.org/tip/3b03706fa621ce31a3e9ef6307020fde4e6aae16
Author:Ingo Molnar 
AuthorDate:Thu, 18 Mar 2021 13:38:50 +01:00
Committer: Ingo Molnar 
CommitterDate: Mon, 22 Mar 2021 00:11:52 +01:00

sched: Fix various typos

Fix ~42 single-word typos in scheduler code comments.

We have accumulated a few fun ones over the years. :-)

Signed-off-by: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: Mike Galbraith 
Cc: Juri Lelli 
Cc: Vincent Guittot 
Cc: Dietmar Eggemann 
Cc: Steven Rostedt 
Cc: Ben Segall 
Cc: Mel Gorman 
Cc: linux-kernel@vger.kernel.org
---
 include/linux/sched.h|  2 +-
 kernel/sched/clock.c |  2 +-
 kernel/sched/core.c  |  2 +-
 kernel/sched/cpuacct.c   |  2 +-
 kernel/sched/cpufreq_schedutil.c |  2 +-
 kernel/sched/cpupri.c|  4 ++--
 kernel/sched/cputime.c   |  2 +-
 kernel/sched/deadline.c  | 12 ++--
 kernel/sched/debug.c |  2 +-
 kernel/sched/fair.c  | 18 +-
 kernel/sched/features.h  |  2 +-
 kernel/sched/idle.c  |  4 ++--
 kernel/sched/loadavg.c   |  2 +-
 kernel/sched/pelt.c  |  2 +-
 kernel/sched/pelt.h  |  2 +-
 kernel/sched/psi.c   |  6 +++---
 kernel/sched/rt.c|  6 +++---
 kernel/sched/sched.h |  8 
 kernel/sched/stats.c |  2 +-
 kernel/sched/topology.c  |  2 +-
 20 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index cf245bc..05572e2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1097,7 +1097,7 @@ struct task_struct {
 #ifdef CONFIG_CPUSETS
/* Protected by ->alloc_lock: */
nodemask_t  mems_allowed;
-   /* Seqence number to catch updates: */
+   /* Sequence number to catch updates: */
seqcount_spinlock_t mems_allowed_seq;
int cpuset_mem_spread_rotor;
int cpuset_slab_spread_rotor;
diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index 12bca64..c2b2859 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -41,7 +41,7 @@
  * Otherwise it tries to create a semi stable clock from a mixture of other
  * clocks, including:
  *
- *  - GTOD (clock monotomic)
+ *  - GTOD (clock monotonic)
  *  - sched_clock()
  *  - explicit idle events
  *
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 28c4df6..3384ea7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8975,7 +8975,7 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, 
u64 period, u64 quota)
return -EINVAL;
 
/*
-* Likewise, bound things on the otherside by preventing insane quota
+* Likewise, bound things on the other side by preventing insane quota
 * periods.  This also allows us to normalize in computing quota
 * feasibility.
 */
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 941c28c..104a1ba 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -104,7 +104,7 @@ static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int 
cpu,
 
/*
 * We allow index == CPUACCT_STAT_NSTATS here to read
-* the sum of suages.
+* the sum of usages.
 */
BUG_ON(index > CPUACCT_STAT_NSTATS);
 
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 50cbad8..7cc2e11 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -471,7 +471,7 @@ static void sugov_work(struct kthread_work *work)
 
/*
 * Hold sg_policy->update_lock shortly to handle the case where:
-* incase sg_policy->next_freq is read here, and then updated by
+* in case sg_policy->next_freq is read here, and then updated by
 * sugov_deferred_update() just before work_in_progress is set to false
 * here, we may miss queueing the new update.
 *
diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index ec9be78..d583f2a 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -77,7 +77,7 @@ static inline int __cpupri_find(struct cpupri *cp, struct 
task_struct *p,
 * When looking at the vector, we need to read the counter,
 * do a memory barrier, then read the mask.
 *
-* Note: This is still all racey, but we can deal with it.
+* Note: This is still all racy, but we can deal with it.
 *  Ideally, we only want to look at masks that are set.
 *
 *  If a mask is not set, then the only thing wrong is that we
@@ -186,7 +186,7 @@ int cpupri_find_fitness(struct cpupri *cp, struct 
task_struct *p,
 * The cost of this 

[tip: locking/core] locking: Fix typos in comments

2021-03-21 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the locking/core branch of tip:

Commit-ID: e2db7592be8e83df47519116621411e1056b21c7
Gitweb:
https://git.kernel.org/tip/e2db7592be8e83df47519116621411e1056b21c7
Author:Ingo Molnar 
AuthorDate:Mon, 22 Mar 2021 02:35:05 +01:00
Committer: Ingo Molnar 
CommitterDate: Mon, 22 Mar 2021 02:45:52 +01:00

locking: Fix typos in comments

Fix ~16 single-word typos in locking code comments.

Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: Paul E. McKenney 
Cc: Will Deacon 
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar 
---
 arch/arm/include/asm/spinlock.h | 2 +-
 include/linux/lockdep.h | 2 +-
 include/linux/rwsem.h   | 2 +-
 kernel/locking/lockdep.c| 4 ++--
 kernel/locking/lockdep_proc.c   | 2 +-
 kernel/locking/mcs_spinlock.h   | 2 +-
 kernel/locking/mutex.c  | 4 ++--
 kernel/locking/osq_lock.c   | 4 ++--
 kernel/locking/rtmutex.c| 4 ++--
 kernel/locking/rwsem.c  | 2 +-
 kernel/locking/spinlock.c   | 4 ++--
 11 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 8f009e7..f610a77 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -22,7 +22,7 @@
  * assembler to insert a extra (16-bit) IT instruction, depending on the
  * presence or absence of neighbouring conditional instructions.
  *
- * To avoid this unpredictableness, an approprite IT is inserted explicitly:
+ * To avoid this unpredictability, an appropriate IT is inserted explicitly:
  * the assembler won't change IT instructions which are explicitly present
  * in the input.
  */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 17805aa..09ac2e8 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -155,7 +155,7 @@ extern void lockdep_set_selftest_task(struct task_struct 
*task);
 extern void lockdep_init_task(struct task_struct *task);
 
 /*
- * Split the recrursion counter in two to readily detect 'off' vs recursion.
+ * Split the recursion counter in two to readily detect 'off' vs recursion.
  */
 #define LOCKDEP_RECURSION_BITS 16
 #define LOCKDEP_OFF(1U << LOCKDEP_RECURSION_BITS)
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 4c715be..a66038d 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -110,7 +110,7 @@ do {
\
 
 /*
  * This is the same regardless of which rwsem implementation that is being 
used.
- * It is just a heuristic meant to be called by somebody alreadying holding the
+ * It is just a heuristic meant to be called by somebody already holding the
  * rwsem to see if somebody from an incompatible type is wanting access to the
  * lock.
  */
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index c0b8926..0e97287 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -1747,7 +1747,7 @@ static enum bfs_result __bfs(struct lock_list 
*source_entry,
 
/*
 * Step 4: if not match, expand the path by adding the
-* forward or backwards dependencis in the search
+* forward or backwards dependencies in the search
 *
 */
first = true;
@@ -1916,7 +1916,7 @@ print_circular_bug_header(struct lock_list *entry, 
unsigned int depth,
  * -> B is -(ER)-> or -(EN)->, then we don't need to add A -> B into the
  * dependency graph, as any strong path ..-> A -> B ->.. we can get with
  * having dependency A -> B, we could already get a equivalent path ..-> A ->
- * .. -> B -> .. with A -> .. -> B. Therefore A -> B is reduntant.
+ * .. -> B -> .. with A -> .. -> B. Therefore A -> B is redundant.
  *
  * We need to make sure both the start and the end of A -> .. -> B is not
  * weaker than A -> B. For the start part, please see the comment in
diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
index 02ef87f..8069783 100644
--- a/kernel/locking/lockdep_proc.c
+++ b/kernel/locking/lockdep_proc.c
@@ -348,7 +348,7 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
debug_locks);
 
/*
-* Zappped classes and lockdep data buffers reuse statistics.
+* Zapped classes and lockdep data buffers reuse statistics.
 */
seq_puts(m, "\n");
seq_printf(m, " zapped classes:%11lu\n",
diff --git a/kernel/locking/mcs_spinlock.h b/kernel/locking/mcs_spinlock.h
index 5e10153..85251d8 100644
--- a/kernel/locking/mcs_spinlock.h
+++ b/kernel/locking/mcs_spinlock.h
@@ -7,7 +7,7 @@
  * The MCS lock (proposed by Mellor-Crummey and Scott) is a simple spin-lock
  * with the desirable properties of being fair, and with each cpu trying
  * to acquire the lock spinning on a local variable.
- * It avoids expensive cache bouncings that 

[tip: x86/cleanups] x86: Fix various typos in comments, take #2

2021-03-21 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 163b099146b85d1b05bd2eaa045acbeee25c29e4
Gitweb:
https://git.kernel.org/tip/163b099146b85d1b05bd2eaa045acbeee25c29e4
Author:Ingo Molnar 
AuthorDate:Sun, 21 Mar 2021 22:28:53 +01:00
Committer: Ingo Molnar 
CommitterDate: Sun, 21 Mar 2021 23:50:28 +01:00

x86: Fix various typos in comments, take #2

Fix another ~42 single-word typos in arch/x86/ code comments,
missed a few in the first pass, in particular in .S files.

Signed-off-by: Ingo Molnar 
Cc: Borislav Petkov 
Cc: Thomas Gleixner 
Cc: Peter Zijlstra 
Cc: Paolo Bonzini 
Cc: Bjorn Helgaas 
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/boot/compressed/efi_thunk_64.S  | 2 +-
 arch/x86/boot/compressed/head_64.S   | 2 +-
 arch/x86/crypto/crc32-pclmul_glue.c  | 2 +-
 arch/x86/crypto/twofish-x86_64-asm_64-3way.S | 2 +-
 arch/x86/entry/entry_32.S| 2 +-
 arch/x86/entry/entry_64.S| 2 +-
 arch/x86/entry/vdso/vdso2c.c | 2 +-
 arch/x86/entry/vdso/vdso32/system_call.S | 2 +-
 arch/x86/entry/vdso/vma.c| 2 +-
 arch/x86/entry/vdso/vsgx.S   | 2 +-
 arch/x86/events/intel/bts.c  | 2 +-
 arch/x86/events/intel/core.c | 2 +-
 arch/x86/events/intel/p4.c   | 2 +-
 arch/x86/include/asm/agp.h   | 2 +-
 arch/x86/include/asm/intel_pt.h  | 2 +-
 arch/x86/include/asm/set_memory.h| 2 +-
 arch/x86/kernel/amd_nb.c | 2 +-
 arch/x86/kernel/apm_32.c | 2 +-
 arch/x86/kernel/cpu/intel.c  | 2 +-
 arch/x86/kernel/cpu/mce/severity.c   | 2 +-
 arch/x86/kernel/cpu/mtrr/mtrr.c  | 2 +-
 arch/x86/kernel/cpu/resctrl/monitor.c| 4 ++--
 arch/x86/kernel/cpu/resctrl/rdtgroup.c   | 2 +-
 arch/x86/kernel/relocate_kernel_32.S | 2 +-
 arch/x86/kernel/relocate_kernel_64.S | 2 +-
 arch/x86/kernel/smp.c| 2 +-
 arch/x86/kernel/tsc_sync.c   | 2 +-
 arch/x86/kernel/umip.c   | 2 +-
 arch/x86/kvm/svm/avic.c  | 2 +-
 arch/x86/kvm/vmx/nested.c| 2 +-
 arch/x86/math-emu/reg_ld_str.c   | 2 +-
 arch/x86/math-emu/reg_round.S| 2 +-
 arch/x86/mm/fault.c  | 2 +-
 arch/x86/mm/init.c   | 2 +-
 arch/x86/mm/pkeys.c  | 2 +-
 arch/x86/platform/efi/quirks.c   | 2 +-
 arch/x86/platform/olpc/olpc-xo15-sci.c   | 2 +-
 arch/x86/platform/olpc/olpc_dt.c | 2 +-
 arch/x86/power/cpu.c | 2 +-
 arch/x86/realmode/init.c | 2 +-
 arch/x86/xen/mmu_pv.c| 2 +-
 41 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/arch/x86/boot/compressed/efi_thunk_64.S 
b/arch/x86/boot/compressed/efi_thunk_64.S
index c4bb0f9..95a223b 100644
--- a/arch/x86/boot/compressed/efi_thunk_64.S
+++ b/arch/x86/boot/compressed/efi_thunk_64.S
@@ -5,7 +5,7 @@
  * Early support for invoking 32-bit EFI services from a 64-bit kernel.
  *
  * Because this thunking occurs before ExitBootServices() we have to
- * restore the firmware's 32-bit GDT before we make EFI serivce calls,
+ * restore the firmware's 32-bit GDT before we make EFI service calls,
  * since the firmware's 32-bit IDT is still currently installed and it
  * needs to be able to service interrupts.
  *
diff --git a/arch/x86/boot/compressed/head_64.S 
b/arch/x86/boot/compressed/head_64.S
index e94874f..a8c4095 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -231,7 +231,7 @@ SYM_FUNC_START(startup_32)
/*
 * Setup for the jump to 64bit mode
 *
-* When the jump is performend we will be in long mode but
+* When the jump is performed we will be in long mode but
 * in 32bit compatibility mode with EFER.LME = 1, CS.L = 0, CS.D = 1
 * (and in turn EFER.LMA = 1).  To jump into 64bit mode we use
 * the new gdt/idt that has __KERNEL_CS with CS.L = 1.
diff --git a/arch/x86/crypto/crc32-pclmul_glue.c 
b/arch/x86/crypto/crc32-pclmul_glue.c
index 7c4c7b2..98cf3b4 100644
--- a/arch/x86/crypto/crc32-pclmul_glue.c
+++ b/arch/x86/crypto/crc32-pclmul_glue.c
@@ -24,7 +24,7 @@
 /*
  * Copyright 2012 Xyratex Technology Limited
  *
- * Wrappers for kernel crypto shash api to pclmulqdq crc32 imlementation.
+ * Wrappers for kernel crypto shash api to pclmulqdq crc32 implementation.
  */
 #include 
 #include 
diff --git a/arch/x86/crypto/twofish-x86_64-asm_64-3way.S 
b/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
index fc23552..bca4cea 100644
--- a/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
+++ b/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
@@ -88,7 +88,7 @@
 
 /*
  * Combined G1 & G2 function. Reordered with help of 

[tip: x86/cleanups] x86: Remove unusual Unicode characters from comments

2021-03-21 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: c681df88dcb12b1efd7e4efcfe498c5e9c31ce02
Gitweb:
https://git.kernel.org/tip/c681df88dcb12b1efd7e4efcfe498c5e9c31ce02
Author:Ingo Molnar 
AuthorDate:Sun, 21 Mar 2021 23:32:33 +01:00
Committer: Ingo Molnar 
CommitterDate: Sun, 21 Mar 2021 23:50:07 +01:00

x86: Remove unusual Unicode characters from comments

We've accumulated a few unusual Unicode characters in arch/x86/
over the years, substitute them with their proper ASCII equivalents.

A few of them were a whitespace equivalent: ' ' - the use was harmless.

Signed-off-by: Ingo Molnar 
Cc: Borislav Petkov 
Cc: Thomas Gleixner 
Cc: Peter Zijlstra 
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/events/intel/uncore_snbep.c | 12 ++--
 arch/x86/include/asm/elf.h   | 10 +-
 arch/x86/include/asm/nospec-branch.h |  2 +-
 arch/x86/platform/pvh/head.S |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c 
b/arch/x86/events/intel/uncore_snbep.c
index b79951d..3241581 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -280,17 +280,17 @@
  * | [63]  |00h| VALID - When set, indicates the CPU bus
  *   numbers have been initialized. (RO)
  * |[62:48]|---| Reserved
- * |[47:40]|00h| BUS_NUM_5 — Return the bus number BIOS assigned
+ * |[47:40]|00h| BUS_NUM_5 - Return the bus number BIOS assigned
  *   CPUBUSNO(5). (RO)
- * |[39:32]|00h| BUS_NUM_4 — Return the bus number BIOS assigned
+ * |[39:32]|00h| BUS_NUM_4 - Return the bus number BIOS assigned
  *   CPUBUSNO(4). (RO)
- * |[31:24]|00h| BUS_NUM_3 — Return the bus number BIOS assigned
+ * |[31:24]|00h| BUS_NUM_3 - Return the bus number BIOS assigned
  *   CPUBUSNO(3). (RO)
- * |[23:16]|00h| BUS_NUM_2 — Return the bus number BIOS assigned
+ * |[23:16]|00h| BUS_NUM_2 - Return the bus number BIOS assigned
  *   CPUBUSNO(2). (RO)
- * |[15:8] |00h| BUS_NUM_1 — Return the bus number BIOS assigned
+ * |[15:8] |00h| BUS_NUM_1 - Return the bus number BIOS assigned
  *   CPUBUSNO(1). (RO)
- * | [7:0] |00h| BUS_NUM_0 — Return the bus number BIOS assigned
+ * | [7:0] |00h| BUS_NUM_0 - Return the bus number BIOS assigned
  *   CPUBUSNO(0). (RO)
  */
 #define SKX_MSR_CPU_BUS_NUMBER 0x300
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 9224d40..7d75008 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -283,12 +283,12 @@ extern u32 elf_hwcap2;
  *
  * The decision process for determining the results are:
  *
- *             CPU: | lacks NX*  | has NX, ia32     | has NX, x86_64 |
- * ELF:             |            |                  |                |
+ * CPU: | lacks NX*  | has NX, ia32 | has NX, x86_64 |
+ * ELF: ||  ||
  * -||--||
- * missing PT_GNU_STACK | exec-all   | exec-all         | exec-none      |
- * PT_GNU_STACK == RWX  | exec-stack | exec-stack       | exec-stack     |
- * PT_GNU_STACK == RW   | exec-none  | exec-none        | exec-none      |
+ * missing PT_GNU_STACK | exec-all   | exec-all | exec-none  |
+ * PT_GNU_STACK == RWX  | exec-stack | exec-stack   | exec-stack |
+ * PT_GNU_STACK == RW   | exec-none  | exec-none| exec-none  |
  *
  *  exec-all  : all PROT_READ user mappings are executable, except when
  *  backed by files on a noexec-filesystem.
diff --git a/arch/x86/include/asm/nospec-branch.h 
b/arch/x86/include/asm/nospec-branch.h
index cb9ad6b..d83ea9e 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -33,7 +33,7 @@
 
 /*
  * Google experimented with loop-unrolling and this turned out to be
- * the optimal version — two calls, each with their own speculation
+ * the optimal version - two calls, each with their own speculation
  * trap should their return address end up getting used, in a loop.
  */
 #define __FILL_RETURN_BUFFER(reg, nr, sp)  \
diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S
index d2ccadc..66b3173 100644
--- a/arch/x86/platform/pvh/head.S
+++ b/arch/x86/platform/pvh/head.S
@@ -30,10 +30,10 @@
  *  the boot start info structure.
  * - `cr0`: bit 0 (PE) must be set. All the other writeable bits are cleared.
  * - `cr4`: all bits are cleared.
- * - `cs `: must be a 32-bit read/execute code segment with a base of ‘0’
- *  and a limit of ‘0x’. The selector value is unspecified.
+ * - `cs `: must be a 32-bit read/execute code segment with a base of `0`
+ * 

[tip: x86/cleanups] x86: Fix various typos in comments

2021-03-18 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: d9f6e12fb0b7fcded0bac34b8293ec46f80dfc33
Gitweb:
https://git.kernel.org/tip/d9f6e12fb0b7fcded0bac34b8293ec46f80dfc33
Author:Ingo Molnar 
AuthorDate:Thu, 18 Mar 2021 15:28:01 +01:00
Committer: Ingo Molnar 
CommitterDate: Thu, 18 Mar 2021 15:31:53 +01:00

x86: Fix various typos in comments

Fix ~144 single-word typos in arch/x86/ code comments.

Doing this in a single commit should reduce the churn.

Signed-off-by: Ingo Molnar 
Cc: Borislav Petkov 
Cc: Thomas Gleixner 
Cc: Peter Zijlstra 
Cc: Paolo Bonzini 
Cc: Bjorn Helgaas 
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/crypto/curve25519-x86_64.c   |  6 +++---
 arch/x86/crypto/twofish_glue_3way.c   |  2 +-
 arch/x86/events/amd/core.c|  2 +-
 arch/x86/events/amd/iommu.h   |  2 +-
 arch/x86/events/core.c|  2 +-
 arch/x86/events/intel/core.c  | 12 ++--
 arch/x86/events/intel/ds.c|  2 +-
 arch/x86/events/intel/lbr.c   |  2 +-
 arch/x86/events/intel/p4.c|  4 ++--
 arch/x86/events/intel/pt.c|  2 +-
 arch/x86/events/zhaoxin/core.c|  2 +-
 arch/x86/hyperv/hv_init.c |  4 ++--
 arch/x86/include/asm/cmpxchg.h|  2 +-
 arch/x86/include/asm/idtentry.h   |  2 +-
 arch/x86/include/asm/intel_pconfig.h  |  2 +-
 arch/x86/include/asm/io.h |  2 +-
 arch/x86/include/asm/irq_stack.h  |  2 +-
 arch/x86/include/asm/kvm_host.h   |  4 ++--
 arch/x86/include/asm/paravirt_types.h |  2 +-
 arch/x86/include/asm/pgtable.h|  2 +-
 arch/x86/include/asm/processor.h  |  2 +-
 arch/x86/include/asm/set_memory.h |  2 +-
 arch/x86/include/asm/uv/uv_geo.h  |  2 +-
 arch/x86/include/asm/uv/uv_hub.h  |  2 +-
 arch/x86/include/uapi/asm/bootparam.h |  4 ++--
 arch/x86/include/uapi/asm/msgbuf.h|  2 +-
 arch/x86/include/uapi/asm/sgx.h   |  2 +-
 arch/x86/include/uapi/asm/shmbuf.h|  2 +-
 arch/x86/include/uapi/asm/sigcontext.h|  2 +-
 arch/x86/kernel/acpi/boot.c   |  4 ++--
 arch/x86/kernel/acpi/sleep.c  |  2 +-
 arch/x86/kernel/apic/apic.c   | 10 +-
 arch/x86/kernel/apic/io_apic.c|  8 
 arch/x86/kernel/apic/vector.c |  4 ++--
 arch/x86/kernel/apm_32.c  |  6 +++---
 arch/x86/kernel/cpu/common.c  |  4 ++--
 arch/x86/kernel/cpu/cyrix.c   |  2 +-
 arch/x86/kernel/cpu/mce/core.c|  2 +-
 arch/x86/kernel/cpu/mshyperv.c|  4 ++--
 arch/x86/kernel/cpu/mtrr/cleanup.c|  2 +-
 arch/x86/kernel/cpu/resctrl/core.c|  2 +-
 arch/x86/kernel/cpu/resctrl/monitor.c |  2 +-
 arch/x86/kernel/cpu/resctrl/pseudo_lock.c |  4 ++--
 arch/x86/kernel/cpu/resctrl/rdtgroup.c|  4 ++--
 arch/x86/kernel/cpu/sgx/arch.h|  2 +-
 arch/x86/kernel/cpu/sgx/main.c|  4 ++--
 arch/x86/kernel/cpu/topology.c|  4 ++--
 arch/x86/kernel/e820.c|  2 +-
 arch/x86/kernel/fpu/xstate.c  |  2 +-
 arch/x86/kernel/head64.c  |  2 +-
 arch/x86/kernel/idt.c |  2 +-
 arch/x86/kernel/irq.c |  2 +-
 arch/x86/kernel/kgdb.c|  4 ++--
 arch/x86/kernel/kprobes/ftrace.c  |  2 +-
 arch/x86/kernel/machine_kexec_64.c|  2 +-
 arch/x86/kernel/process.c |  2 +-
 arch/x86/kernel/pvclock.c |  2 +-
 arch/x86/kernel/signal.c  |  2 +-
 arch/x86/kernel/smp.c |  2 +-
 arch/x86/kernel/smpboot.c |  2 +-
 arch/x86/kernel/sysfb_efi.c   |  2 +-
 arch/x86/kernel/topology.c|  2 +-
 arch/x86/kernel/traps.c   |  2 +-
 arch/x86/kernel/tsc.c |  6 +++---
 arch/x86/kvm/cpuid.c  |  2 +-
 arch/x86/kvm/emulate.c|  2 +-
 arch/x86/kvm/irq_comm.c   |  2 +-
 arch/x86/kvm/mmu/mmu.c|  2 +-
 arch/x86/kvm/mmu/mmu_internal.h   |  2 +-
 arch/x86/kvm/mmu/tdp_mmu.c|  6 +++---
 arch/x86/kvm/pmu.h|  2 +-
 arch/x86/kvm/svm/avic.c   |  2 +-
 arch/x86/kvm/svm/sev.c|  2 +-
 arch/x86/kvm/svm/svm.c|  2 +-
 arch/x86/kvm/vmx/posted_intr.c|  2 +-
 arch/x86/kvm/vmx/vmx.c|  6 +++---
 arch/x86/kvm/x86.c|  6 +++---
 arch/x86/lib/insn-eval.c  |  6 +++---
 arch/x86/lib/mmx_32.c |  2 +-
 arch/x86/mm/fault.c   |  2 +-
 arch/x86/mm/init.c|  4 ++--
 arch/x86/mm/init_64.c |  6 +++---
 arch/x86/mm/kaslr.c   |  2 +-
 

[tip: sched/core] sched: Fix various typos

2021-03-18 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the sched/core branch of tip:

Commit-ID: 7aacb8c62f621e9f6f1b5f11bb19eb37ddbf00e2
Gitweb:
https://git.kernel.org/tip/7aacb8c62f621e9f6f1b5f11bb19eb37ddbf00e2
Author:Ingo Molnar 
AuthorDate:Thu, 18 Mar 2021 13:38:50 +01:00
Committer: Ingo Molnar 
CommitterDate: Thu, 18 Mar 2021 13:46:27 +01:00

sched: Fix various typos

Fix ~34 single-word typos in scheduler code comments.

We have accumulated a few fun ones over the years. :-)

Signed-off-by: Ingo Molnar 
Cc: Peter Zijlstra 
Cc: Mike Galbraith 
Cc: Juri Lelli 
Cc: Vincent Guittot 
Cc: Dietmar Eggemann 
Cc: Steven Rostedt 
Cc: Ben Segall 
Cc: Mel Gorman 
Cc: linux-kernel@vger.kernel.org
---
 include/linux/sched.h|  2 +-
 kernel/sched/core.c  |  2 +-
 kernel/sched/cpuacct.c   |  2 +-
 kernel/sched/cpufreq_schedutil.c |  2 +-
 kernel/sched/cpupri.c|  4 ++--
 kernel/sched/deadline.c  | 12 ++--
 kernel/sched/debug.c |  2 +-
 kernel/sched/fair.c  | 14 +++---
 kernel/sched/features.h  |  2 +-
 kernel/sched/idle.c  |  4 ++--
 kernel/sched/loadavg.c   |  2 +-
 kernel/sched/pelt.c  |  2 +-
 kernel/sched/pelt.h  |  2 +-
 kernel/sched/psi.c   |  6 +++---
 kernel/sched/rt.c|  2 +-
 kernel/sched/sched.h |  6 +++---
 kernel/sched/stats.c |  2 +-
 17 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index cf245bc..05572e2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1097,7 +1097,7 @@ struct task_struct {
 #ifdef CONFIG_CPUSETS
/* Protected by ->alloc_lock: */
nodemask_t  mems_allowed;
-   /* Seqence number to catch updates: */
+   /* Sequence number to catch updates: */
seqcount_spinlock_t mems_allowed_seq;
int cpuset_mem_spread_rotor;
int cpuset_slab_spread_rotor;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 28c4df6..3384ea7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8975,7 +8975,7 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, 
u64 period, u64 quota)
return -EINVAL;
 
/*
-* Likewise, bound things on the otherside by preventing insane quota
+* Likewise, bound things on the other side by preventing insane quota
 * periods.  This also allows us to normalize in computing quota
 * feasibility.
 */
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 941c28c..104a1ba 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -104,7 +104,7 @@ static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int 
cpu,
 
/*
 * We allow index == CPUACCT_STAT_NSTATS here to read
-* the sum of suages.
+* the sum of usages.
 */
BUG_ON(index > CPUACCT_STAT_NSTATS);
 
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 50cbad8..7cc2e11 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -471,7 +471,7 @@ static void sugov_work(struct kthread_work *work)
 
/*
 * Hold sg_policy->update_lock shortly to handle the case where:
-* incase sg_policy->next_freq is read here, and then updated by
+* in case sg_policy->next_freq is read here, and then updated by
 * sugov_deferred_update() just before work_in_progress is set to false
 * here, we may miss queueing the new update.
 *
diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index ec9be78..d583f2a 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -77,7 +77,7 @@ static inline int __cpupri_find(struct cpupri *cp, struct 
task_struct *p,
 * When looking at the vector, we need to read the counter,
 * do a memory barrier, then read the mask.
 *
-* Note: This is still all racey, but we can deal with it.
+* Note: This is still all racy, but we can deal with it.
 *  Ideally, we only want to look at masks that are set.
 *
 *  If a mask is not set, then the only thing wrong is that we
@@ -186,7 +186,7 @@ int cpupri_find_fitness(struct cpupri *cp, struct 
task_struct *p,
 * The cost of this trade-off is not entirely clear and will probably
 * be good for some workloads and bad for others.
 *
-* The main idea here is that if some CPUs were overcommitted, we try
+* The main idea here is that if some CPUs were over-committed, we try
 * to spread which is what the scheduler traditionally did. Sys admins
 * must do proper RT planning to avoid overloading the system if they
 * really care.
diff --git a/kernel/sched/deadline.c 

[tip: x86/mm] smp: Micro-optimize smp_call_function_many_cond()

2021-03-02 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/mm branch of tip:

Commit-ID: dd75cba56151cb3b9dc7eac0221c9b1967f6ddb5
Gitweb:
https://git.kernel.org/tip/dd75cba56151cb3b9dc7eac0221c9b1967f6ddb5
Author:Ingo Molnar 
AuthorDate:Tue, 02 Mar 2021 08:02:43 +01:00
Committer: Ingo Molnar 
CommitterDate: Tue, 02 Mar 2021 09:09:59 +01:00

smp: Micro-optimize smp_call_function_many_cond()

Call the generic send_call_function_single_ipi() function, which
will avoid the IPI when @last_cpu is idle.

Signed-off-by: Peter Zijlstra 
Signed-off-by: Ingo Molnar 
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar 
---
 kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index b6375d7..af0d51d 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -694,7 +694,7 @@ static void smp_call_function_many_cond(const struct 
cpumask *mask,
 * provided mask.
 */
if (nr_cpus == 1)
-   arch_send_call_function_single_ipi(last_cpu);
+   send_call_function_single_ipi(last_cpu);
else if (likely(nr_cpus > 1))
arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
}


[tip: timers/core] ntp: Fix prototype in the !CONFIG_GENERIC_CMOS_UPDATE case

2020-12-13 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the timers/core branch of tip:

Commit-ID: 3cabca87b329cbcbdf295be0094adbd72c7b1f67
Gitweb:
https://git.kernel.org/tip/3cabca87b329cbcbdf295be0094adbd72c7b1f67
Author:Ingo Molnar 
AuthorDate:Sat, 12 Dec 2020 18:29:20 +01:00
Committer: Ingo Molnar 
CommitterDate: Sun, 13 Dec 2020 10:16:31 +01:00

ntp: Fix prototype in the !CONFIG_GENERIC_CMOS_UPDATE case

In the !CONFIG_GENERIC_CMOS_UPDATE case the update_persistent_clock64() function
gets defined as a stub in ntp.c - make the prototype in 
conditional on CONFIG_GENERIC_CMOS_UPDATE as well.

Fixes: 76e87d96b30b5 ("ntp: Consolidate the RTC update implementation")
Signed-off-by: Ingo Molnar 
Acked-by: Thomas Gleixner 
---
 include/linux/timekeeping.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 7f7e4a3..929d3f3 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -303,6 +303,8 @@ extern int persistent_clock_is_local;
 extern void read_persistent_clock64(struct timespec64 *ts);
 void read_persistent_wall_and_boot_offset(struct timespec64 *wall_clock,
  struct timespec64 *boot_offset);
+#ifdef CONFIG_GENERIC_CMOS_UPDATE
 extern int update_persistent_clock64(struct timespec64 now);
+#endif
 
 #endif


[tip: timers/core] ntp: Fix build error

2020-12-12 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the timers/core branch of tip:

Commit-ID: a3356a079da268cd35460d9bfe052c74383e179b
Gitweb:
https://git.kernel.org/tip/a3356a079da268cd35460d9bfe052c74383e179b
Author:Ingo Molnar 
AuthorDate:Sat, 12 Dec 2020 18:29:20 +01:00
Committer: Ingo Molnar 
CommitterDate: Sat, 12 Dec 2020 18:35:12 +01:00

ntp: Fix build error

Signed-off-by: Ingo Molnar 
---
 include/linux/timekeeping.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 7f7e4a3..929d3f3 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -303,6 +303,8 @@ extern int persistent_clock_is_local;
 extern void read_persistent_clock64(struct timespec64 *ts);
 void read_persistent_wall_and_boot_offset(struct timespec64 *wall_clock,
  struct timespec64 *boot_offset);
+#ifdef CONFIG_GENERIC_CMOS_UPDATE
 extern int update_persistent_clock64(struct timespec64 now);
+#endif
 
 #endif


[tip: perf/kprobes] locking/atomics: Regenerate the atomics-check SHA1's

2020-11-07 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the perf/kprobes branch of tip:

Commit-ID: a70a04b3844f59c29573a8581d5c263225060dd6
Gitweb:
https://git.kernel.org/tip/a70a04b3844f59c29573a8581d5c263225060dd6
Author:Ingo Molnar 
AuthorDate:Sat, 07 Nov 2020 12:54:49 +01:00
Committer: Ingo Molnar 
CommitterDate: Sat, 07 Nov 2020 13:20:41 +01:00

locking/atomics: Regenerate the atomics-check SHA1's

The include/asm-generic/atomic-instrumented.h checksum got out
of sync, so regenerate it. (No change to actual code.)

Also make scripts/atomic/gen-atomics.sh executable, to make
it easier to use.

The auto-generated atomic header signatures are now fine:

  thule:~/tip> scripts/atomic/check-atomics.sh
  thule:~/tip>

Signed-off-by: Ingo Molnar 
Cc: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra 
Cc: Linus Torvalds 
Cc: Andrew Morton 
Cc: Thomas Gleixner 
Cc: Paul E. McKenney 
Cc: Will Deacon 
Signed-off-by: Ingo Molnar 
---
 include/asm-generic/atomic-instrumented.h | 2 +-
 scripts/atomic/gen-atomics.sh | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 mode change 100644 => 100755 scripts/atomic/gen-atomics.sh

diff --git a/include/asm-generic/atomic-instrumented.h 
b/include/asm-generic/atomic-instrumented.h
index 492cc95..888b6cf 100644
--- a/include/asm-generic/atomic-instrumented.h
+++ b/include/asm-generic/atomic-instrumented.h
@@ -1830,4 +1830,4 @@ atomic64_dec_if_positive(atomic64_t *v)
 })
 
 #endif /* _ASM_GENERIC_ATOMIC_INSTRUMENTED_H */
-// 9d5e6a315fb1335d02f0ccd3655a91c3dafcc63e
+// 4bec382e44520f4d8267e42620054db26a659ea3
diff --git a/scripts/atomic/gen-atomics.sh b/scripts/atomic/gen-atomics.sh
old mode 100644
new mode 100755


[tip: x86/build] x86/build: Declutter the build output

2020-08-20 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/build branch of tip:

Commit-ID: 642d94cf336fe57675e63a91d11f53d74b9a3f9f
Gitweb:
https://git.kernel.org/tip/642d94cf336fe57675e63a91d11f53d74b9a3f9f
Author:Ingo Molnar 
AuthorDate:Thu, 20 Aug 2020 08:17:40 +02:00
Committer: Ingo Molnar 
CommitterDate: Thu, 20 Aug 2020 08:17:40 +02:00

x86/build: Declutter the build output

We have some really ancient debug printouts in the x86 boot image build code:

  Setup is 14108 bytes (padded to 14336 bytes).
  System is 8802 kB
  CRC 27e909d4

None of these ever helped debug any sort of breakage that I know of, and they
clutter the build output.

Remove them - if anyone needs the see the various interim stages of this to
debug an obscure bug, they can add these printfs and more.

We still keep this one:

  Kernel: arch/x86/boot/bzImage is ready  (#19)

As a sentimental leftover, plus the '#19' build count tag is mildly useful.

Signed-off-by: Ingo Molnar 
Cc: linux-kernel@vger.kernel.org
Cc: x...@kernel.org
---
 arch/x86/boot/tools/build.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index c8b8c1a..a3725ad 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -416,8 +416,6 @@ int main(int argc, char ** argv)
/* Set the default root device */
put_unaligned_le16(DEFAULT_ROOT_DEV, [508]);
 
-   printf("Setup is %d bytes (padded to %d bytes).\n", c, i);
-
/* Open and stat the kernel file */
fd = open(argv[2], O_RDONLY);
if (fd < 0)
@@ -425,7 +423,6 @@ int main(int argc, char ** argv)
if (fstat(fd, ))
die("Unable to stat `%s': %m", argv[2]);
sz = sb.st_size;
-   printf("System is %d kB\n", (sz+1023)/1024);
kernel = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0);
if (kernel == MAP_FAILED)
die("Unable to mmap '%s': %m", argv[2]);
@@ -488,7 +485,6 @@ int main(int argc, char ** argv)
}
 
/* Write the CRC */
-   printf("CRC %x\n", crc);
put_unaligned_le32(crc, buf);
if (fwrite(buf, 1, 4, dest) != 4)
die("Writing CRC failed");


[tip: x86/cpu] x86/cpu: Fix typos and improve the comments in sync_core()

2020-08-19 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/cpu branch of tip:

Commit-ID: 40eb0cb4939e462acfedea8c8064571e886b9773
Gitweb:
https://git.kernel.org/tip/40eb0cb4939e462acfedea8c8064571e886b9773
Author:Ingo Molnar 
AuthorDate:Tue, 18 Aug 2020 07:31:30 +02:00
Committer: Ingo Molnar 
CommitterDate: Wed, 19 Aug 2020 09:56:36 +02:00

x86/cpu: Fix typos and improve the comments in sync_core()

- Fix typos.

- Move the compiler barrier comment to the top, because it's valid for the
  whole function, not just the legacy branch.

Signed-off-by: Ingo Molnar 
Link: https://lore.kernel.org/r/20200818053130.ga3161...@gmail.com
Reviewed-by: Ricardo Neri 
---
 arch/x86/include/asm/sync_core.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/sync_core.h b/arch/x86/include/asm/sync_core.h
index 4631c0f..0fd4a9d 100644
--- a/arch/x86/include/asm/sync_core.h
+++ b/arch/x86/include/asm/sync_core.h
@@ -47,16 +47,19 @@ static inline void iret_to_self(void)
  *
  *  b) Text was modified on a different CPU, may subsequently be
  * executed on this CPU, and you want to make sure the new version
- * gets executed.  This generally means you're calling this in a IPI.
+ * gets executed.  This generally means you're calling this in an IPI.
  *
  * If you're calling this for a different reason, you're probably doing
  * it wrong.
+ *
+ * Like all of Linux's memory ordering operations, this is a
+ * compiler barrier as well.
  */
 static inline void sync_core(void)
 {
/*
 * The SERIALIZE instruction is the most straightforward way to
-* do this but it not universally available.
+* do this, but it is not universally available.
 */
if (static_cpu_has(X86_FEATURE_SERIALIZE)) {
serialize();
@@ -67,10 +70,10 @@ static inline void sync_core(void)
 * For all other processors, there are quite a few ways to do this.
 * IRET-to-self is nice because it works on every CPU, at any CPL
 * (so it's compatible with paravirtualization), and it never exits
-* to a hypervisor. The only down sides are that it's a bit slow
+* to a hypervisor.  The only downsides are that it's a bit slow
 * (it seems to be a bit more than 2x slower than the fastest
-* options) and that it unmasks NMIs.  The "push %cs" is needed
-* because, in paravirtual environments, __KERNEL_CS may not be a
+* options) and that it unmasks NMIs.  The "push %cs" is needed,
+* because in paravirtual environments __KERNEL_CS may not be a
 * valid CS value when we do IRET directly.
 *
 * In case NMI unmasking or performance ever becomes a problem,
@@ -81,9 +84,6 @@ static inline void sync_core(void)
 * CPUID is the conventional way, but it's nasty: it doesn't
 * exist on some 486-like CPUs, and it usually exits to a
 * hypervisor.
-*
-* Like all of Linux's memory ordering operations, this is a
-* compiler barrier as well.
 */
iret_to_self();
 }


[tip: locking/urgent] x86/headers: Remove APIC headers from

2020-08-06 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the locking/urgent branch of tip:

Commit-ID: 13c01139b17163c9b2aa543a9c39f8bbc875b625
Gitweb:
https://git.kernel.org/tip/13c01139b17163c9b2aa543a9c39f8bbc875b625
Author:Ingo Molnar 
AuthorDate:Thu, 06 Aug 2020 14:34:32 +02:00
Committer: Ingo Molnar 
CommitterDate: Thu, 06 Aug 2020 16:13:09 +02:00

x86/headers: Remove APIC headers from 

The APIC headers are relatively complex and bring in additional
header dependencies - while smp.h is a relatively simple header
included from high level headers.

Remove the dependency and add in the missing #include's in .c
files where they gained it indirectly before.

Signed-off-by: Ingo Molnar 
---
 arch/x86/include/asm/smp.h  | 10 --
 arch/x86/include/asm/tsc.h  |  1 +
 arch/x86/kernel/apic/apic.c |  1 +
 arch/x86/kernel/apic/bigsmp_32.c|  1 +
 arch/x86/kernel/apic/ipi.c  |  1 +
 arch/x86/kernel/apic/local.h|  1 +
 arch/x86/kernel/apic/probe_32.c |  1 +
 arch/x86/kernel/devicetree.c|  1 +
 arch/x86/kernel/irqinit.c   |  2 ++
 arch/x86/kernel/jailhouse.c |  1 +
 arch/x86/kernel/mpparse.c   |  2 ++
 arch/x86/kernel/setup.c |  1 +
 arch/x86/kernel/topology.c  |  1 +
 arch/x86/xen/apic.c |  1 +
 arch/x86/xen/enlighten_hvm.c|  1 +
 arch/x86/xen/smp_pv.c   |  1 +
 drivers/iommu/intel/irq_remapping.c |  1 +
 17 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index e15f364..c0538f8 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -5,16 +5,6 @@
 #include 
 #include 
 
-/*
- * We need the APIC definitions automatically as part of 'smp.h'
- */
-#ifdef CONFIG_X86_LOCAL_APIC
-# include 
-# include 
-# ifdef CONFIG_X86_IO_APIC
-#  include 
-# endif
-#endif
 #include 
 #include 
 
diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index 8a0c25c..db59771 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -6,6 +6,7 @@
 #define _ASM_X86_TSC_H
 
 #include 
+#include 
 
 #define NS_SCALE   10 /* 2^10, carefully chosen */
 #define US_SCALE   32 /* 2^32, arbitralrily chosen */
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index e0e2f02..0c89003 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index 38b5b51..98d015a 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -9,6 +9,7 @@
 #include 
 
 #include 
+#include 
 
 #include "local.h"
 
diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index 6ca0f91..387154e 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -2,6 +2,7 @@
 
 #include 
 #include 
+#include 
 
 #include "local.h"
 
diff --git a/arch/x86/kernel/apic/local.h b/arch/x86/kernel/apic/local.h
index 04797f0..a997d84 100644
--- a/arch/x86/kernel/apic/local.h
+++ b/arch/x86/kernel/apic/local.h
@@ -10,6 +10,7 @@
 
 #include 
 
+#include 
 #include 
 
 /* APIC flat 64 */
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index 67b33d6..7bda71d 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 8d85e00..a0e8fc7 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index dd73135..beb1bad 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -22,6 +22,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c
index 6eb8b50..2caf5b9 100644
--- a/arch/x86/kernel/jailhouse.c
+++ b/arch/x86/kernel/jailhouse.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index afac7cc..db509e1 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -19,6 +19,8 @@
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index a3767e7..f767198 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -25,6 +25,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index b8810eb..0a2ec80 100644
--- a/arch/x86/kernel/topology.c

[tip: x86/urgent] Revert "x86/mm/64: Do not sync vmalloc/ioremap mappings"

2020-08-06 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: f17506e2f14bfa8a6a2de9b8b6a3ccc6b6f7c9b6
Gitweb:
https://git.kernel.org/tip/f17506e2f14bfa8a6a2de9b8b6a3ccc6b6f7c9b6
Author:Ingo Molnar 
AuthorDate:Thu, 06 Aug 2020 15:11:03 +02:00
Committer: Ingo Molnar 
CommitterDate: Thu, 06 Aug 2020 15:11:03 +02:00

Revert "x86/mm/64: Do not sync vmalloc/ioremap mappings"

This reverts commit 8bb9bf242d1fee925636353807c511d54fde8986.

Jason reported that this causes a new oops in process_one_work(),
and bisected it to this commit.

Linus suspects that it was caused by missing pagetable synchronization:

> > BUG: unable to handle page fault for address: e8d00608
> > #PF: supervisor read access in kernel mode
> > #PF: error_code(0x) - not-present page
> > PGD 0 P4D 0
>
> Yeah, missing page table because it wasn't copied.
>
> Presumably because that kthread is using the active_mm of some random
> user space process that didn't get sync'ed.
>
> And the sync_global_pgds() may have ended up being sufficient
> synchronization with whoever allocated thigns, even if it wasn't about
> the TLB contents themselves.
>
> So apparently the "the page-table pages are all pre-allocated now" is
> simply not true.

Revert the commit for now.

Reported-by: "Jason A. Donenfeld" 
Analyzed-by: Linus Torvalds 
Cc: Joerg Roedel 
Signed-off-by: Ingo Molnar 
---
 arch/x86/include/asm/pgtable_64_types.h | 2 ++
 arch/x86/mm/init_64.c   | 5 +
 2 files changed, 7 insertions(+)

diff --git a/arch/x86/include/asm/pgtable_64_types.h 
b/arch/x86/include/asm/pgtable_64_types.h
index 52e5f5f..8f63efb 100644
--- a/arch/x86/include/asm/pgtable_64_types.h
+++ b/arch/x86/include/asm/pgtable_64_types.h
@@ -159,4 +159,6 @@ extern unsigned int ptrs_per_p4d;
 
 #define PGD_KERNEL_START   ((PAGE_SIZE / 2) / sizeof(pgd_t))
 
+#define ARCH_PAGE_TABLE_SYNC_MASK  (pgtable_l5_enabled() ? 
PGTBL_PGD_MODIFIED : PGTBL_P4D_MODIFIED)
+
 #endif /* _ASM_X86_PGTABLE_64_DEFS_H */
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index e65b96f..3f4e29a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -217,6 +217,11 @@ static void sync_global_pgds(unsigned long start, unsigned 
long end)
sync_global_pgds_l4(start, end);
 }
 
+void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
+{
+   sync_global_pgds(start, end);
+}
+
 /*
  * NOTE: This function is marked __ref because it calls __init function
  * (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0.


[tip: core/entry] entry: Correct 'noinstr' attributes

2020-07-26 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the core/entry branch of tip:

Commit-ID: aadfc2f957cb470a5a7e52cc41a2fa86e784bcd2
Gitweb:
https://git.kernel.org/tip/aadfc2f957cb470a5a7e52cc41a2fa86e784bcd2
Author:Ingo Molnar 
AuthorDate:Sat, 25 Jul 2020 11:19:51 +02:00
Committer: Thomas Gleixner 
CommitterDate: Sun, 26 Jul 2020 15:42:20 +02:00

entry: Correct 'noinstr' attributes

The noinstr attribute is to be specified before the return type in the
same way 'inline' is used.

Similar cases were recently fixed for x86 in commit 7f6fa101dfac ("x86:
Correct noinstr qualifiers"), but the generic entry code was based on the
the original version and did not carry the fix over.

Fixes: a5497bab5f72 ("entry: Provide generic interrupt entry/exit code")
Signed-off-by: Ingo Molnar 
Signed-off-by: Thomas Gleixner 
Link: https://lkml.kernel.org/r/20200725091951.744848-3-mi...@kernel.org
---
 kernel/entry/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 495f5c0..9852e0d 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -256,7 +256,7 @@ noinstr void irqentry_exit_to_user_mode(struct pt_regs 
*regs)
exit_to_user_mode();
 }
 
-irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs)
+noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs)
 {
irqentry_state_t ret = {
.exit_rcu = false,
@@ -333,7 +333,7 @@ void irqentry_exit_cond_resched(void)
}
 }
 
-void noinstr irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
+noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
 {
lockdep_assert_irqs_disabled();
 


[tip: x86/cleanups] x86/ioapic: Remove unused "IOAPIC_AUTO" define

2020-07-25 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 8cd591aeb1d650f79a49d8704c35a78bf18f5de9
Gitweb:
https://git.kernel.org/tip/8cd591aeb1d650f79a49d8704c35a78bf18f5de9
Author:Ingo Molnar 
AuthorDate:Fri, 24 Jul 2020 13:44:16 +02:00
Committer: Ingo Molnar 
CommitterDate: Sat, 25 Jul 2020 12:00:56 +02:00

x86/ioapic: Remove unused "IOAPIC_AUTO" define

Last use was removed more than 5 years ago, in:

   5ad274d41c1b: ("x86/irq: Remove unused old IOAPIC irqdomain interfaces")

Signed-off-by: Ingo Molnar 
Link: https://lore.kernel.org/r/20200724114418.629021-2-mi...@kernel.org
---
 arch/x86/include/asm/io_apic.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index fd20a23..a1a26f6 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -99,7 +99,6 @@ struct IR_IO_APIC_route_entry {
 struct irq_alloc_info;
 struct ioapic_domain_cfg;
 
-#define IOAPIC_AUTO-1
 #define IOAPIC_EDGE0
 #define IOAPIC_LEVEL   1
 


[tip: x86/cleanups] x86/mm: Remove the unused mk_kernel_pgd() #define

2020-07-25 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 4b8e0328e56e177663645a96ea4c5c0401ecd78f
Gitweb:
https://git.kernel.org/tip/4b8e0328e56e177663645a96ea4c5c0401ecd78f
Author:Ingo Molnar 
AuthorDate:Fri, 24 Jul 2020 13:44:18 +02:00
Committer: Ingo Molnar 
CommitterDate: Sat, 25 Jul 2020 12:00:57 +02:00

x86/mm: Remove the unused mk_kernel_pgd() #define

AFAICS the last uses of directly 'making' kernel PGDs was removed 7 years ago:

  8b78c21d72d9: ("x86, 64bit, mm: hibernate use generic mapping_init")

Where the explicit PGD walking loop was replaced with 
kernel_ident_mapping_init()
calls. This was then (unnecessarily) carried over through the 5-level paging 
conversion.

Also clean up the 'level' comments a bit, to convey the original, meanwhile 
somewhat
bit-rotten notion, that these are empty comment blocks with no methods to 
handle any
of the levels except the PTE level.

Signed-off-by: Ingo Molnar 
Link: https://lore.kernel.org/r/20200724114418.629021-4-mi...@kernel.org
---
 arch/x86/include/asm/pgtable_64.h | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/pgtable_64.h 
b/arch/x86/include/asm/pgtable_64.h
index 1b68d24..d2af8c4 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -175,16 +175,13 @@ extern void sync_global_pgds(unsigned long start, 
unsigned long end);
  * and a page entry and page directory to the page they refer to.
  */
 
-/*
- * Level 4 access.
- */
-#define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
+/* PGD - Level 4 access */
 
-/* PUD - Level3 access */
+/* PUD - Level 3 access */
 
-/* PMD  - Level 2 access */
+/* PMD - Level 2 access */
 
-/* PTE - Level 1 access. */
+/* PTE - Level 1 access */
 
 /*
  * Encode and de-code a swap entry


[tip: x86/build] x86/defconfigs: Refresh defconfig files

2020-07-25 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/build branch of tip:

Commit-ID: 1d0e12fd3a848199f973d42677cde423b76cafaf
Gitweb:
https://git.kernel.org/tip/1d0e12fd3a848199f973d42677cde423b76cafaf
Author:Ingo Molnar 
AuthorDate:Fri, 24 Jul 2020 15:06:38 +02:00
Committer: Ingo Molnar 
CommitterDate: Sat, 25 Jul 2020 12:02:14 +02:00

x86/defconfigs: Refresh defconfig files

Perform a 'make savedefconfig' pass over our main defconfig files,
which keeps the defconfig result the same, but compresses
the file where defaults were changed, options removed or
reordered.

Signed-off-by: Ingo Molnar 
Link: https://lore.kernel.org/r/20200724130638.645844-2-mi...@kernel.org
---
 arch/x86/configs/i386_defconfig   | 91 +
 arch/x86/configs/x86_64_defconfig | 93 ++
 2 files changed, 62 insertions(+), 122 deletions(-)

diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 3a2a898..d7577fe 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -1,39 +1,29 @@
-# CONFIG_64BIT is not set
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
+CONFIG_AUDIT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_TASKSTATS=y
 CONFIG_TASK_DELAY_ACCT=y
 CONFIG_TASK_XACCT=y
 CONFIG_TASK_IO_ACCOUNTING=y
-CONFIG_FHANDLE=y
-CONFIG_AUDIT=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
 CONFIG_LOG_BUF_SHIFT=18
 CONFIG_CGROUPS=y
+CONFIG_CGROUP_SCHED=y
 CONFIG_CGROUP_FREEZER=y
 CONFIG_CPUSETS=y
 CONFIG_CGROUP_CPUACCT=y
-CONFIG_CGROUP_SCHED=y
 CONFIG_BLK_DEV_INITRD=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_PROFILING=y
-CONFIG_KPROBES=y
-CONFIG_JUMP_LABEL=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
 CONFIG_SMP=y
 CONFIG_X86_GENERIC=y
 CONFIG_HPET_TIMER=y
-CONFIG_SCHED_SMT=y
-CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
-CONFIG_X86_MCE=y
 CONFIG_X86_REBOOTFIXUPS=y
-CONFIG_MICROCODE=y
 CONFIG_MICROCODE_AMD=y
 CONFIG_X86_MSR=y
 CONFIG_X86_CPUID=y
@@ -41,28 +31,25 @@ CONFIG_HIGHPTE=y
 CONFIG_X86_CHECK_BIOS_CORRUPTION=y
 # CONFIG_MTRR_SANITIZER is not set
 CONFIG_EFI=y
+CONFIG_EFI_STUB=y
 CONFIG_HZ_1000=y
 CONFIG_KEXEC=y
 CONFIG_CRASH_DUMP=y
-CONFIG_RANDOMIZE_BASE=y
-CONFIG_RANDOMIZE_MEMORY=y
-# CONFIG_COMPAT_VDSO is not set
 CONFIG_HIBERNATION=y
 CONFIG_PM_DEBUG=y
 CONFIG_PM_TRACE_RTC=y
 CONFIG_ACPI_DOCK=y
-CONFIG_CPU_FREQ=y
-# CONFIG_CPU_FREQ_STAT is not set
+CONFIG_ACPI_BGRT=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
-CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
 CONFIG_CPU_FREQ_GOV_ONDEMAND=y
 CONFIG_X86_ACPI_CPUFREQ=y
-CONFIG_PCI=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_PCI_MSI=y
-CONFIG_PCCARD=y
-CONFIG_YENTA=y
-CONFIG_HOTPLUG_PCI=y
+CONFIG_EFI_VARS=y
+CONFIG_KPROBES=y
+CONFIG_JUMP_LABEL=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+# CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_BINFMT_MISC=y
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -82,16 +69,12 @@ CONFIG_IP_MROUTE=y
 CONFIG_IP_PIMSM_V1=y
 CONFIG_IP_PIMSM_V2=y
 CONFIG_SYN_COOKIES=y
-# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_INET_DIAG is not set
 CONFIG_TCP_CONG_ADVANCED=y
 # CONFIG_TCP_CONG_BIC is not set
 # CONFIG_TCP_CONG_WESTWOOD is not set
 # CONFIG_TCP_CONG_HTCP is not set
 CONFIG_TCP_MD5SIG=y
-CONFIG_IPV6=y
 CONFIG_INET6_AH=y
 CONFIG_INET6_ESP=y
 CONFIG_NETLABEL=y
@@ -102,6 +85,7 @@ CONFIG_NF_CONNTRACK_FTP=y
 CONFIG_NF_CONNTRACK_IRC=y
 CONFIG_NF_CONNTRACK_SIP=y
 CONFIG_NF_CT_NETLINK=y
+CONFIG_NF_NAT=y
 CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
 CONFIG_NETFILTER_XT_TARGET_NFLOG=y
 CONFIG_NETFILTER_XT_TARGET_SECMARK=y
@@ -109,14 +93,11 @@ CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
 CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
 CONFIG_NETFILTER_XT_MATCH_POLICY=y
 CONFIG_NETFILTER_XT_MATCH_STATE=y
-CONFIG_NF_CONNTRACK_IPV4=y
 CONFIG_IP_NF_IPTABLES=y
 CONFIG_IP_NF_FILTER=y
 CONFIG_IP_NF_TARGET_REJECT=y
-CONFIG_NF_NAT=y
-CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_TARGET_MASQUERADE=m
 CONFIG_IP_NF_MANGLE=y
-CONFIG_NF_CONNTRACK_IPV6=y
 CONFIG_IP6_NF_IPTABLES=y
 CONFIG_IP6_NF_MATCH_IPV6HEADER=y
 CONFIG_IP6_NF_FILTER=y
@@ -129,6 +110,12 @@ CONFIG_CFG80211=y
 CONFIG_MAC80211=y
 CONFIG_MAC80211_LEDS=y
 CONFIG_RFKILL=y
+CONFIG_PCI=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCI_MSI=y
+CONFIG_HOTPLUG_PCI=y
+CONFIG_PCCARD=y
+CONFIG_YENTA=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_DEBUG_DEVRES=y
@@ -170,15 +157,12 @@ CONFIG_8139TOO=y
 # CONFIG_8139TOO_PIO is not set
 CONFIG_R8169=y
 CONFIG_INPUT_POLLDEV=y
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_EVDEV=y
 CONFIG_INPUT_JOYSTICK=y
 CONFIG_INPUT_TABLET=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_INPUT_MISC=y
-CONFIG_VT_HW_CONSOLE_BINDING=y
 # CONFIG_LEGACY_PTYS is not set
-CONFIG_SERIAL_NONSTANDARD=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=32
@@ -187,6 

[tip: x86/cleanups] x86/tsc: Remove unused "US_SCALE" and "NS_SCALE" leftover macros

2020-07-25 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 161449bad5053d66f2310744ba8498158ab12c89
Gitweb:
https://git.kernel.org/tip/161449bad5053d66f2310744ba8498158ab12c89
Author:Ingo Molnar 
AuthorDate:Fri, 24 Jul 2020 13:44:17 +02:00
Committer: Ingo Molnar 
CommitterDate: Sat, 25 Jul 2020 12:00:57 +02:00

x86/tsc: Remove unused "US_SCALE" and "NS_SCALE" leftover macros

Last use of them was removed 13 years ago, when the code was converted
to use CYC2NS_SCALE_FACTOR:

  53d517cdbaac: ("x86: scale cyc_2_nsec according to CPU frequency")

The current TSC code uses the 'struct cyc2ns_data' scaling abstraction,
the old fixed scaling approach is long gone.

This cleanup also removes the 'arbitralrily' typo from the comment,
so win-win. ;-)

Signed-off-by: Ingo Molnar 
Link: https://lore.kernel.org/r/20200724114418.629021-3-mi...@kernel.org
---
 arch/x86/include/asm/tsc.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index 8a0c25c..b7b2624 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -7,9 +7,6 @@
 
 #include 
 
-#define NS_SCALE   10 /* 2^10, carefully chosen */
-#define US_SCALE   32 /* 2^32, arbitralrily chosen */
-
 /*
  * Standard way to access the cycle counter.
  */


[tip: core/headers] compiler.h: Move instrumentation_begin()/end() to new header

2020-07-24 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the core/headers branch of tip:

Commit-ID: d19e789f068b3d633cbac430764962f404198022
Gitweb:
https://git.kernel.org/tip/d19e789f068b3d633cbac430764962f404198022
Author:Ingo Molnar 
AuthorDate:Fri, 24 Jul 2020 13:50:25 +02:00
Committer: Ingo Molnar 
CommitterDate: Fri, 24 Jul 2020 13:56:23 +02:00

compiler.h: Move instrumentation_begin()/end() to new  
header

Linus pointed out that compiler.h - which is a key header that gets included in 
every
single one of the 28,000+ kernel files during a kernel build - was bloated in:

  65538943: ("vmlinux.lds.h: Create section for protection against 
instrumentation")

Linus noted:

 > I have pulled this, but do we really want to add this to a header file
 > that is _so_ core that it gets included for basically every single
 > file built?
 >
 > I don't even see those instrumentation_begin/end() things used
 > anywhere right now.
 >
 > It seems excessive. That 53 lines is maybe not a lot, but it pushed
 > that header file to over 12kB, and while it's mostly comments, it's
 > extra IO and parsing basically for _every_ single file compiled in the
 > kernel.
 >
 > For what appears to be absolutely zero upside right now, and I really
 > don't see why this should be in such a core header file!

Move these primitives into a new header: , and include 
that
header in the headers that make use of it.

Unfortunately one of these headers is asm-generic/bug.h, which does get included
in a lot of places, similarly to compiler.h. So the de-bloating effect isn't as
good as we'd like it to be - but at least the interfaces are defined separately.

No change to functionality intended.

Reported-by: Linus Torvalds 
Signed-off-by: Ingo Molnar 
Link: https://lore.kernel.org/r/20200604071921.ga1361...@gmail.com
Cc: Thomas Gleixner 
Cc: Borislav Petkov 
Cc: Peter Zijlstra 
---
 arch/x86/include/asm/bug.h   |  1 +-
 include/asm-generic/bug.h|  1 +-
 include/linux/compiler.h | 53 +-
 include/linux/context_tracking.h |  2 +-
 include/linux/instrumentation.h  | 57 +++-
 5 files changed, 61 insertions(+), 53 deletions(-)
 create mode 100644 include/linux/instrumentation.h

diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index 0281895..297fa12 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -3,6 +3,7 @@
 #define _ASM_X86_BUG_H
 
 #include 
+#include 
 
 /*
  * Despite that some emulators terminate on UD2, we use it for WARN().
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index c94e33a..18b0f4e 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -3,6 +3,7 @@
 #define _ASM_GENERIC_BUG_H
 
 #include 
+#include 
 
 #define CUT_HERE   "[ cut here ]\n"
 
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 204e768..681894b 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -120,65 +120,12 @@ void ftrace_likely_update(struct ftrace_likely_data *f, 
int val,
 /* Annotate a C jump table to allow objtool to follow the code flow */
 #define __annotate_jump_table __section(.rodata..c_jump_table)
 
-#ifdef CONFIG_DEBUG_ENTRY
-/* Begin/end of an instrumentation safe region */
-#define instrumentation_begin() ({ \
-   asm volatile("%c0: nop\n\t" 
\
-".pushsection .discard.instr_begin\n\t"\
-".long %c0b - .\n\t"   \
-".popsection\n\t" : : "i" (__COUNTER__));  \
-})
-
-/*
- * Because instrumentation_{begin,end}() can nest, objtool validation considers
- * _begin() a +1 and _end() a -1 and computes a sum over the instructions.
- * When the value is greater than 0, we consider instrumentation allowed.
- *
- * There is a problem with code like:
- *
- * noinstr void foo()
- * {
- * instrumentation_begin();
- * ...
- * if (cond) {
- * instrumentation_begin();
- * ...
- * instrumentation_end();
- * }
- * bar();
- * instrumentation_end();
- * }
- *
- * If instrumentation_end() would be an empty label, like all the other
- * annotations, the inner _end(), which is at the end of a conditional block,
- * would land on the instruction after the block.
- *
- * If we then consider the sum of the !cond path, we'll see that the call to
- * bar() is with a 0-value, even though, we meant it to happen with a positive
- * value.
- *
- * To avoid this, have _end() be a NOP instruction, this ensures it will be
- * part of the condition block and does not escape.
- */
-#define instrumentation_end() ({   \
-   asm volatile("%c0: nop\n\t" \
-".pushsection .discard.instr_end\n\t" 

[tip: x86/urgent] x86/entry/32: Fix XEN_PV build dependency

2020-07-05 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: a4c0e91d1d65bc58f928b80ed824e10e165da22c
Gitweb:
https://git.kernel.org/tip/a4c0e91d1d65bc58f928b80ed824e10e165da22c
Author:Ingo Molnar 
AuthorDate:Sun, 05 Jul 2020 21:33:11 +02:00
Committer: Ingo Molnar 
CommitterDate: Sun, 05 Jul 2020 21:39:23 +02:00

x86/entry/32: Fix XEN_PV build dependency

xenpv_exc_nmi() and xenpv_exc_debug() are only defined on 64-bit kernels,
but they snuck into the 32-bit build via , causing the link
to fail:

  ld: arch/x86/entry/entry_32.o: in function `asm_xenpv_exc_nmi':
  (.entry.text+0x817): undefined reference to `xenpv_exc_nmi'

  ld: arch/x86/entry/entry_32.o: in function `asm_xenpv_exc_debug':
  (.entry.text+0x827): undefined reference to `xenpv_exc_debug'

Only use them on 64-bit kernels.

Fixes: f41f0824224e: ("x86/entry/xen: Route #DB correctly on Xen PV")
Cc: Andy Lutomirski 
Cc: Thomas Gleixner 
Cc: Peter Zijlstra (Intel) 
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar 
---
 arch/x86/include/asm/idtentry.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
index eeac6dc..f3d7083 100644
--- a/arch/x86/include/asm/idtentry.h
+++ b/arch/x86/include/asm/idtentry.h
@@ -553,7 +553,7 @@ DECLARE_IDTENTRY_RAW(X86_TRAP_MC,   exc_machine_check);
 
 /* NMI */
 DECLARE_IDTENTRY_NMI(X86_TRAP_NMI, exc_nmi);
-#ifdef CONFIG_XEN_PV
+#if defined(CONFIG_XEN_PV) && defined(CONFIG_X86_64)
 DECLARE_IDTENTRY_RAW(X86_TRAP_NMI, xenpv_exc_nmi);
 #endif
 
@@ -563,7 +563,7 @@ DECLARE_IDTENTRY_DEBUG(X86_TRAP_DB, exc_debug);
 #else
 DECLARE_IDTENTRY_RAW(X86_TRAP_DB,  exc_debug);
 #endif
-#ifdef CONFIG_XEN_PV
+#if defined(CONFIG_XEN_PV) && defined(CONFIG_X86_64)
 DECLARE_IDTENTRY_RAW(X86_TRAP_DB,  xenpv_exc_debug);
 #endif
 


[tip: sched/core] irq_work: Define irq_work_single() on !CONFIG_IRQ_WORK too

2020-06-02 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the sched/core branch of tip:

Commit-ID: 25de110d148666752dc0e0da7a0b69de31cd7098
Gitweb:
https://git.kernel.org/tip/25de110d148666752dc0e0da7a0b69de31cd7098
Author:Ingo Molnar 
AuthorDate:Tue, 02 Jun 2020 12:08:39 +02:00
Committer: Ingo Molnar 
CommitterDate: Tue, 02 Jun 2020 12:34:45 +02:00

irq_work: Define irq_work_single() on !CONFIG_IRQ_WORK too

Some SMP platforms don't have CONFIG_IRQ_WORK defined, resulting in a link
error at build time.

Define a stub and clean up the prototype definitions.

Reported-by: kbuild test robot 
Signed-off-by: Ingo Molnar 
Acked-by: Peter Zijlstra 
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar 
---
 include/linux/irq_work.h | 2 ++
 kernel/smp.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index f23a359..2735da5 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -58,9 +58,11 @@ void irq_work_sync(struct irq_work *work);
 
 void irq_work_run(void);
 bool irq_work_needs_cpu(void);
+void irq_work_single(void *arg);
 #else
 static inline bool irq_work_needs_cpu(void) { return false; }
 static inline void irq_work_run(void) { }
+static inline void irq_work_single(void *arg) { }
 #endif
 
 #endif /* _LINUX_IRQ_WORK_H */
diff --git a/kernel/smp.c b/kernel/smp.c
index 4dec04f..c80486a 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -194,8 +194,6 @@ void generic_smp_call_function_single_interrupt(void)
flush_smp_call_function_queue(true);
 }
 
-extern void irq_work_single(void *);
-
 /**
  * flush_smp_call_function_queue - Flush pending smp-call-function callbacks
  *


[tip: locking/core] mm/swap: Use local_lock for protection

2020-06-01 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the locking/core branch of tip:

Commit-ID: b01b214136ac3e4746b7f76c0f204ae4b445
Gitweb:
https://git.kernel.org/tip/b01b214136ac3e4746b7f76c0f204ae4b445
Author:Ingo Molnar 
AuthorDate:Wed, 27 May 2020 22:11:15 +02:00
Committer: Ingo Molnar 
CommitterDate: Thu, 28 May 2020 10:31:10 +02:00

mm/swap: Use local_lock for protection

The various struct pagevec per CPU variables are protected by disabling
either preemption or interrupts across the critical sections. Inside
these sections spinlocks have to be acquired.

These spinlocks are regular spinlock_t types which are converted to
"sleeping" spinlocks on PREEMPT_RT enabled kernels. Obviously sleeping
locks cannot be acquired in preemption or interrupt disabled sections.

local locks provide a trivial way to substitute preempt and interrupt
disable instances. On a non PREEMPT_RT enabled kernel local_lock() maps
to preempt_disable() and local_lock_irq() to local_irq_disable().

Create lru_rotate_pvecs containing the pagevec and the locallock.
Create lru_pvecs containing the remaining pagevecs and the locallock.
Add lru_add_drain_cpu_zone() which is used from compact_zone() to avoid
exporting the pvec structure.

Change the relevant call sites to acquire these locks instead of using
preempt_disable() / get_cpu() / get_cpu_var() and local_irq_disable() /
local_irq_save().

There is neither a functional change nor a change in the generated
binary code for non PREEMPT_RT enabled non-debug kernels.

When lockdep is enabled local locks have lockdep maps embedded. These
allow lockdep to validate the protections, i.e. inappropriate usage of a
preemption only protected sections would result in a lockdep warning
while the same problem would not be noticed with a plain
preempt_disable() based protection.

local locks also improve readability as they provide a named scope for
the protections while preempt/interrupt disable are opaque scopeless.

Finally local locks allow PREEMPT_RT to substitute them with real
locking primitives to ensure the correctness of operation in a fully
preemptible kernel.

[ bigeasy: Adopted to use local_lock ]

Signed-off-by: Ingo Molnar 
Signed-off-by: Sebastian Andrzej Siewior 
Signed-off-by: Ingo Molnar 
Acked-by: Peter Zijlstra 
Link: https://lore.kernel.org/r/20200527201119.1692513-4-bige...@linutronix.de
---
 include/linux/swap.h |   1 +-
 mm/compaction.c  |   6 +--
 mm/swap.c| 118 --
 3 files changed, 82 insertions(+), 43 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index e1bbf7a..25181d2 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -337,6 +337,7 @@ extern void activate_page(struct page *);
 extern void mark_page_accessed(struct page *);
 extern void lru_add_drain(void);
 extern void lru_add_drain_cpu(int cpu);
+extern void lru_add_drain_cpu_zone(struct zone *zone);
 extern void lru_add_drain_all(void);
 extern void rotate_reclaimable_page(struct page *page);
 extern void deactivate_file_page(struct page *page);
diff --git a/mm/compaction.c b/mm/compaction.c
index 46f0fcc..c9d659e 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -2243,15 +2243,11 @@ check_drain:
 * would succeed.
 */
if (cc->order > 0 && last_migrated_pfn) {
-   int cpu;
unsigned long current_block_start =
block_start_pfn(cc->migrate_pfn, cc->order);
 
if (last_migrated_pfn < current_block_start) {
-   cpu = get_cpu();
-   lru_add_drain_cpu(cpu);
-   drain_local_pages(cc->zone);
-   put_cpu();
+   lru_add_drain_cpu_zone(cc->zone);
/* No more flushing until we migrate again */
last_migrated_pfn = 0;
}
diff --git a/mm/swap.c b/mm/swap.c
index bf9a79f..0ac463d 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "internal.h"
 
@@ -44,14 +45,32 @@
 /* How many pages do we try to swap or page in/out together? */
 int page_cluster;
 
-static DEFINE_PER_CPU(struct pagevec, lru_add_pvec);
-static DEFINE_PER_CPU(struct pagevec, lru_rotate_pvecs);
-static DEFINE_PER_CPU(struct pagevec, lru_deactivate_file_pvecs);
-static DEFINE_PER_CPU(struct pagevec, lru_deactivate_pvecs);
-static DEFINE_PER_CPU(struct pagevec, lru_lazyfree_pvecs);
+/* Protecting only lru_rotate.pvec which requires disabling interrupts */
+struct lru_rotate {
+   local_lock_t lock;
+   struct pagevec pvec;
+};
+static DEFINE_PER_CPU(struct lru_rotate, lru_rotate) = {
+   .lock = INIT_LOCAL_LOCK(lock),
+};
+
+/*
+ * The following struct pagevec are grouped together because they are protected
+ 

[tip: sched/core] sched/headers: Split out open-coded prototypes into kernel/sched/smp.h

2020-06-01 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the sched/core branch of tip:

Commit-ID: 1f8db4150536431b031585ecc2a6793f69245de2
Gitweb:
https://git.kernel.org/tip/1f8db4150536431b031585ecc2a6793f69245de2
Author:Ingo Molnar 
AuthorDate:Thu, 28 May 2020 11:01:34 +02:00
Committer: Ingo Molnar 
CommitterDate: Thu, 28 May 2020 11:03:20 +02:00

sched/headers: Split out open-coded prototypes into kernel/sched/smp.h

Move the prototypes for sched_ttwu_pending() and send_call_function_single_ipi()
into the newly created kernel/sched/smp.h header, to make sure they are all
the same, and to architectures happy that use -Wmissing-prototypes.

Signed-off-by: Ingo Molnar 
---
 kernel/sched/core.c |  1 +
 kernel/sched/smp.h  |  9 +
 kernel/smp.c|  5 +
 3 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 kernel/sched/smp.h

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b3c64c6..43ba2d4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -20,6 +20,7 @@
 #include "../smpboot.h"
 
 #include "pelt.h"
+#include "smp.h"
 
 #define CREATE_TRACE_POINTS
 #include 
diff --git a/kernel/sched/smp.h b/kernel/sched/smp.h
new file mode 100644
index 000..9620e32
--- /dev/null
+++ b/kernel/sched/smp.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Scheduler internal SMP callback types and methods between the scheduler
+ * and other internal parts of the core kernel:
+ */
+
+extern void sched_ttwu_pending(void *arg);
+
+extern void send_call_function_single_ipi(int cpu);
diff --git a/kernel/smp.c b/kernel/smp.c
index 0d61dc0..4dec04f 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -22,7 +22,7 @@
 #include 
 
 #include "smpboot.h"
-
+#include "sched/smp.h"
 
 #define CSD_TYPE(_csd) ((_csd)->flags & CSD_FLAG_TYPE_MASK)
 
@@ -133,8 +133,6 @@ static __always_inline void csd_unlock(call_single_data_t 
*csd)
 
 static DEFINE_PER_CPU_SHARED_ALIGNED(call_single_data_t, csd_data);
 
-extern void send_call_function_single_ipi(int cpu);
-
 void __smp_call_single_queue(int cpu, struct llist_node *node)
 {
/*
@@ -196,7 +194,6 @@ void generic_smp_call_function_single_interrupt(void)
flush_smp_call_function_queue(true);
 }
 
-extern void sched_ttwu_pending(void *);
 extern void irq_work_single(void *);
 
 /**


[tip: irq/core] irqchip: Fix "Loongson HyperTransport Vector support" driver build on all non-MIPS platforms

2020-06-01 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the irq/core branch of tip:

Commit-ID: d77aeb5d403d379ff458e04fc07b5b86700270f2
Gitweb:
https://git.kernel.org/tip/d77aeb5d403d379ff458e04fc07b5b86700270f2
Author:Ingo Molnar 
AuthorDate:Mon, 01 Jun 2020 09:45:27 +02:00
Committer: Ingo Molnar 
CommitterDate: Mon, 01 Jun 2020 09:48:52 +02:00

irqchip: Fix "Loongson HyperTransport Vector support" driver build on all 
non-MIPS platforms

This commit:

  818e915fbac5: ("irqchip: Add Loongson HyperTransport Vector support")

Added a MIPS-only driver, but turned on compilation on all other architectures 
as well:

 config LOONGSON_HTVEC
bool "Loongson3 HyperTransport Interrupt Vector Controller"
depends on MACH_LOONGSON64 || COMPILE_TEST

But this driver was never build tested on any other architecture than MIPS:

  drivers/irqchip/irq-loongson-htvec.c: In function ‘htvec_irq_dispatch’:
  drivers/irqchip/irq-loongson-htvec.c:59:3: error: implicit declaration of 
function ‘spurious_interrupt’; did you mean ‘smp_reboot_interrupt’? 
[-Werror=implicit-function-declaration]

Because spurious_interrupt() only exists on MIPS.

So make it MIPS-only.

Signed-off-by: Ingo Molnar 
Cc: Jiaxun Yang 
Cc: Marc Zyngier 
Cc: Thomas Gleixner 
Signed-off-by: Ingo Molnar 
---
 drivers/irqchip/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 0b6b826..66b9a68 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -534,7 +534,7 @@ config LOONGSON_HTPIC
 
 config LOONGSON_HTVEC
bool "Loongson3 HyperTransport Interrupt Vector Controller"
-   depends on MACH_LOONGSON64 || COMPILE_TEST
+   depends on MACH_LOONGSON64
default MACH_LOONGSON64
select IRQ_DOMAIN_HIERARCHY
help


[tip: x86/entry] x86/entry: Fix allnoconfig build warning

2020-05-25 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/entry branch of tip:

Commit-ID: d121f9483b18c423037ce6088feba24ae83891d1
Gitweb:
https://git.kernel.org/tip/d121f9483b18c423037ce6088feba24ae83891d1
Author:Ingo Molnar 
AuthorDate:Mon, 25 May 2020 09:42:41 +02:00
Committer: Ingo Molnar 
CommitterDate: Mon, 25 May 2020 09:45:27 +02:00

x86/entry: Fix allnoconfig build warning

The following commit:

  095b7a3e7745 ("x86/entry: Convert double fault exception to IDTENTRY_DF")

introduced a new build warning on 64-bit allnoconfig kernels, that have 
CONFIG_VMAP_STACK disabled:

  arch/x86/kernel/traps.c:332:16: warning: unused variable ‘address’ 
[-Wunused-variable]

This variable is only used if CONFIG_VMAP_STACK is defined, so make it
dependent on that, not CONFIG_X86_64.

Signed-off-by: Ingo Molnar 
Cc: Thomas Gleixner 
Cc: Alexandre Chartre 
Cc: Peter Zijlstra 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 35298c1..9e5d81c 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -328,7 +328,7 @@ DEFINE_IDTENTRY_DF(exc_double_fault)
static const char str[] = "double fault";
struct task_struct *tsk = current;
 
-#ifdef CONFIG_X86_64
+#ifdef CONFIG_VMAP_STACK
unsigned long address = read_cr2();
 #endif
 


[tip: locking/kcsan] Improve KCSAN documentation a bit

2020-05-08 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the locking/kcsan branch of tip:

Commit-ID: eba9c444d34c9f10cbb463329c2c8e14f2adff25
Gitweb:
https://git.kernel.org/tip/eba9c444d34c9f10cbb463329c2c8e14f2adff25
Author:Ingo Molnar 
AuthorDate:Mon, 13 Apr 2020 11:03:05 +02:00
Committer: Paul E. McKenney 
CommitterDate: Mon, 27 Apr 2020 11:10:02 -07:00

Improve KCSAN documentation a bit

This commit simplifies and clarifies the highest level KCSAN Kconfig
help text.

Signed-off-by: Ingo Molnar 
Signed-off-by: Paul E. McKenney 
---
 lib/Kconfig.kcsan | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan
index 0f1447f..689b6b8 100644
--- a/lib/Kconfig.kcsan
+++ b/lib/Kconfig.kcsan
@@ -4,17 +4,18 @@ config HAVE_ARCH_KCSAN
bool
 
 menuconfig KCSAN
-   bool "KCSAN: dynamic race detector"
+   bool "KCSAN: dynamic data race detector"
depends on HAVE_ARCH_KCSAN && DEBUG_KERNEL && !KASAN
select STACKTRACE
help
- The Kernel Concurrency Sanitizer (KCSAN) is a dynamic race detector,
- which relies on compile-time instrumentation, and uses a
- watchpoint-based sampling approach to detect races.
+ The Kernel Concurrency Sanitizer (KCSAN) is a dynamic
+ data-race detector that relies on compile-time instrumentation.
+ KCSAN uses a watchpoint-based sampling approach to detect races.
 
- KCSAN's primary purpose is to detect data races. KCSAN can also be
- used to check properties, with the help of provided assertions, of
- concurrent code where bugs do not manifest as data races.
+ While KCSAN's primary purpose is to detect data races, it
+ also provides assertions to check data access constraints.
+ These assertions can expose bugs that do not manifest as
+ data races.
 
  See  for more details.
 


[tip: perf/core] perf/core: Fix !CONFIG_PERF_EVENTS build warnings and failures

2019-10-19 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the perf/core branch of tip:

Commit-ID: ae79d5588a04aec9dc4b0c6df700d131447306e0
Gitweb:
https://git.kernel.org/tip/ae79d5588a04aec9dc4b0c6df700d131447306e0
Author:Ingo Molnar 
AuthorDate:Sat, 19 Oct 2019 09:15:27 +02:00
Committer: Ingo Molnar 
CommitterDate: Sat, 19 Oct 2019 09:15:27 +02:00

perf/core: Fix !CONFIG_PERF_EVENTS build warnings and failures

sparc64 runs into this warning:

  include/linux/security.h:1913:52: warning: 'struct perf_event' declared 
inside parameter list will not be visible outside of this definition or 
declaration

which is escalated to a build error in some of the .c files due to -Werror.

Fix it via a forward declaration, like we do for perf_event_attr, the stub 
inlines
don't actually need to know the structure of this struct.

Fixes: da97e18458fb: ("perf_event: Add support for LSM and SELinux checks")
Cc: "Joel Fernandes (Google)" 
Cc: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Alexander Shishkin 
Cc: Mark Rutland 
Cc: Namhyung Kim 
Signed-off-by: Ingo Molnar 
---
 include/linux/security.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/security.h b/include/linux/security.h
index 4df79ff..0a86bfe 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1896,6 +1896,7 @@ static inline void security_bpf_prog_free(struct 
bpf_prog_aux *aux)
 
 #ifdef CONFIG_PERF_EVENTS
 struct perf_event_attr;
+struct perf_event;
 
 #ifdef CONFIG_SECURITY
 extern int security_perf_event_open(struct perf_event_attr *attr, int type);


[tip: x86/mm] x86/mm: Clean up the pmd_read_atomic() comments

2019-09-27 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/mm branch of tip:

Commit-ID: 44e09568cf2d874cb2a8e2ac35acf71a9ae3402b
Gitweb:
https://git.kernel.org/tip/44e09568cf2d874cb2a8e2ac35acf71a9ae3402b
Author:Ingo Molnar 
AuthorDate:Wed, 25 Sep 2019 08:38:57 +02:00
Committer: Ingo Molnar 
CommitterDate: Wed, 25 Sep 2019 10:13:27 +02:00

x86/mm: Clean up the pmd_read_atomic() comments

Fix spelling, consistent parenthesis and grammar - and also clarify
the language where needed.

Reviewed-by: Wei Yang 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: H. Peter Anvin 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Rik van Riel 
Cc: Thomas Gleixner 
Signed-off-by: Ingo Molnar 
---
 arch/x86/include/asm/pgtable-3level.h | 44 +-
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/arch/x86/include/asm/pgtable-3level.h 
b/arch/x86/include/asm/pgtable-3level.h
index 1796462..5afb5e0 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -36,39 +36,41 @@ static inline void native_set_pte(pte_t *ptep, pte_t pte)
 
 #define pmd_read_atomic pmd_read_atomic
 /*
- * pte_offset_map_lock on 32bit PAE kernels was reading the pmd_t with
- * a "*pmdp" dereference done by gcc. Problem is, in certain places
- * where pte_offset_map_lock is called, concurrent page faults are
+ * pte_offset_map_lock() on 32-bit PAE kernels was reading the pmd_t with
+ * a "*pmdp" dereference done by GCC. Problem is, in certain places
+ * where pte_offset_map_lock() is called, concurrent page faults are
  * allowed, if the mmap_sem is hold for reading. An example is mincore
  * vs page faults vs MADV_DONTNEED. On the page fault side
- * pmd_populate rightfully does a set_64bit, but if we're reading the
+ * pmd_populate() rightfully does a set_64bit(), but if we're reading the
  * pmd_t with a "*pmdp" on the mincore side, a SMP race can happen
- * because gcc will not read the 64bit of the pmd atomically. To fix
- * this all places running pte_offset_map_lock() while holding the
+ * because GCC will not read the 64-bit value of the pmd atomically.
+ *
+ * To fix this all places running pte_offset_map_lock() while holding the
  * mmap_sem in read mode, shall read the pmdp pointer using this
- * function to know if the pmd is null nor not, and in turn to know if
+ * function to know if the pmd is null or not, and in turn to know if
  * they can run pte_offset_map_lock() or pmd_trans_huge() or other pmd
  * operations.
  *
- * Without THP if the mmap_sem is hold for reading, the pmd can only
- * transition from null to not null while pmd_read_atomic runs. So
+ * Without THP if the mmap_sem is held for reading, the pmd can only
+ * transition from null to not null while pmd_read_atomic() runs. So
  * we can always return atomic pmd values with this function.
  *
- * With THP if the mmap_sem is hold for reading, the pmd can become
+ * With THP if the mmap_sem is held for reading, the pmd can become
  * trans_huge or none or point to a pte (and in turn become "stable")
- * at any time under pmd_read_atomic. We could read it really
- * atomically here with a atomic64_read for the THP enabled case (and
+ * at any time under pmd_read_atomic(). We could read it truly
+ * atomically here with an atomic64_read() for the THP enabled case (and
  * it would be a whole lot simpler), but to avoid using cmpxchg8b we
  * only return an atomic pmdval if the low part of the pmdval is later
- * found stable (i.e. pointing to a pte). And we're returning a none
- * pmdval if the low part of the pmd is none. In some cases the high
- * and low part of the pmdval returned may not be consistent if THP is
- * enabled (the low part may point to previously mapped hugepage,
- * while the high part may point to a more recently mapped hugepage),
- * but pmd_none_or_trans_huge_or_clear_bad() only needs the low part
- * of the pmd to be read atomically to decide if the pmd is unstable
- * or not, with the only exception of when the low part of the pmd is
- * zero in which case we return a none pmd.
+ * found to be stable (i.e. pointing to a pte). We are also returning a
+ * 'none' (zero) pmdval if the low part of the pmd is zero.
+ *
+ * In some cases the high and low part of the pmdval returned may not be
+ * consistent if THP is enabled (the low part may point to previously
+ * mapped hugepage, while the high part may point to a more recently
+ * mapped hugepage), but pmd_none_or_trans_huge_or_clear_bad() only
+ * needs the low part of the pmd to be read atomically to decide if the
+ * pmd is unstable or not, with the only exception when the low part
+ * of the pmd is zero, in which case we return a 'none' pmd.
  */
 static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
 {


[tip: refs/heads/sched/urgent] sched/core: Fix uclamp ABI bug, clean up and robustify sched_read_attr() ABI logic and code

2019-09-05 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the refs/heads/sched/urgent branch of 
tip:

Commit-ID: 1251201c0d34fadf69d56efa675c2b7dd0a90eca
Gitweb:
https://git.kernel.org/tip/1251201c0d34fadf69d56efa675c2b7dd0a90eca
Author:Ingo Molnar 
AuthorDate:Wed, 04 Sep 2019 09:55:32 +02:00
Committer: Ingo Molnar 
CommitterDate: Wed, 04 Sep 2019 19:51:30 +02:00

sched/core: Fix uclamp ABI bug, clean up and robustify sched_read_attr() ABI 
logic and code

Thadeu Lima de Souza Cascardo reported that 'chrt' broke on recent kernels:

  $ chrt -p $$
  chrt: failed to get pid 26306's policy: Argument list too long

and he has root-caused the bug to the following commit increasing sched_attr
size and breaking sched_read_attr() into returning -EFBIG:

  a509a7cd7974 ("sched/uclamp: Extend sched_setattr() to support utilization 
clamping")

The other, bigger bug is that the whole sched_getattr() and sched_read_attr()
logic of checking non-zero bits in new ABI components is arguably broken,
and pretty much any extension of the ABI will spuriously break the ABI.
That's way too fragile.

Instead implement the perf syscall's extensible ABI instead, which we
already implement on the sched_setattr() side:

 - if user-attributes have the same size as kernel attributes then the
   logic is unchanged.

 - if user-attributes are larger than the kernel knows about then simply
   skip the extra bits, but set attr->size to the (smaller) kernel size
   so that tooling can (in principle) handle older kernel as well.

 - if user-attributes are smaller than the kernel knows about then just
   copy whatever user-space can accept.

Also clean up the whole logic:

 - Simplify the code flow - there's no need for 'ret' for example.

 - Standardize on 'kattr/uattr' and 'ksize/usize' naming to make sure we
   always know which side we are dealing with.

 - Why is it called 'read' when what it does is to copy to user? This
   code is so far away from VFS read() semantics that the naming is
   actively confusing. Name it sched_attr_copy_to_user() instead, which
   mirrors other copy_to_user() functionality.

 - Move the attr->size assignment from the head of sched_getattr() to the
   sched_attr_copy_to_user() function. Nothing else within the kernel
   should care about the size of the structure.

With these fixes the sched_getattr() syscall now nicely supports an
extensible ABI in both a forward and backward compatible fashion, and
will also fix the chrt bug.

As an added bonus the bogus -EFBIG return is removed as well, which as
Thadeu noted should have been -E2BIG to begin with.

Reported-by: Thadeu Lima de Souza Cascardo 
Tested-by: Dietmar Eggemann 
Tested-by: Thadeu Lima de Souza Cascardo 
Acked-by: Thadeu Lima de Souza Cascardo 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Patrick Bellasi 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Fixes: a509a7cd7974 ("sched/uclamp: Extend sched_setattr() to support 
utilization clamping")
Link: https://lkml.kernel.org/r/20190904075532.ga26...@gmail.com
Signed-off-by: Ingo Molnar 
---
 kernel/sched/core.c | 78 ++--
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 010d578..df9f1fe 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5105,37 +5105,40 @@ out_unlock:
return retval;
 }
 
-static int sched_read_attr(struct sched_attr __user *uattr,
-  struct sched_attr *attr,
-  unsigned int usize)
+/*
+ * Copy the kernel size attribute structure (which might be larger
+ * than what user-space knows about) to user-space.
+ *
+ * Note that all cases are valid: user-space buffer can be larger or
+ * smaller than the kernel-space buffer. The usual case is that both
+ * have the same size.
+ */
+static int
+sched_attr_copy_to_user(struct sched_attr __user *uattr,
+   struct sched_attr *kattr,
+   unsigned int usize)
 {
-   int ret;
+   unsigned int ksize = sizeof(*kattr);
 
if (!access_ok(uattr, usize))
return -EFAULT;
 
/*
-* If we're handed a smaller struct than we know of,
-* ensure all the unknown bits are 0 - i.e. old
-* user-space does not get uncomplete information.
+* sched_getattr() ABI forwards and backwards compatibility:
+*
+* If usize == ksize then we just copy everything to user-space and all 
is good.
+*
+* If usize < ksize then we only copy as much as user-space has space 
for,
+* this keeps ABI compatibility as well. We skip the rest.
+*
+* If usize > ksize then user-space is using a newer version of the ABI,
+* which part the kernel doesn't know about. Just ignore it - tooling 
can
+* detect the kernel's knowledge of attributes from the attr->size value
+* which is set to ksize in this case.

[tip: x86/urgent] x86/build: Add -Wnoaddress-of-packed-member to REALMODE_CFLAGS, to silence GCC9 build warning

2019-08-28 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: 183e6429186150690cee034eb85745cf2b15ccb4
Gitweb:
https://git.kernel.org/tip/183e6429186150690cee034eb85745cf2b15ccb4
Author:Ingo Molnar 
AuthorDate:Wed, 28 Aug 2019 10:56:48 +02:00
Committer: Ingo Molnar 
CommitterDate: Wed, 28 Aug 2019 10:58:41 +02:00

x86/build: Add -Wnoaddress-of-packed-member to REALMODE_CFLAGS, to silence GCC9 
build warning

One of the very few warnings I have in the current build comes from
arch/x86/boot/edd.c, where I get the following with a gcc9 build:

   arch/x86/boot/edd.c: In function ‘query_edd’:
   arch/x86/boot/edd.c:148:11: warning: taking address of packed member of 
‘struct boot_params’ may result in an unaligned pointer value 
[-Waddress-of-packed-member]
 148 |  mbrptr = boot_params.edd_mbr_sig_buffer;
 |   ^~~

This warning triggers because we throw away all the CFLAGS and then make
a new set for REALMODE_CFLAGS, so the -Wno-address-of-packed-member we
added in the following commit is not present:

  6f303d60534c ("gcc-9: silence 'address-of-packed-member' warning")

The simplest solution for now is to adjust the warning for this version
of CFLAGS as well, but it would definitely make sense to examine whether
REALMODE_CFLAGS could be derived from CFLAGS, so that it picks up changes
in the compiler flags environment automatically.

Signed-off-by: Linus Torvalds 
Acked-by: Borislav Petkov 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Signed-off-by: Ingo Molnar 
---
 arch/x86/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 56e748a..94df086 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -38,6 +38,7 @@ REALMODE_CFLAGS   := $(M16_CFLAGS) -g -Os 
-DDISABLE_BRANCH_PROFILING \
 
 REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), 
-ffreestanding)
 REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), 
-fno-stack-protector)
+REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), 
-Wno-address-of-packed-member)
 REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), 
$(cc_stack_align4))
 export REALMODE_CFLAGS
 


[tip: x86/cpu] x86/cpu/intel: Fix rename fallout

2019-08-26 Thread tip-bot2 for Ingo Molnar
The following commit has been merged into the x86/cpu branch of tip:

Commit-ID: 26ee9ccc117b9c4179f0a1c65c67f71a0a5a0afe
Gitweb:
https://git.kernel.org/tip/26ee9ccc117b9c4179f0a1c65c67f71a0a5a0afe
Author:Ingo Molnar 
AuthorDate:Mon, 26 Aug 2019 12:19:06 +02:00
Committer: Ingo Molnar 
CommitterDate: Mon, 26 Aug 2019 13:06:29 +02:00

x86/cpu/intel: Fix rename fallout

The scripts missed a macro construct of intel_idle.c and other files.

Signed-off-by: Ingo Molnar 
Cc: Peter Zijlstra (Intel) 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: Tony Luck 
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar 
---
 drivers/idle/intel_idle.c| 26 +++
 drivers/platform/x86/intel_pmc_core.c| 12 +++
 drivers/platform/x86/intel_pmc_core_pltdrv.c | 12 +++
 drivers/powercap/intel_rapl_common.c | 32 +--
 4 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index ac58487..347b08b 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1072,26 +1072,26 @@ static const struct x86_cpu_id intel_idle_ids[] 
__initconst = {
INTEL_CPU_FAM6(ATOM_AIRMONT,idle_cpu_cht),
INTEL_CPU_FAM6(IVYBRIDGE,   idle_cpu_ivb),
INTEL_CPU_FAM6(IVYBRIDGE_X, idle_cpu_ivt),
-   INTEL_CPU_FAM6(HASWELL_CORE,idle_cpu_hsw),
+   INTEL_CPU_FAM6(HASWELL, idle_cpu_hsw),
INTEL_CPU_FAM6(HASWELL_X,   idle_cpu_hsw),
-   INTEL_CPU_FAM6(HASWELL_ULT, idle_cpu_hsw),
-   INTEL_CPU_FAM6(HASWELL_GT3E,idle_cpu_hsw),
-   INTEL_CPU_FAM6(ATOM_SILVERMONT_X,   idle_cpu_avn),
-   INTEL_CPU_FAM6(BROADWELL_CORE,  idle_cpu_bdw),
-   INTEL_CPU_FAM6(BROADWELL_GT3E,  idle_cpu_bdw),
+   INTEL_CPU_FAM6(HASWELL_L,   idle_cpu_hsw),
+   INTEL_CPU_FAM6(HASWELL_G,   idle_cpu_hsw),
+   INTEL_CPU_FAM6(ATOM_SILVERMONT_D,   idle_cpu_avn),
+   INTEL_CPU_FAM6(BROADWELL,   idle_cpu_bdw),
+   INTEL_CPU_FAM6(BROADWELL_G, idle_cpu_bdw),
INTEL_CPU_FAM6(BROADWELL_X, idle_cpu_bdw),
-   INTEL_CPU_FAM6(BROADWELL_XEON_D,idle_cpu_bdw),
-   INTEL_CPU_FAM6(SKYLAKE_MOBILE,  idle_cpu_skl),
-   INTEL_CPU_FAM6(SKYLAKE_DESKTOP, idle_cpu_skl),
-   INTEL_CPU_FAM6(KABYLAKE_MOBILE, idle_cpu_skl),
-   INTEL_CPU_FAM6(KABYLAKE_DESKTOP,idle_cpu_skl),
+   INTEL_CPU_FAM6(BROADWELL_D, idle_cpu_bdw),
+   INTEL_CPU_FAM6(SKYLAKE_L,   idle_cpu_skl),
+   INTEL_CPU_FAM6(SKYLAKE, idle_cpu_skl),
+   INTEL_CPU_FAM6(KABYLAKE_L,  idle_cpu_skl),
+   INTEL_CPU_FAM6(KABYLAKE,idle_cpu_skl),
INTEL_CPU_FAM6(SKYLAKE_X,   idle_cpu_skx),
INTEL_CPU_FAM6(XEON_PHI_KNL,idle_cpu_knl),
INTEL_CPU_FAM6(XEON_PHI_KNM,idle_cpu_knl),
INTEL_CPU_FAM6(ATOM_GOLDMONT,   idle_cpu_bxt),
INTEL_CPU_FAM6(ATOM_GOLDMONT_PLUS,  idle_cpu_bxt),
-   INTEL_CPU_FAM6(ATOM_GOLDMONT_X, idle_cpu_dnv),
-   INTEL_CPU_FAM6(ATOM_TREMONT_X,  idle_cpu_dnv),
+   INTEL_CPU_FAM6(ATOM_GOLDMONT_D, idle_cpu_dnv),
+   INTEL_CPU_FAM6(ATOM_TREMONT_D,  idle_cpu_dnv),
{}
 };
 
diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index c510d0d..fd1bfd5 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -806,12 +806,12 @@ static inline void pmc_core_dbgfs_unregister(struct 
pmc_dev *pmcdev)
 #endif /* CONFIG_DEBUG_FS */
 
 static const struct x86_cpu_id intel_pmc_core_ids[] = {
-   INTEL_CPU_FAM6(SKYLAKE_MOBILE, spt_reg_map),
-   INTEL_CPU_FAM6(SKYLAKE_DESKTOP, spt_reg_map),
-   INTEL_CPU_FAM6(KABYLAKE_MOBILE, spt_reg_map),
-   INTEL_CPU_FAM6(KABYLAKE_DESKTOP, spt_reg_map),
-   INTEL_CPU_FAM6(CANNONLAKE_MOBILE, cnp_reg_map),
-   INTEL_CPU_FAM6(ICELAKE_MOBILE, icl_reg_map),
+   INTEL_CPU_FAM6(SKYLAKE_L, spt_reg_map),
+   INTEL_CPU_FAM6(SKYLAKE, spt_reg_map),
+   INTEL_CPU_FAM6(KABYLAKE_L, spt_reg_map),
+   INTEL_CPU_FAM6(KABYLAKE, spt_reg_map),
+   INTEL_CPU_FAM6(CANNONLAKE_L, cnp_reg_map),
+   INTEL_CPU_FAM6(ICELAKE_L, icl_reg_map),
INTEL_CPU_FAM6(ICELAKE_NNPI, icl_reg_map),
{}
 };
diff --git a/drivers/platform/x86/intel_pmc_core_pltdrv.c 
b/drivers/platform/x86/intel_pmc_core_pltdrv.c
index a8754a6..5977e0d 100644
--- a/drivers/platform/x86/intel_pmc_core_pltdrv.c
+++ b/drivers/platform/x86/intel_pmc_core_pltdrv.c
@@ -30,12 +30,12 @@ static struct platform_device pmc_core_device = {
  * other list may grow, but this list should not.
  */
 static const