linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT pull] core/urgent for v5.4-rc7
@ 2019-11-10 10:21 Thomas Gleixner
  2019-11-10 10:21 ` [GIT pull] timers/urgent " Thomas Gleixner
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Thomas Gleixner @ 2019-11-10 10:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, x86

Linus,

please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-urgent-for-linus

up to:  b0c51f158455: stacktrace: Don't skip first entry on noncurrent tasks

A small fix for a stacktrace regression. Saving a stacktrace for a foreign
task skipped an extra entry which makes e.g. the output of /proc/$PID/stack
incomplete.

Thanks,

	tglx

------------------>
Jiri Slaby (1):
      stacktrace: Don't skip first entry on noncurrent tasks


 kernel/stacktrace.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
index 6d1f68b7e528..c9ea7eb2cb1a 100644
--- a/kernel/stacktrace.c
+++ b/kernel/stacktrace.c
@@ -141,7 +141,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store,
 	struct stacktrace_cookie c = {
 		.store	= store,
 		.size	= size,
-		.skip	= skipnr + 1,
+		/* skip this function if they are tracing us */
+		.skip	= skipnr + !!(current == tsk),
 	};
 
 	if (!try_get_task_stack(tsk))
@@ -298,7 +299,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *task,
 	struct stack_trace trace = {
 		.entries	= store,
 		.max_entries	= size,
-		.skip		= skipnr + 1,
+		/* skip this function if they are tracing us */
+		.skip	= skipnr + !!(current == task),
 	};
 
 	save_stack_trace_tsk(task, &trace);



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [GIT pull] irq/urgent for v5.4-rc7
  2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
                   ` (3 preceding siblings ...)
  2019-11-10 10:21 ` [GIT pull] x86/urgent " Thomas Gleixner
@ 2019-11-10 10:21 ` Thomas Gleixner
  2019-11-10 21:00   ` pr-tracker-bot
  2019-11-10 21:00 ` [GIT pull] core/urgent " pr-tracker-bot
  2019-11-10 22:00 ` Joe Perches
  6 siblings, 1 reply; 17+ messages in thread
From: Thomas Gleixner @ 2019-11-10 10:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, x86

Linus,

please pull the latest irq-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-urgent-for-linus

up to:  0ed9ca25894e: irq/irqdomain: Update __irq_domain_alloc_fwnode() function documentation

A trivial fix for a kernel doc regression where an argument change was not
reflected in the documentation.

Thanks,

	tglx

------------------>
Yi Wang (1):
      irq/irqdomain: Update __irq_domain_alloc_fwnode() function documentation


 kernel/irq/irqdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 132672b74e4b..dd822fd8a7d5 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(irqchip_fwnode_ops);
  * @type:	Type of irqchip_fwnode. See linux/irqdomain.h
  * @name:	Optional user provided domain name
  * @id:		Optional user provided id if name != NULL
- * @data:	Optional user-provided data
+ * @pa:		Optional user-provided physical address
  *
  * Allocate a struct irqchip_fwid, and return a poiner to the embedded
  * fwnode_handle (or NULL on failure).



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [GIT pull] perf/urgent for v5.4-rc7
  2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
  2019-11-10 10:21 ` [GIT pull] timers/urgent " Thomas Gleixner
@ 2019-11-10 10:21 ` Thomas Gleixner
  2019-11-10 21:00   ` pr-tracker-bot
  2019-11-10 10:21 ` [GIT pull] sched/urgent " Thomas Gleixner
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Thomas Gleixner @ 2019-11-10 10:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, x86

Linus,

please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

up to:  485c05351312: Merge tag 'perf-urgent-for-mingo-5.4-20191105' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Fixes for perf tooling:

   - Fix the time sorting algorithm which was broken due to truncation of
     big numbers.

   - Fix the python script generator fail caused by a broken tracepoint
     array iterator.

Thanks,

	tglx

------------------>
Jiri Olsa (1):
      perf tools: Fix time sorting

Steven Rostedt (VMware) (2):
      perf scripting engines: Iterate on tep event arrays directly
      perf tools: Remove unused trace_find_next_event()


 tools/perf/util/hist.c                             |  2 +-
 .../perf/util/scripting-engines/trace-event-perl.c |  8 ++++--
 .../util/scripting-engines/trace-event-python.c    |  9 +++++--
 tools/perf/util/trace-event-parse.c                | 31 ----------------------
 tools/perf/util/trace-event.h                      |  2 --
 5 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 679a1d75090c..7b6eaf5e0bda 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1625,7 +1625,7 @@ int hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
 	return 0;
 }
 
-static int hist_entry__sort(struct hist_entry *a, struct hist_entry *b)
+static int64_t hist_entry__sort(struct hist_entry *a, struct hist_entry *b)
 {
 	struct hists *hists = a->hists;
 	struct perf_hpp_fmt *fmt;
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 15961854ba67..741f040648b5 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -539,10 +539,11 @@ static int perl_stop_script(void)
 
 static int perl_generate_script(struct tep_handle *pevent, const char *outfile)
 {
+	int i, not_first, count, nr_events;
+	struct tep_event **all_events;
 	struct tep_event *event = NULL;
 	struct tep_format_field *f;
 	char fname[PATH_MAX];
-	int not_first, count;
 	FILE *ofp;
 
 	sprintf(fname, "%s.pl", outfile);
@@ -603,8 +604,11 @@ sub print_backtrace\n\
 }\n\n\
 ");
 
+	nr_events = tep_get_events_count(pevent);
+	all_events = tep_list_events(pevent, TEP_EVENT_SORT_ID);
 
-	while ((event = trace_find_next_event(pevent, event))) {
+	for (i = 0; all_events && i < nr_events; i++) {
+		event = all_events[i];
 		fprintf(ofp, "sub %s::%s\n{\n", event->system, event->name);
 		fprintf(ofp, "\tmy (");
 
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 5d341efc3237..93c03b39cd9c 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -1687,10 +1687,11 @@ static int python_stop_script(void)
 
 static int python_generate_script(struct tep_handle *pevent, const char *outfile)
 {
+	int i, not_first, count, nr_events;
+	struct tep_event **all_events;
 	struct tep_event *event = NULL;
 	struct tep_format_field *f;
 	char fname[PATH_MAX];
-	int not_first, count;
 	FILE *ofp;
 
 	sprintf(fname, "%s.py", outfile);
@@ -1735,7 +1736,11 @@ static int python_generate_script(struct tep_handle *pevent, const char *outfile
 	fprintf(ofp, "def trace_end():\n");
 	fprintf(ofp, "\tprint(\"in trace_end\")\n\n");
 
-	while ((event = trace_find_next_event(pevent, event))) {
+	nr_events = tep_get_events_count(pevent);
+	all_events = tep_list_events(pevent, TEP_EVENT_SORT_ID);
+
+	for (i = 0; all_events && i < nr_events; i++) {
+		event = all_events[i];
 		fprintf(ofp, "def %s__%s(", event->system, event->name);
 		fprintf(ofp, "event_name, ");
 		fprintf(ofp, "context, ");
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 5d6bfc70b210..9634f0ae57be 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -173,37 +173,6 @@ int parse_event_file(struct tep_handle *pevent,
 	return tep_parse_event(pevent, buf, size, sys);
 }
 
-struct tep_event *trace_find_next_event(struct tep_handle *pevent,
-					struct tep_event *event)
-{
-	static int idx;
-	int events_count;
-	struct tep_event *all_events;
-
-	all_events = tep_get_first_event(pevent);
-	events_count = tep_get_events_count(pevent);
-	if (!pevent || !all_events || events_count < 1)
-		return NULL;
-
-	if (!event) {
-		idx = 0;
-		return all_events;
-	}
-
-	if (idx < events_count && event == (all_events + idx)) {
-		idx++;
-		if (idx == events_count)
-			return NULL;
-		return (all_events + idx);
-	}
-
-	for (idx = 1; idx < events_count; idx++) {
-		if (event == (all_events + (idx - 1)))
-			return (all_events + idx);
-	}
-	return NULL;
-}
-
 struct flag {
 	const char *name;
 	unsigned long long value;
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 2e158387b3d7..72fdf2a3577c 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -47,8 +47,6 @@ void parse_saved_cmdline(struct tep_handle *pevent, char *file, unsigned int siz
 
 ssize_t trace_report(int fd, struct trace_event *tevent, bool repipe);
 
-struct tep_event *trace_find_next_event(struct tep_handle *pevent,
-					struct tep_event *event);
 unsigned long long read_size(struct tep_event *event, void *ptr, int size);
 unsigned long long eval_flag(const char *flag);
 



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [GIT pull] timers/urgent for v5.4-rc7
  2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
@ 2019-11-10 10:21 ` Thomas Gleixner
  2019-11-10 21:00   ` pr-tracker-bot
  2019-11-10 10:21 ` [GIT pull] perf/urgent " Thomas Gleixner
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Thomas Gleixner @ 2019-11-10 10:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, x86

Linus,

please pull the latest timers-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus

up to:  52338415cf4d: timekeeping/vsyscall: Update VDSO data unconditionally

A small set of fixes for timekeepoing and clocksource drivers:

  - VDSO data was updated conditional on the availability of a VDSO capable
    clocksource. This causes the VDSO functions which do not depend on a
    VDSO capable clocksource to operate on stale data. Always update
    unconditionally.

  - Prevent a double free in the mediatek driver

  - Use the proper helper in the sh_mtu2 driver so it won't attempt to
    initialize non-existing interrupts.

Thanks,

	tglx

------------------>
Fabien Parent (1):
      clocksource/drivers/mediatek: Fix error handling

Geert Uytterhoeven (1):
      clocksource/drivers/sh_mtu2: Do not loop using platform_get_irq_by_name()

Huacai Chen (1):
      timekeeping/vsyscall: Update VDSO data unconditionally


 arch/arm64/include/asm/vdso/vsyscall.h |  7 -------
 arch/mips/include/asm/vdso/vsyscall.h  |  7 -------
 drivers/clocksource/sh_mtu2.c          | 16 +++++++++++-----
 drivers/clocksource/timer-mediatek.c   | 10 ++--------
 include/asm-generic/vdso/vsyscall.h    |  7 -------
 kernel/time/vsyscall.c                 |  9 +++------
 6 files changed, 16 insertions(+), 40 deletions(-)

diff --git a/arch/arm64/include/asm/vdso/vsyscall.h b/arch/arm64/include/asm/vdso/vsyscall.h
index 0c731bfc7c8c..0c20a7c1bee5 100644
--- a/arch/arm64/include/asm/vdso/vsyscall.h
+++ b/arch/arm64/include/asm/vdso/vsyscall.h
@@ -30,13 +30,6 @@ int __arm64_get_clock_mode(struct timekeeper *tk)
 }
 #define __arch_get_clock_mode __arm64_get_clock_mode
 
-static __always_inline
-int __arm64_use_vsyscall(struct vdso_data *vdata)
-{
-	return !vdata[CS_HRES_COARSE].clock_mode;
-}
-#define __arch_use_vsyscall __arm64_use_vsyscall
-
 static __always_inline
 void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)
 {
diff --git a/arch/mips/include/asm/vdso/vsyscall.h b/arch/mips/include/asm/vdso/vsyscall.h
index 195314732233..00d41b94ba31 100644
--- a/arch/mips/include/asm/vdso/vsyscall.h
+++ b/arch/mips/include/asm/vdso/vsyscall.h
@@ -28,13 +28,6 @@ int __mips_get_clock_mode(struct timekeeper *tk)
 }
 #define __arch_get_clock_mode __mips_get_clock_mode
 
-static __always_inline
-int __mips_use_vsyscall(struct vdso_data *vdata)
-{
-	return (vdata[CS_HRES_COARSE].clock_mode != VDSO_CLOCK_NONE);
-}
-#define __arch_use_vsyscall __mips_use_vsyscall
-
 /* The asm-generic header needs to be included after the definitions above */
 #include <asm-generic/vdso/vsyscall.h>
 
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 354b27d14a19..62812f80b5cc 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -328,12 +328,13 @@ static int sh_mtu2_register(struct sh_mtu2_channel *ch, const char *name)
 	return 0;
 }
 
+static const unsigned int sh_mtu2_channel_offsets[] = {
+	0x300, 0x380, 0x000,
+};
+
 static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index,
 				 struct sh_mtu2_device *mtu)
 {
-	static const unsigned int channel_offsets[] = {
-		0x300, 0x380, 0x000,
-	};
 	char name[6];
 	int irq;
 	int ret;
@@ -356,7 +357,7 @@ static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index,
 		return ret;
 	}
 
-	ch->base = mtu->mapbase + channel_offsets[index];
+	ch->base = mtu->mapbase + sh_mtu2_channel_offsets[index];
 	ch->index = index;
 
 	return sh_mtu2_register(ch, dev_name(&mtu->pdev->dev));
@@ -408,7 +409,12 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
 	}
 
 	/* Allocate and setup the channels. */
-	mtu->num_channels = 3;
+	ret = platform_irq_count(pdev);
+	if (ret < 0)
+		goto err_unmap;
+
+	mtu->num_channels = min_t(unsigned int, ret,
+				  ARRAY_SIZE(sh_mtu2_channel_offsets));
 
 	mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels),
 				GFP_KERNEL);
diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
index a562f491b0f8..9318edcd8963 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -268,15 +268,12 @@ static int __init mtk_syst_init(struct device_node *node)
 
 	ret = timer_of_init(node, &to);
 	if (ret)
-		goto err;
+		return ret;
 
 	clockevents_config_and_register(&to.clkevt, timer_of_rate(&to),
 					TIMER_SYNC_TICKS, 0xffffffff);
 
 	return 0;
-err:
-	timer_of_cleanup(&to);
-	return ret;
 }
 
 static int __init mtk_gpt_init(struct device_node *node)
@@ -293,7 +290,7 @@ static int __init mtk_gpt_init(struct device_node *node)
 
 	ret = timer_of_init(node, &to);
 	if (ret)
-		goto err;
+		return ret;
 
 	/* Configure clock source */
 	mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN);
@@ -311,9 +308,6 @@ static int __init mtk_gpt_init(struct device_node *node)
 	mtk_gpt_enable_irq(&to, TIMER_CLK_EVT);
 
 	return 0;
-err:
-	timer_of_cleanup(&to);
-	return ret;
 }
 TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);
 TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);
diff --git a/include/asm-generic/vdso/vsyscall.h b/include/asm-generic/vdso/vsyscall.h
index e94b19782c92..ce4103208619 100644
--- a/include/asm-generic/vdso/vsyscall.h
+++ b/include/asm-generic/vdso/vsyscall.h
@@ -25,13 +25,6 @@ static __always_inline int __arch_get_clock_mode(struct timekeeper *tk)
 }
 #endif /* __arch_get_clock_mode */
 
-#ifndef __arch_use_vsyscall
-static __always_inline int __arch_use_vsyscall(struct vdso_data *vdata)
-{
-	return 1;
-}
-#endif /* __arch_use_vsyscall */
-
 #ifndef __arch_update_vsyscall
 static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata,
 						   struct timekeeper *tk)
diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c
index 4bc37ac3bb05..5ee0f7709410 100644
--- a/kernel/time/vsyscall.c
+++ b/kernel/time/vsyscall.c
@@ -110,8 +110,7 @@ void update_vsyscall(struct timekeeper *tk)
 	nsec		= nsec + tk->wall_to_monotonic.tv_nsec;
 	vdso_ts->sec	+= __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);
 
-	if (__arch_use_vsyscall(vdata))
-		update_vdso_data(vdata, tk);
+	update_vdso_data(vdata, tk);
 
 	__arch_update_vsyscall(vdata, tk);
 
@@ -124,10 +123,8 @@ void update_vsyscall_tz(void)
 {
 	struct vdso_data *vdata = __arch_get_k_vdso_data();
 
-	if (__arch_use_vsyscall(vdata)) {
-		vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest;
-		vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime;
-	}
+	vdata[CS_HRES_COARSE].tz_minuteswest = sys_tz.tz_minuteswest;
+	vdata[CS_HRES_COARSE].tz_dsttime = sys_tz.tz_dsttime;
 
 	__arch_sync_vdso_data(vdata);
 }



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [GIT pull] x86/urgent for v5.4-rc7
  2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
                   ` (2 preceding siblings ...)
  2019-11-10 10:21 ` [GIT pull] sched/urgent " Thomas Gleixner
@ 2019-11-10 10:21 ` Thomas Gleixner
  2019-11-10 21:00   ` pr-tracker-bot
  2019-11-10 10:21 ` [GIT pull] irq/urgent " Thomas Gleixner
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Thomas Gleixner @ 2019-11-10 10:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, x86

Linus,

please pull the latest x86-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus

up to:  63ec58b44fcc: x86/tsc: Respect tsc command line paraemeter for clocksource_tsc_early

A small set of fixes for x86:

  - Make the tsc=reliable/nowatchdog command line parameter work again. It was broken
    with the introduction of the early TSC clocksource.

  - Prevent the evaluation of exception stacks before they are set up. This
    causes a crash in dumpstack because the stack walk termination gets
    screwed up.

  - Prevent a NULL pointer dereference in the rescource control file
    system.

  - Avoid bogus warnings about APIC id mismatch related to the LDR which
    can happen when the LDR is not in use and therefore not initialized.
    Only evaluate that when the APIC is in logical destination mode.

Thanks,

	tglx

------------------>
Jan Beulich (1):
      x86/apic/32: Avoid bogus LDR warnings

Michael Zhivich (1):
      x86/tsc: Respect tsc command line paraemeter for clocksource_tsc_early

Thomas Gleixner (1):
      x86/dumpstack/64: Don't evaluate exception stacks before setup

Xiaochen Shen (1):
      x86/resctrl: Prevent NULL pointer dereference when reading mondata


 arch/x86/kernel/apic/apic.c               | 28 +++++++++++++++-------------
 arch/x86/kernel/cpu/resctrl/ctrlmondata.c |  4 ++++
 arch/x86/kernel/dumpstack_64.c            |  7 +++++++
 arch/x86/kernel/tsc.c                     |  3 +++
 4 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 9e2dd2b296cd..2b0faf86da1b 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1586,9 +1586,6 @@ static void setup_local_APIC(void)
 {
 	int cpu = smp_processor_id();
 	unsigned int value;
-#ifdef CONFIG_X86_32
-	int logical_apicid, ldr_apicid;
-#endif
 
 	if (disable_apic) {
 		disable_ioapic_support();
@@ -1626,16 +1623,21 @@ static void setup_local_APIC(void)
 	apic->init_apic_ldr();
 
 #ifdef CONFIG_X86_32
-	/*
-	 * APIC LDR is initialized.  If logical_apicid mapping was
-	 * initialized during get_smp_config(), make sure it matches the
-	 * actual value.
-	 */
-	logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
-	ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
-	WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid);
-	/* always use the value from LDR */
-	early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
+	if (apic->dest_logical) {
+		int logical_apicid, ldr_apicid;
+
+		/*
+		 * APIC LDR is initialized.  If logical_apicid mapping was
+		 * initialized during get_smp_config(), make sure it matches
+		 * the actual value.
+		 */
+		logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
+		ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
+		if (logical_apicid != BAD_APICID)
+			WARN_ON(logical_apicid != ldr_apicid);
+		/* Always use the value from LDR. */
+		early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
+	}
 #endif
 
 	/*
diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index efbd54cc4e69..055c8613b531 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -522,6 +522,10 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
 	int ret = 0;
 
 	rdtgrp = rdtgroup_kn_lock_live(of->kn);
+	if (!rdtgrp) {
+		ret = -ENOENT;
+		goto out;
+	}
 
 	md.priv = of->kn->priv;
 	resid = md.u.rid;
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 753b8cfe8b8a..87b97897a881 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -94,6 +94,13 @@ static bool in_exception_stack(unsigned long *stack, struct stack_info *info)
 	BUILD_BUG_ON(N_EXCEPTION_STACKS != 6);
 
 	begin = (unsigned long)__this_cpu_read(cea_exception_stacks);
+	/*
+	 * Handle the case where stack trace is collected _before_
+	 * cea_exception_stacks had been initialized.
+	 */
+	if (!begin)
+		return false;
+
 	end = begin + sizeof(struct cea_exception_stacks);
 	/* Bail if @stack is outside the exception stack area. */
 	if (stk < begin || stk >= end)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index c59454c382fd..7e322e2daaf5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1505,6 +1505,9 @@ void __init tsc_init(void)
 		return;
 	}
 
+	if (tsc_clocksource_reliable || no_tsc_watchdog)
+		clocksource_tsc_early.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
+
 	clocksource_register_khz(&clocksource_tsc_early, tsc_khz);
 	detect_art();
 }



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [GIT pull] sched/urgent for v5.4-rc7
  2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
  2019-11-10 10:21 ` [GIT pull] timers/urgent " Thomas Gleixner
  2019-11-10 10:21 ` [GIT pull] perf/urgent " Thomas Gleixner
@ 2019-11-10 10:21 ` Thomas Gleixner
  2019-11-10 21:00   ` pr-tracker-bot
  2019-11-10 10:21 ` [GIT pull] x86/urgent " Thomas Gleixner
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Thomas Gleixner @ 2019-11-10 10:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, x86

Linus,

please pull the latest sched-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-urgent-for-linus

up to:  6e2df0581f56: sched: Fix pick_next_task() vs 'change' pattern race

Two fixes for scheduler regressions:

   - Plug a subtle race condition which was introduced with the rework of
     the next task selection functionality. The change of task properties
     became unprotected which can be observed inconsistently causing state
     corruption.

   - A trivial compile fix for CONFIG_CGROUPS=n

Thanks,

	tglx

------------------>
Peter Zijlstra (1):
      sched: Fix pick_next_task() vs 'change' pattern race

Qais Yousef (1):
      sched/core: Fix compilation error when cgroup not selected


 kernel/sched/core.c      | 23 ++++++++++++++++-------
 kernel/sched/deadline.c  | 40 ++++++++++++++++++++--------------------
 kernel/sched/fair.c      | 15 ++++++++++++---
 kernel/sched/idle.c      |  9 ++++++++-
 kernel/sched/rt.c        | 37 +++++++++++++++++++------------------
 kernel/sched/sched.h     | 30 +++++++++++++++++++++++++++---
 kernel/sched/stop_task.c | 18 +++++++++++-------
 7 files changed, 113 insertions(+), 59 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index dd05a378631a..0f2eb3629070 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1073,6 +1073,7 @@ uclamp_update_active(struct task_struct *p, enum uclamp_id clamp_id)
 	task_rq_unlock(rq, p, &rf);
 }
 
+#ifdef CONFIG_UCLAMP_TASK_GROUP
 static inline void
 uclamp_update_active_tasks(struct cgroup_subsys_state *css,
 			   unsigned int clamps)
@@ -1091,7 +1092,6 @@ uclamp_update_active_tasks(struct cgroup_subsys_state *css,
 	css_task_iter_end(&it);
 }
 
-#ifdef CONFIG_UCLAMP_TASK_GROUP
 static void cpu_util_update_eff(struct cgroup_subsys_state *css);
 static void uclamp_update_root_tg(void)
 {
@@ -3929,13 +3929,22 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
 	}
 
 restart:
+#ifdef CONFIG_SMP
 	/*
-	 * Ensure that we put DL/RT tasks before the pick loop, such that they
-	 * can PULL higher prio tasks when we lower the RQ 'priority'.
+	 * We must do the balancing pass before put_next_task(), such
+	 * that when we release the rq->lock the task is in the same
+	 * state as before we took rq->lock.
+	 *
+	 * We can terminate the balance pass as soon as we know there is
+	 * a runnable task of @class priority or higher.
 	 */
-	prev->sched_class->put_prev_task(rq, prev, rf);
-	if (!rq->nr_running)
-		newidle_balance(rq, rf);
+	for_class_range(class, prev->sched_class, &idle_sched_class) {
+		if (class->balance(rq, prev, rf))
+			break;
+	}
+#endif
+
+	put_prev_task(rq, prev);
 
 	for_each_class(class) {
 		p = class->pick_next_task(rq, NULL, NULL);
@@ -6201,7 +6210,7 @@ static struct task_struct *__pick_migrate_task(struct rq *rq)
 	for_each_class(class) {
 		next = class->pick_next_task(rq, NULL, NULL);
 		if (next) {
-			next->sched_class->put_prev_task(rq, next, NULL);
+			next->sched_class->put_prev_task(rq, next);
 			return next;
 		}
 	}
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 2dc48720f189..a8a08030a8f7 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1691,6 +1691,22 @@ static void check_preempt_equal_dl(struct rq *rq, struct task_struct *p)
 	resched_curr(rq);
 }
 
+static int balance_dl(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
+{
+	if (!on_dl_rq(&p->dl) && need_pull_dl_task(rq, p)) {
+		/*
+		 * This is OK, because current is on_cpu, which avoids it being
+		 * picked for load-balance and preemption/IRQs are still
+		 * disabled avoiding further scheduler activity on it and we've
+		 * not yet started the picking loop.
+		 */
+		rq_unpin_lock(rq, rf);
+		pull_dl_task(rq);
+		rq_repin_lock(rq, rf);
+	}
+
+	return sched_stop_runnable(rq) || sched_dl_runnable(rq);
+}
 #endif /* CONFIG_SMP */
 
 /*
@@ -1758,45 +1774,28 @@ static struct task_struct *
 pick_next_task_dl(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
 {
 	struct sched_dl_entity *dl_se;
+	struct dl_rq *dl_rq = &rq->dl;
 	struct task_struct *p;
-	struct dl_rq *dl_rq;
 
 	WARN_ON_ONCE(prev || rf);
 
-	dl_rq = &rq->dl;
-
-	if (unlikely(!dl_rq->dl_nr_running))
+	if (!sched_dl_runnable(rq))
 		return NULL;
 
 	dl_se = pick_next_dl_entity(rq, dl_rq);
 	BUG_ON(!dl_se);
-
 	p = dl_task_of(dl_se);
-
 	set_next_task_dl(rq, p);
-
 	return p;
 }
 
-static void put_prev_task_dl(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
+static void put_prev_task_dl(struct rq *rq, struct task_struct *p)
 {
 	update_curr_dl(rq);
 
 	update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 1);
 	if (on_dl_rq(&p->dl) && p->nr_cpus_allowed > 1)
 		enqueue_pushable_dl_task(rq, p);
-
-	if (rf && !on_dl_rq(&p->dl) && need_pull_dl_task(rq, p)) {
-		/*
-		 * This is OK, because current is on_cpu, which avoids it being
-		 * picked for load-balance and preemption/IRQs are still
-		 * disabled avoiding further scheduler activity on it and we've
-		 * not yet started the picking loop.
-		 */
-		rq_unpin_lock(rq, rf);
-		pull_dl_task(rq);
-		rq_repin_lock(rq, rf);
-	}
 }
 
 /*
@@ -2442,6 +2441,7 @@ const struct sched_class dl_sched_class = {
 	.set_next_task		= set_next_task_dl,
 
 #ifdef CONFIG_SMP
+	.balance		= balance_dl,
 	.select_task_rq		= select_task_rq_dl,
 	.migrate_task_rq	= migrate_task_rq_dl,
 	.set_cpus_allowed       = set_cpus_allowed_dl,
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 682a754ea3e1..22a2fed29054 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6570,6 +6570,15 @@ static void task_dead_fair(struct task_struct *p)
 {
 	remove_entity_load_avg(&p->se);
 }
+
+static int
+balance_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
+{
+	if (rq->nr_running)
+		return 1;
+
+	return newidle_balance(rq, rf) != 0;
+}
 #endif /* CONFIG_SMP */
 
 static unsigned long wakeup_gran(struct sched_entity *se)
@@ -6746,7 +6755,7 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
 	int new_tasks;
 
 again:
-	if (!cfs_rq->nr_running)
+	if (!sched_fair_runnable(rq))
 		goto idle;
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
@@ -6884,7 +6893,7 @@ done: __maybe_unused;
 /*
  * Account for a descheduled task:
  */
-static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
+static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
 {
 	struct sched_entity *se = &prev->se;
 	struct cfs_rq *cfs_rq;
@@ -10414,11 +10423,11 @@ const struct sched_class fair_sched_class = {
 	.check_preempt_curr	= check_preempt_wakeup,
 
 	.pick_next_task		= pick_next_task_fair,
-
 	.put_prev_task		= put_prev_task_fair,
 	.set_next_task          = set_next_task_fair,
 
 #ifdef CONFIG_SMP
+	.balance		= balance_fair,
 	.select_task_rq		= select_task_rq_fair,
 	.migrate_task_rq	= migrate_task_rq_fair,
 
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index 8dad5aa600ea..f65ef1e2f204 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -365,6 +365,12 @@ select_task_rq_idle(struct task_struct *p, int cpu, int sd_flag, int flags)
 {
 	return task_cpu(p); /* IDLE tasks as never migrated */
 }
+
+static int
+balance_idle(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
+{
+	return WARN_ON_ONCE(1);
+}
 #endif
 
 /*
@@ -375,7 +381,7 @@ static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p, int fl
 	resched_curr(rq);
 }
 
-static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
+static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
 {
 }
 
@@ -460,6 +466,7 @@ const struct sched_class idle_sched_class = {
 	.set_next_task          = set_next_task_idle,
 
 #ifdef CONFIG_SMP
+	.balance		= balance_idle,
 	.select_task_rq		= select_task_rq_idle,
 	.set_cpus_allowed	= set_cpus_allowed_common,
 #endif
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index ebaa4e619684..9b8adc01be3d 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1469,6 +1469,22 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
 	resched_curr(rq);
 }
 
+static int balance_rt(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
+{
+	if (!on_rt_rq(&p->rt) && need_pull_rt_task(rq, p)) {
+		/*
+		 * This is OK, because current is on_cpu, which avoids it being
+		 * picked for load-balance and preemption/IRQs are still
+		 * disabled avoiding further scheduler activity on it and we've
+		 * not yet started the picking loop.
+		 */
+		rq_unpin_lock(rq, rf);
+		pull_rt_task(rq);
+		rq_repin_lock(rq, rf);
+	}
+
+	return sched_stop_runnable(rq) || sched_dl_runnable(rq) || sched_rt_runnable(rq);
+}
 #endif /* CONFIG_SMP */
 
 /*
@@ -1552,21 +1568,18 @@ static struct task_struct *
 pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
 {
 	struct task_struct *p;
-	struct rt_rq *rt_rq = &rq->rt;
 
 	WARN_ON_ONCE(prev || rf);
 
-	if (!rt_rq->rt_queued)
+	if (!sched_rt_runnable(rq))
 		return NULL;
 
 	p = _pick_next_task_rt(rq);
-
 	set_next_task_rt(rq, p);
-
 	return p;
 }
 
-static void put_prev_task_rt(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
+static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
 {
 	update_curr_rt(rq);
 
@@ -1578,18 +1591,6 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p, struct rq_fla
 	 */
 	if (on_rt_rq(&p->rt) && p->nr_cpus_allowed > 1)
 		enqueue_pushable_task(rq, p);
-
-	if (rf && !on_rt_rq(&p->rt) && need_pull_rt_task(rq, p)) {
-		/*
-		 * This is OK, because current is on_cpu, which avoids it being
-		 * picked for load-balance and preemption/IRQs are still
-		 * disabled avoiding further scheduler activity on it and we've
-		 * not yet started the picking loop.
-		 */
-		rq_unpin_lock(rq, rf);
-		pull_rt_task(rq);
-		rq_repin_lock(rq, rf);
-	}
 }
 
 #ifdef CONFIG_SMP
@@ -2366,8 +2367,8 @@ const struct sched_class rt_sched_class = {
 	.set_next_task          = set_next_task_rt,
 
 #ifdef CONFIG_SMP
+	.balance		= balance_rt,
 	.select_task_rq		= select_task_rq_rt,
-
 	.set_cpus_allowed       = set_cpus_allowed_common,
 	.rq_online              = rq_online_rt,
 	.rq_offline             = rq_offline_rt,
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 0db2c1b3361e..c8870c5bd7df 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1727,10 +1727,11 @@ struct sched_class {
 	struct task_struct * (*pick_next_task)(struct rq *rq,
 					       struct task_struct *prev,
 					       struct rq_flags *rf);
-	void (*put_prev_task)(struct rq *rq, struct task_struct *p, struct rq_flags *rf);
+	void (*put_prev_task)(struct rq *rq, struct task_struct *p);
 	void (*set_next_task)(struct rq *rq, struct task_struct *p);
 
 #ifdef CONFIG_SMP
+	int (*balance)(struct rq *rq, struct task_struct *prev, struct rq_flags *rf);
 	int  (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags);
 	void (*migrate_task_rq)(struct task_struct *p, int new_cpu);
 
@@ -1773,7 +1774,7 @@ struct sched_class {
 static inline void put_prev_task(struct rq *rq, struct task_struct *prev)
 {
 	WARN_ON_ONCE(rq->curr != prev);
-	prev->sched_class->put_prev_task(rq, prev, NULL);
+	prev->sched_class->put_prev_task(rq, prev);
 }
 
 static inline void set_next_task(struct rq *rq, struct task_struct *next)
@@ -1787,8 +1788,12 @@ static inline void set_next_task(struct rq *rq, struct task_struct *next)
 #else
 #define sched_class_highest (&dl_sched_class)
 #endif
+
+#define for_class_range(class, _from, _to) \
+	for (class = (_from); class != (_to); class = class->next)
+
 #define for_each_class(class) \
-   for (class = sched_class_highest; class; class = class->next)
+	for_class_range(class, sched_class_highest, NULL)
 
 extern const struct sched_class stop_sched_class;
 extern const struct sched_class dl_sched_class;
@@ -1796,6 +1801,25 @@ extern const struct sched_class rt_sched_class;
 extern const struct sched_class fair_sched_class;
 extern const struct sched_class idle_sched_class;
 
+static inline bool sched_stop_runnable(struct rq *rq)
+{
+	return rq->stop && task_on_rq_queued(rq->stop);
+}
+
+static inline bool sched_dl_runnable(struct rq *rq)
+{
+	return rq->dl.dl_nr_running > 0;
+}
+
+static inline bool sched_rt_runnable(struct rq *rq)
+{
+	return rq->rt.rt_queued > 0;
+}
+
+static inline bool sched_fair_runnable(struct rq *rq)
+{
+	return rq->cfs.nr_running > 0;
+}
 
 #ifdef CONFIG_SMP
 
diff --git a/kernel/sched/stop_task.c b/kernel/sched/stop_task.c
index 7e1cee4e65b2..c0640739e05e 100644
--- a/kernel/sched/stop_task.c
+++ b/kernel/sched/stop_task.c
@@ -15,6 +15,12 @@ select_task_rq_stop(struct task_struct *p, int cpu, int sd_flag, int flags)
 {
 	return task_cpu(p); /* stop tasks as never migrate */
 }
+
+static int
+balance_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
+{
+	return sched_stop_runnable(rq);
+}
 #endif /* CONFIG_SMP */
 
 static void
@@ -31,16 +37,13 @@ static void set_next_task_stop(struct rq *rq, struct task_struct *stop)
 static struct task_struct *
 pick_next_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
 {
-	struct task_struct *stop = rq->stop;
-
 	WARN_ON_ONCE(prev || rf);
 
-	if (!stop || !task_on_rq_queued(stop))
+	if (!sched_stop_runnable(rq))
 		return NULL;
 
-	set_next_task_stop(rq, stop);
-
-	return stop;
+	set_next_task_stop(rq, rq->stop);
+	return rq->stop;
 }
 
 static void
@@ -60,7 +63,7 @@ static void yield_task_stop(struct rq *rq)
 	BUG(); /* the stop task should never yield, its pointless. */
 }
 
-static void put_prev_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
+static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)
 {
 	struct task_struct *curr = rq->curr;
 	u64 delta_exec;
@@ -129,6 +132,7 @@ const struct sched_class stop_sched_class = {
 	.set_next_task          = set_next_task_stop,
 
 #ifdef CONFIG_SMP
+	.balance		= balance_stop,
 	.select_task_rq		= select_task_rq_stop,
 	.set_cpus_allowed	= set_cpus_allowed_common,
 #endif



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [GIT pull] core/urgent for v5.4-rc7
  2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
                   ` (4 preceding siblings ...)
  2019-11-10 10:21 ` [GIT pull] irq/urgent " Thomas Gleixner
@ 2019-11-10 21:00 ` pr-tracker-bot
  2019-11-10 22:00 ` Joe Perches
  6 siblings, 0 replies; 17+ messages in thread
From: pr-tracker-bot @ 2019-11-10 21:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Linus Torvalds, linux-kernel, x86

The pull request you sent on Sun, 10 Nov 2019 10:21:53 -0000:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/20c7e29684bfe88bfc5f0c7bf60833116bf5e89f

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] irq/urgent for v5.4-rc7
  2019-11-10 10:21 ` [GIT pull] irq/urgent " Thomas Gleixner
@ 2019-11-10 21:00   ` pr-tracker-bot
  0 siblings, 0 replies; 17+ messages in thread
From: pr-tracker-bot @ 2019-11-10 21:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Linus Torvalds, linux-kernel, x86

The pull request you sent on Sun, 10 Nov 2019 10:21:53 -0000:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ffba65ea247bb4193d4990324f5bcc76e8b5a7e7

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] perf/urgent for v5.4-rc7
  2019-11-10 10:21 ` [GIT pull] perf/urgent " Thomas Gleixner
@ 2019-11-10 21:00   ` pr-tracker-bot
  0 siblings, 0 replies; 17+ messages in thread
From: pr-tracker-bot @ 2019-11-10 21:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Linus Torvalds, linux-kernel, x86

The pull request you sent on Sun, 10 Nov 2019 10:21:53 -0000:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/b584a17628b0bf4b04ceba066dd1a69c5f097276

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] timers/urgent for v5.4-rc7
  2019-11-10 10:21 ` [GIT pull] timers/urgent " Thomas Gleixner
@ 2019-11-10 21:00   ` pr-tracker-bot
  0 siblings, 0 replies; 17+ messages in thread
From: pr-tracker-bot @ 2019-11-10 21:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Linus Torvalds, linux-kernel, x86

The pull request you sent on Sun, 10 Nov 2019 10:21:53 -0000:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/621084cd3d8cb31aa43a3e4cc37e27e3ddaab561

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] x86/urgent for v5.4-rc7
  2019-11-10 10:21 ` [GIT pull] x86/urgent " Thomas Gleixner
@ 2019-11-10 21:00   ` pr-tracker-bot
  0 siblings, 0 replies; 17+ messages in thread
From: pr-tracker-bot @ 2019-11-10 21:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Linus Torvalds, linux-kernel, x86

The pull request you sent on Sun, 10 Nov 2019 10:21:53 -0000:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/9805a68371ce01eee3d8491ee2d93f1aa4a4da52

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] sched/urgent for v5.4-rc7
  2019-11-10 10:21 ` [GIT pull] sched/urgent " Thomas Gleixner
@ 2019-11-10 21:00   ` pr-tracker-bot
  0 siblings, 0 replies; 17+ messages in thread
From: pr-tracker-bot @ 2019-11-10 21:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Linus Torvalds, linux-kernel, x86

The pull request you sent on Sun, 10 Nov 2019 10:21:53 -0000:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-urgent-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/81388c2b3fb16972c699aab8a4f80ba85d0f9360

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] core/urgent for v5.4-rc7
  2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
                   ` (5 preceding siblings ...)
  2019-11-10 21:00 ` [GIT pull] core/urgent " pr-tracker-bot
@ 2019-11-10 22:00 ` Joe Perches
  2019-11-10 22:35   ` Linus Torvalds
  6 siblings, 1 reply; 17+ messages in thread
From: Joe Perches @ 2019-11-10 22:00 UTC (permalink / raw)
  To: Thomas Gleixner, Linus Torvalds, Jiri Slaby; +Cc: linux-kernel, x86

On Sun, 2019-11-10 at 10:21 +0000, Thomas Gleixner wrote:
> A small fix for a stacktrace regression. Saving a stacktrace for a foreign
> task skipped an extra entry which makes e.g. the output of /proc/$PID/stack
> incomplete.
[]
> ------------------>
> Jiri Slaby (1):
>       stacktrace: Don't skip first entry on noncurrent tasks
[]
> diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
[]
> @@ -141,7 +141,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store,
>  	struct stacktrace_cookie c = {
>  		.store	= store,
>  		.size	= size,
> -		.skip	= skipnr + 1,
> +		/* skip this function if they are tracing us */
> +		.skip	= skipnr + !!(current == tsk),

trivia:

This idiom '!!(logical test)' is odd and redundant.
Logical test result is already 0 or 1, no !! is unnecessary.

>  	};
>  
>  	if (!try_get_task_stack(tsk))
> @@ -298,7 +299,8 @@ unsigned int stack_trace_save_tsk(struct task_struct *task,
>  	struct stack_trace trace = {
>  		.entries	= store,
>  		.max_entries	= size,
> -		.skip		= skipnr + 1,
> +		/* skip this function if they are tracing us */
> +		.skip	= skipnr + !!(current == task),
>  	};
>  
>  	save_stack_trace_tsk(task, &trace);
> 
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] core/urgent for v5.4-rc7
  2019-11-10 22:00 ` Joe Perches
@ 2019-11-10 22:35   ` Linus Torvalds
  2019-11-11  1:50     ` Joe Perches
  0 siblings, 1 reply; 17+ messages in thread
From: Linus Torvalds @ 2019-11-10 22:35 UTC (permalink / raw)
  To: Joe Perches
  Cc: Thomas Gleixner, Jiri Slaby, Linux Kernel Mailing List,
	the arch/x86 maintainers

On Sun, Nov 10, 2019 at 2:01 PM Joe Perches <joe@perches.com> wrote:
>
> trivia:
>
> This idiom '!!(logical test)' is odd and redundant.
> Logical test result is already 0 or 1, no !! is unnecessary.

You are of course correct.

I have to say, I personally have always disliked the idiomatic C "!!"
pattern. I don't think it reads well, although that's probably "C
cultural" - once you are used to the pattern, you don't think of it as
anything else.

Personally, I prefer "x != 0" over "!!x" since it reads much better to
a human, and is equally legible whether you're used to the !! pattern
or not.

C is not perl, the Obfuscated C contest not-withstanding.

And since modern C has bool, if you really want to use a cast-to-bool
instead of "x != 0", I think doing exactly that is preferable to "!!".

So I think both "x != 0" and "(bool)x" are preferable to "!!x", and
would also have made it obvious how odd and redundant the test was in
this case.

But "!!x" is shorter, of course. And it you learnt C with that pattern
it looks obvious.

                Linus

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] core/urgent for v5.4-rc7
  2019-11-10 22:35   ` Linus Torvalds
@ 2019-11-11  1:50     ` Joe Perches
  2019-11-11 17:12       ` Linus Torvalds
  0 siblings, 1 reply; 17+ messages in thread
From: Joe Perches @ 2019-11-11  1:50 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, Jiri Slaby, Linux Kernel Mailing List,
	the arch/x86 maintainers

On Sun, 2019-11-10 at 14:35 -0800, Linus Torvalds wrote:
> On Sun, Nov 10, 2019 at 2:01 PM Joe Perches <joe@perches.com> wrote:
> > trivia:
> > 
> > This idiom '!!(logical test)' is odd and redundant.
> > Logical test result is already 0 or 1, no !! is unnecessary.
> 
> You are of course correct.
> 
> I have to say, I personally have always disliked the idiomatic C "!!"
> pattern. I don't think it reads well, although that's probably "C
> cultural" - once you are used to the pattern, you don't think of it as
> anything else.
> 
> Personally, I prefer "x != 0" over "!!x" since it reads much better to
> a human, and is equally legible whether you're used to the !! pattern
> or not.
> 
> C is not perl, the Obfuscated C contest not-withstanding.
> 
> And since modern C has bool, if you really want to use a cast-to-bool
> instead of "x != 0", I think doing exactly that is preferable to "!!".
> 
> So I think both "x != 0" and "(bool)x" are preferable to "!!x", and
> would also have made it obvious how odd and redundant the test was in
> this case.
> 
> But "!!x" is shorter, of course. And it you learnt C with that pattern
> it looks obvious.

The !! logical usage is not particularly common in the kernel.
There seems to be only a couple/few dozen.

$ git grep -P '\!\!\s*\([^\)]+[\!=]=.*\);'
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c:     info->realtek_eDPToLVDS = !!(lvds->dplvdsrxid == eDP_TO_LVDS_REALTEK_ID);
drivers/iio/resolver/ad2s1200.c:                gpiod_set_value(st->rdvel, !!(chan->type == IIO_ANGL));
drivers/infiniband/hw/mlx5/mr.c:        MLX5_SET(mkc, mkc, en_rinval, !!((type == IB_MW_TYPE_2)));
drivers/leds/leds-max77693.c:   *state = !!(*state && (led->strobing_sub_led_id == sub_led->fled_id));
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     return !!(mfw_val == DCBX_APP_SF_IEEE_ETHTYPE);
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     return !!(mfw_val == type || mfw_val == DCBX_APP_SF_IEEE_TCP_UDP_PORT);
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     return !!(ethtype && (proto_id == QED_ETH_TYPE_DEFAULT));
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     return !!(port && (proto_id == QED_TCP_PORT_ISCSI));
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     return !!(ethtype && (proto_id == QED_ETH_TYPE_FCOE));
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     return !!(ethtype && (proto_id == QED_ETH_TYPE_ROCE));
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     return !!(port && (proto_id == QED_UDP_PORT_TYPE_ROCE_V2));
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     ethtype = !!(idtype == DCB_APP_IDTYPE_ETHTYPE);
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:     ethtype = !!(idtype == DCB_APP_IDTYPE_ETHTYPE);
drivers/net/wireless/ath/ath9k/recv.c:  is_40 = !!(rxs->bw == RATE_INFO_BW_40);
drivers/pci/controller/pcie-iproc.c:    return !!(reg_offset == IPROC_PCIE_REG_INVALID);
drivers/pci/controller/pcie-iproc.c:    return !!(ib_map->type == type);
drivers/pci/hotplug/pnv_php.c:          added = !!(presence == OPAL_PCI_SLOT_PRESENT);
drivers/platform/x86/asus-wmi.c:                ctrl_param = !!(bd->props.power == FB_BLANK_UNBLANK);
drivers/scsi/hisi_sas/hisi_sas_main.c:          bool do_port_check = !!(_sas_port != sas_port);
fs/ocfs2/reservations.c:        return !!(resv->r_len == 0);
fs/ubifs/journal.c:     int last_reference = !!(deletion && inode->i_nlink == 0);
fs/ubifs/journal.c:     int last_reference = !!(new_inode && new_inode->i_nlink == 0);
sound/firewire/amdtp-stream.c:          !!(params->header_length == 0 && params->payload_length == 0);
tools/perf/util/time-utils.c:           num += !!(*cp == ',');




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] core/urgent for v5.4-rc7
  2019-11-11  1:50     ` Joe Perches
@ 2019-11-11 17:12       ` Linus Torvalds
  2019-11-12  1:37         ` Joe Perches
  0 siblings, 1 reply; 17+ messages in thread
From: Linus Torvalds @ 2019-11-11 17:12 UTC (permalink / raw)
  To: Joe Perches
  Cc: Thomas Gleixner, Jiri Slaby, Linux Kernel Mailing List,
	the arch/x86 maintainers

On Sun, Nov 10, 2019 at 5:50 PM Joe Perches <joe@perches.com> wrote:
>
> The !! logical usage is not particularly common in the kernel.
> There seems to be only a couple/few dozen.

Your grep pattern is for the explicitly silly "turn a boolean to a
boolean". That should certainly be rare.

But I meant it in a more general way - there's a lot of common use of
"!!" for "turn this expression into a boolean". A trivial grep for
that (didn't check how correct it was - there might be comments that
are very excited too) implies that we have a fair amount of this
pattern:

    $ git grep '[^!]!![^!]' -- '*.[ch]' | wc -l
    7007

so the '!!' pattern itself isn't rare.

It's so common that the fact that people then occasionally get
confused and over-use it a bit in contexts where it's already boolean
isn't so surprising.

Personally, I still find that pattern non-intuitive, even when used
correctly. Double negatives aren't considered good in English, I don't
find it all that natural in C either.

But it's a pattern, it's idiomatic, and it's certainly not worth
forcing my own personal quirk on other people, so I won't accept
scripted patches to change it.

The one pattern I _really_ hate is the thing that some people are
taught to do: using "5 == x" instead of "x == 5" because it really
reads completely bogusly to me. Some people are taught that pattern
because it minimizes the risk of confusion between "==" and "=", and I
think that's completely wrong-headed.

Trying to teach people to write illegible code just to catch a syntax
error is crazy. You're "fixing" the wrong thing.

Oh well. We have a couple of those in the kernel too.  And I'm not
going to enforce my personal quirks there either, even if I'm
ClearlyRight(tm) and hold the OnlyCorrectOpinion(tm) in this matter.

                   Linus

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [GIT pull] core/urgent for v5.4-rc7
  2019-11-11 17:12       ` Linus Torvalds
@ 2019-11-12  1:37         ` Joe Perches
  0 siblings, 0 replies; 17+ messages in thread
From: Joe Perches @ 2019-11-12  1:37 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, Jiri Slaby, Linux Kernel Mailing List,
	the arch/x86 maintainers

On Mon, 2019-11-11 at 09:12 -0800, Linus Torvalds wrote:
> On Sun, Nov 10, 2019 at 5:50 PM Joe Perches <joe@perches.com> wrote:
> > The !! logical usage is not particularly common in the kernel.
> > There seems to be only a couple/few dozen.
> 
> Your grep pattern is for the explicitly silly "turn a boolean to a
> boolean". That should certainly be rare.
> 
> But I meant it in a more general way - there's a lot of common use of
> "!!" for "turn this expression into a boolean". A trivial grep for
> that (didn't check how correct it was - there might be comments that
> are very excited too) implies that we have a fair amount of this
> pattern:
> 
>     $ git grep '[^!]!![^!]' -- '*.[ch]' | wc -l
>     7007

Likely the majority of those are bit comparison coercions to 0/1 like

	int val = !!(A & B)

> so the '!!' pattern itself isn't rare.

And likely these !! patterns are preferred to (A & B) != 0

I don't care much either way as either form, unlike !!(A == B),
is not redundant.



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-11-12  1:37 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
2019-11-10 10:21 ` [GIT pull] timers/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] perf/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] sched/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] x86/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] irq/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 21:00 ` [GIT pull] core/urgent " pr-tracker-bot
2019-11-10 22:00 ` Joe Perches
2019-11-10 22:35   ` Linus Torvalds
2019-11-11  1:50     ` Joe Perches
2019-11-11 17:12       ` Linus Torvalds
2019-11-12  1:37         ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).