Skip to contentSkip to conversation

EFI fix for 5.6-rc1

GIT PULL Merged Thomas Gleixner 4 participants 16 messages Feb 9, 2020

Subsystems (14)
Arm (32-bit) x86 perf events arm64 +10 more subsystems
lore
Share & tools
lore
#0 lore raw

Linus,

please pull the latest efi/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-2020-02-09

up to: 59365cadfbcd: efi/x86: Fix boot regression on systems with invalid memmap entries

A single fix for a EFI boot regression on X86 which was caused by the recent rework of the EFI memory map parsing. On systems with invalid memmap entries the cleanup function uses an value which cannot be relied on in this stage. Use the actual EFI memmap entry instead.

Thanks,

tglx

------------------>
Ard Biesheuvel (1):
efi/x86: Fix boot regression on systems with invalid memmap entries

 arch/x86/platform/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/efi/efi.c +1 -1
index 59f7f6d60cf6..ae923ee8e2b4 100644
@@ -308,7 +308,7 @@ static void __init efi_clean_memmap(void)
 			.phys_map = efi.memmap.phys_map,
 			.desc_version = efi.memmap.desc_version,
 			.desc_size = efi.memmap.desc_size,
-			.size = data.desc_size * (efi.memmap.nr_map - n_removal),
+			.size = efi.memmap.desc_size * (efi.memmap.nr_map - n_removal),
 			.flags = 0,
 		};
 
#1 lore raw

[GIT pull] perf fixes for 5.6-rc1

Linus,

please pull the latest perf/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2020-02-09

up to: 45f035748b2a: Merge tag 'perf-core-for-mingo-5.6-20200201' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

A set of fixes and improvements for the perf subsystem:

- Kernel fixes:

- Install cgroup events to the correct CPU context to prevent a potential list double add

- Prevent am intgeer underflow in the perf mlock acounting

- Add a missing prototyp for arch_perf_update_userpage()

- Tooling:

- Add a missing unlock in the error path of maps__insert() in perf maps.

- Fix the build with the latest libbfd

- Fix the perf parser so it does not delete parse event terms, which caused a regression for using perf with the ARM CoreSight as the sink confuguration was missing due to the deletion.

- Fix the double free in the perf CPU map merging test case

- Add the missing ustring support for the perf probe command

Thanks,

tglx

------------------>
Benjamin Thiel (1):
kernel/events: Add a missing prototype for arch_perf_update_userpage()

Cengiz Can (1):
perf maps: Add missing unlock to maps__insert() error case

Changbin Du (1):
perf: Make perf able to build with latest libbfd

Leo Yan (2):
perf parse: Refactor 'struct perf_evsel_config_term' perf parse: Copy string to perf_evsel_config_term

Song Liu (2):
perf/core: Fix mlock accounting in perf_mmap() perf/cgroups: Install cgroup events to correct cpuctx

Thomas Richter (2):
perf test: Fix test case Merge cpu map
perf probe: Add ustring support for perf probe command

 include/linux/perf_event.h        |  4 +++
 kernel/events/core.c              | 17 +++++++---
 tools/perf/arch/arm/util/cs-etm.c |  2 +-
 tools/perf/tests/cpumap.c         |  1 -
 tools/perf/util/evsel.c           |  8 +++--
 tools/perf/util/evsel_config.h    |  5 ++-
 tools/perf/util/map.c             |  1 +
 tools/perf/util/parse-events.c    | 67 ++++++++++++++++++++++++++-------------
 tools/perf/util/probe-finder.c    |  3 +-
 tools/perf/util/srcline.c         | 16 +++++++++-
 10 files changed, 88 insertions(+), 36 deletions(-)
include/linux/perf_event.h +4 -0
index 6d4c22aee384..52928e089bc7 100644
@@ -1544,4 +1544,8 @@ int perf_event_exit_cpu(unsigned int cpu);
 #define perf_event_exit_cpu	NULL
 #endif
 
+extern void __weak arch_perf_update_userpage(struct perf_event *event,
+					     struct perf_event_mmap_page *userpg,
+					     u64 now);
+
 #endif /* _LINUX_PERF_EVENT_H */
kernel/events/core.c +13 -4
index 2173c23c25b4..fdb7f7ef380c 100644
@@ -951,9 +951,9 @@ list_update_cgroup_event(struct perf_event *event,
 
 	/*
 	 * Because cgroup events are always per-cpu events,
-	 * this will always be called from the right CPU.
+	 * @ctx == &cpuctx->ctx.
 	 */
-	cpuctx = __get_cpu_context(ctx);
+	cpuctx = container_of(ctx, struct perf_cpu_context, ctx);
 
 	/*
 	 * Since setting cpuctx->cgrp is conditional on the current @cgrp
@@ -979,7 +979,8 @@ list_update_cgroup_event(struct perf_event *event,
 
 	cpuctx_entry = &cpuctx->cgrp_cpuctx_entry;
 	if (add)
-		list_add(cpuctx_entry, this_cpu_ptr(&cgrp_cpuctx_list));
+		list_add(cpuctx_entry,
+			 per_cpu_ptr(&cgrp_cpuctx_list, event->cpu));
 	else
 		list_del(cpuctx_entry);
 }
@@ -5916,7 +5917,15 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
 	 */
 	user_lock_limit *= num_online_cpus();
 
-	user_locked = atomic_long_read(&user->locked_vm) + user_extra;
+	user_locked = atomic_long_read(&user->locked_vm);
+
+	/*
+	 * sysctl_perf_event_mlock may have changed, so that
+	 *     user->locked_vm > user_lock_limit
+	 */
+	if (user_locked > user_lock_limit)
+		user_locked = user_lock_limit;
+	user_locked += user_extra;
 
 	if (user_locked > user_lock_limit) {
 		/*
tools/perf/arch/arm/util/cs-etm.c +1 -1
index ede040cf82ad..2898cfdf8fe1 100644
@@ -226,7 +226,7 @@ static int cs_etm_set_sink_attr(struct perf_pmu *pmu,
 		if (term->type != PERF_EVSEL__CONFIG_TERM_DRV_CFG)
 			continue;
 
-		sink = term->val.drv_cfg;
+		sink = term->val.str;
 		snprintf(path, PATH_MAX, "sinks/%s", sink);
 
 		ret = perf_pmu__scan_file(pmu, path, "%x", &hash);
tools/perf/tests/cpumap.c +0 -1
index 4ac56741ac5f..29c793ac7d10 100644
@@ -131,7 +131,6 @@ int test__cpu_map_merge(struct test *test __maybe_unused, int subtest __maybe_un
 	TEST_ASSERT_VAL("failed to merge map: bad nr", c->nr == 5);
 	cpu_map__snprint(c, buf, sizeof(buf));
 	TEST_ASSERT_VAL("failed to merge map: bad result", !strcmp(buf, "1-2,4-5,7"));
-	perf_cpu_map__put(a);
 	perf_cpu_map__put(b);
 	perf_cpu_map__put(c);
 	return 0;
tools/perf/util/evsel.c +5 -3
index a69e64236120..c8dc4450884c 100644
@@ -808,12 +808,12 @@ static void apply_config_terms(struct evsel *evsel,
 				perf_evsel__reset_sample_bit(evsel, TIME);
 			break;
 		case PERF_EVSEL__CONFIG_TERM_CALLGRAPH:
-			callgraph_buf = term->val.callgraph;
+			callgraph_buf = term->val.str;
 			break;
 		case PERF_EVSEL__CONFIG_TERM_BRANCH:
-			if (term->val.branch && strcmp(term->val.branch, "no")) {
+			if (term->val.str && strcmp(term->val.str, "no")) {
 				perf_evsel__set_sample_bit(evsel, BRANCH_STACK);
-				parse_branch_str(term->val.branch,
+				parse_branch_str(term->val.str,
 						 &attr->branch_sample_type);
 			} else
 				perf_evsel__reset_sample_bit(evsel, BRANCH_STACK);
@@ -1265,6 +1265,8 @@ static void perf_evsel__free_config_terms(struct evsel *evsel)
 
 	list_for_each_entry_safe(term, h, &evsel->config_terms, list) {
 		list_del_init(&term->list);
+		if (term->free_str)
+			zfree(&term->val.str);
 		free(term);
 	}
 }
tools/perf/util/evsel_config.h +2 -3
index 1f8d2fe0b66e..e026ab67b008 100644
@@ -32,22 +32,21 @@ enum evsel_term_type {
 struct perf_evsel_config_term {
 	struct list_head      list;
 	enum evsel_term_type  type;
+	bool		      free_str;
 	union {
 		u64	      period;
 		u64	      freq;
 		bool	      time;
-		char	      *callgraph;
-		char	      *drv_cfg;
 		u64	      stack_user;
 		int	      max_stack;
 		bool	      inherit;
 		bool	      overwrite;
-		char	      *branch;
 		unsigned long max_events;
 		bool	      percore;
 		bool	      aux_output;
 		u32	      aux_sample_size;
 		u64	      cfg_chg;
+		char	      *str;
 	} val;
 	bool weak;
 };
tools/perf/util/map.c +1 -0
index fdd5bddb3075..f67960bedebb 100644
@@ -549,6 +549,7 @@ void maps__insert(struct maps *maps, struct map *map)
 
 			if (maps_by_name == NULL) {
 				__maps__free_maps_by_name(maps);
+				up_write(&maps->lock);
 				return;
 			}
 
tools/perf/util/parse-events.c +45 -22

122 lines not on this page · raw message

tools/perf/util/probe-finder.c +2 -1
index c470c49a804f..1c817add6ca4 100644
@@ -303,7 +303,8 @@ static int convert_variable_type(Dwarf_Die *vr_die,
 	char prefix;
 
 	/* TODO: check all types */
-	if (cast && strcmp(cast, "string") != 0 && strcmp(cast, "x") != 0 &&
+	if (cast && strcmp(cast, "string") != 0 && strcmp(cast, "ustring") &&
+	    strcmp(cast, "x") != 0 &&
 	    strcmp(cast, "s") != 0 && strcmp(cast, "u") != 0) {
 		/* Non string type is OK */
 		/* and respect signedness/hexadecimal cast */
tools/perf/util/srcline.c +15 -1
index 6ccf6f6d09df..5b7d6c16d33f 100644
@@ -193,16 +193,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
 	bfd_vma pc, vma;
 	bfd_size_type size;
 	struct a2l_data *a2l = data;
+	flagword flags;
 
 	if (a2l->found)
 		return;
 
-	if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
+#ifdef bfd_get_section_flags
+	flags = bfd_get_section_flags(abfd, section);
+#else
+	flags = bfd_section_flags(section);
+#endif
+	if ((flags & SEC_ALLOC) == 0)
 		return;
 
 	pc = a2l->addr;
+#ifdef bfd_get_section_vma
 	vma = bfd_get_section_vma(abfd, section);
+#else
+	vma = bfd_section_vma(section);
+#endif
+#ifdef bfd_get_section_size
 	size = bfd_get_section_size(section);
+#else
+	size = bfd_section_size(section);
+#endif
 
 	if (pc < vma || pc >= vma + size)
 		return;
#2 lore raw

Re: [GIT pull] perf fixes for 5.6-rc1

Quoted 8 lines · Thomas Gleixner

- Prevent am intgeer underflow in the perf mlock acounting

- Add a missing prototyp for arch_perf_update_userpage()

- Fix the perf parser so it does not delete parse event terms, which caused a regression for using perf with the ARM CoreSight as the sink confuguration was missing due to the deletion.

You've started drinking too early in the day. But hey, I guess it was evening _somewhere_ in the world.

Pick out the five speeling errors in that pull request message.

Linus

#3 lore raw

Re: [GIT pull] perf fixes for 5.6-rc1

Quoted 4 lines · Linus Torvalds
Quoted 3 lines · Thomas Gleixner

- Prevent am intgeer underflow in the perf mlock acounting

Quoted 8 lines
Quoted 5 lines

- Add a missing prototyp for arch_perf_update_userpage()

- Fix the perf parser so it does not delete parse event terms, which caused a regression for using perf with the ARM CoreSight as the sink confuguration was missing due to the deletion.

You've started drinking too early in the day. But hey, I guess it was evening _somewhere_ in the world.

I swear, I wasn't even near alcohol before writing this.

Quoted 1 line

Pick out the five speeling errors in that pull request message.

But I have to admit shamefully that I really should have searched my misplaced reading glasses instead of trying to squint through my driving glasses.

Want me to redo it?

Thanks,

tglx

#4 lore raw

Re: [GIT pull] perf fixes for 5.6-rc1

Quoted 8 lines · Thomas Gleixner
Quoted 2 lines

Pick out the five speeling errors in that pull request message.

But I have to admit shamefully that I really should have searched my misplaced reading glasses instead of trying to squint through my driving glasses.

Want me to redo it?

Oh I've already pulled it, and fixed the spelling errors I noticed.

I don't know how many I didn't notice, of course.

Linus

#5 lore raw

Re: [GIT pull] perf fixes for 5.6-rc1

In reply to Linus Torvalds
Quoted 6 lines · Linus Torvalds
Quoted 5 lines · Thomas Gleixner

- Prevent am intgeer underflow in the perf mlock acounting

- Add a missing prototyp for arch_perf_update_userpage()

Quoted 8 lines
Quoted 3 lines

- Fix the perf parser so it does not delete parse event terms, which caused a regression for using perf with the ARM CoreSight as the sink confuguration was missing due to the deletion.

You've started drinking too early in the day. But hey, I guess it was evening _somewhere_ in the world.

Pick out the five speeling errors in that pull request message.

to eazy.

Signature · 1 line
~Randy
merge bot Merged
#6 lore raw

Re: [GIT pull] perf fixes for 5.6-rc1

In reply to Thomas Gleixner
The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2020-02-09

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

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#7 lore raw

[GIT pull] time(r) fixes for 5.6-rc1

In reply to Thomas Gleixner

Linus,

please pull the latest timers/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-2020-02-09

up to: febac332a819: clocksource: Prevent double add_timer_on() for watchdog_timer

Two small fixes for the time(r) subsystem:

- Handle a subtle race between the clocksource watchdog and a concurrent clocksource watchdog stop/start sequence correctly to prevent a timer double add bug.

- Fix the file path for the core time namespace file.

Thanks,

tglx

------------------>
Dmitry Safonov (1):
MAINTAINERS: Correct path to time namespace source file

Konstantin Khlebnikov (1):
clocksource: Prevent double add_timer_on() for watchdog_timer

 MAINTAINERS               |  2 +-
 kernel/time/clocksource.c | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
MAINTAINERS +1 -1
index 141b8d3e4ca2..3a4163be98da 100644
@@ -13267,7 +13267,7 @@ S:	Maintained
 F:	fs/timerfd.c
 F:	include/linux/timer*
 F:	include/linux/time_namespace.h
-F:	kernel/time_namespace.c
+F:	kernel/time/namespace.c
 F:	kernel/time/*timer*
 
 POWER MANAGEMENT CORE
kernel/time/clocksource.c +9 -2
index fff5f64981c6..428beb69426a 100644
@@ -293,8 +293,15 @@ static void clocksource_watchdog(struct timer_list *unused)
 	next_cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask);
 	if (next_cpu >= nr_cpu_ids)
 		next_cpu = cpumask_first(cpu_online_mask);
-	watchdog_timer.expires += WATCHDOG_INTERVAL;
-	add_timer_on(&watchdog_timer, next_cpu);
+
+	/*
+	 * Arm timer if not already pending: could race with concurrent
+	 * pair clocksource_stop_watchdog() clocksource_start_watchdog().
+	 */
+	if (!timer_pending(&watchdog_timer)) {
+		watchdog_timer.expires += WATCHDOG_INTERVAL;
+		add_timer_on(&watchdog_timer, next_cpu);
+	}
 out:
 	spin_unlock(&watchdog_lock);
 }
merge bot Merged
#8 lore raw

Re: [GIT pull] time(r) fixes for 5.6-rc1

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-2020-02-09

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

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#9 lore raw

[GIT pull] SMP fixes for 5.6-rc1

In reply to Thomas Gleixner

Linus,

please pull the latest smp/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git smp-urgent-2020-02-09

up to: 1e474b28e788: smp/up: Make smp_call_function_single() match SMP semantics

Two fixes for the SMP related functionality:

- Make the UP version of smp_call_function_single() match SMP semantics when called for a not available CPU. Instead of emitting a warning and assuming that the function call target is CPU0, return a proper error code like the SMP version does.

- Remove a superfluous check in smp_call_function_many_cond()

Thanks,

tglx

------------------>
Paul E. McKenney (1):
smp/up: Make smp_call_function_single() match SMP semantics

Sebastian Andrzej Siewior (1):
smp: Remove superfluous cond_func check in smp_call_function_many_cond()

 kernel/smp.c | 2 +-
 kernel/up.c  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
kernel/smp.c +1 -1
index 3b7bedc97af3..d0ada39eb4d4 100644
@@ -435,7 +435,7 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
 
 	/* Fastpath: do that cpu by itself. */
 	if (next_cpu >= nr_cpu_ids) {
-		if (!cond_func || (cond_func && cond_func(cpu, info)))
+		if (!cond_func || cond_func(cpu, info))
 			smp_call_function_single(cpu, func, info, wait);
 		return;
 	}
kernel/up.c +2 -1
index 53144d056252..c6f323dcd45b 100644
@@ -14,7 +14,8 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
 {
 	unsigned long flags;
 
-	WARN_ON(cpu != 0);
+	if (cpu != 0)
+		return -ENXIO;
 
 	local_irq_save(flags);
 	func(info);
merge bot Merged
#10 lore raw

Re: [GIT pull] SMP fixes for 5.6-rc1

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git smp-urgent-2020-02-09

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

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#11 lore raw

[GIT pull] interrupt fixes for 5.6-rc1

In reply to Thomas Gleixner

Linus,

please pull the latest irq/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-urgent-2020-02-09

up to: 2f86e45a7f42: Merge tag 'irqchip-fixes-5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/urgent

A set of fixes for the interrupt subsystem:

- Provision only ACPI enabled redistributors on GICv3

- Use the proper command colums when building the INVALL command for the GICv3-ITS

- Ensure the allocation of the L2 vPE table for GICv4.1

- Correct the GICv4.1 VPROBASER programming so it uses the proper size

- A set of small GICv4.1 tidy up patches

- Configuration cleanup for C-SKY interrupt chip

- Clarify the function documentation for irq_set_wake() to document that the wakeup functionality is orthogonal to the irq disable/enable mechanism.

Thanks,

tglx

------------------>
Marc Zyngier (1):
irqchip/gic-v3: Only provision redistributors that are enabled in ACPI

Randy Dunlap (1):
irqchip: Some Kconfig cleanup for C-SKY

Stephen Boyd (1):
genirq: Clarify that irq wake state is orthogonal to enable/disable

Zenghui Yu (7):
irqchip/gic-v3-its: Reference to its_invall_cmd descriptor when building INVALL irqchip/gic-v4.1: Fix programming of GICR_VPROPBASER_4_1_SIZE irqchip/gic-v4.1: Set vpe_l1_base for all redistributors irqchip/gic-v4.1: Ensure L2 vPE table is allocated at RD level irqchip/gic-v4.1: Drop 'tmp' in inherit_vpe_l1_table_from_rd() irqchip/gic-v3-its: Remove superfluous WARN_ON irqchip/gic-v3-its: Rename VPENDBASER/VPROPBASER accessors

 arch/arm/include/asm/arch_gicv3.h   |  12 ++--
 arch/arm64/include/asm/arch_gicv3.h |   8 +--
 drivers/irqchip/Kconfig             |   4 +-
 drivers/irqchip/irq-gic-v3-its.c    | 120 ++++++++++++++++++++++++++++++------
 drivers/irqchip/irq-gic-v3.c        |   9 ++-
 include/linux/irqchip/arm-gic-v3.h  |   2 +-
 kernel/irq/manage.c                 |   7 +++
 7 files changed, 127 insertions(+), 35 deletions(-)
arch/arm/include/asm/arch_gicv3.h +6 -6
index b5752f0e8936..c815477b4303 100644
@@ -326,16 +326,16 @@ static inline u64 __gic_readq_nonatomic(const volatile void __iomem *addr)
 #define gits_write_cwriter(v, c)	__gic_writeq_nonatomic(v, c)
 
 /*
- * GITS_VPROPBASER - hi and lo bits may be accessed independently.
+ * GICR_VPROPBASER - hi and lo bits may be accessed independently.
  */
-#define gits_read_vpropbaser(c)		__gic_readq_nonatomic(c)
-#define gits_write_vpropbaser(v, c)	__gic_writeq_nonatomic(v, c)
+#define gicr_read_vpropbaser(c)		__gic_readq_nonatomic(c)
+#define gicr_write_vpropbaser(v, c)	__gic_writeq_nonatomic(v, c)
 
 /*
- * GITS_VPENDBASER - the Valid bit must be cleared before changing
+ * GICR_VPENDBASER - the Valid bit must be cleared before changing
  * anything else.
  */
-static inline void gits_write_vpendbaser(u64 val, void __iomem *addr)
+static inline void gicr_write_vpendbaser(u64 val, void __iomem *addr)
 {
 	u32 tmp;
 
@@ -352,7 +352,7 @@ static inline void gits_write_vpendbaser(u64 val, void __iomem *addr)
 	__gic_writeq_nonatomic(val, addr);
 }
 
-#define gits_read_vpendbaser(c)		__gic_readq_nonatomic(c)
+#define gicr_read_vpendbaser(c)		__gic_readq_nonatomic(c)
 
 static inline bool gic_prio_masking_enabled(void)
 {
arch/arm64/include/asm/arch_gicv3.h +4 -4
index 4750fc8030c3..25fec4bde43a 100644
@@ -140,11 +140,11 @@ static inline u32 gic_read_rpr(void)
 #define gicr_write_pendbaser(v, c)	writeq_relaxed(v, c)
 #define gicr_read_pendbaser(c)		readq_relaxed(c)
 
-#define gits_write_vpropbaser(v, c)	writeq_relaxed(v, c)
-#define gits_read_vpropbaser(c)		readq_relaxed(c)
+#define gicr_write_vpropbaser(v, c)	writeq_relaxed(v, c)
+#define gicr_read_vpropbaser(c)		readq_relaxed(c)
 
-#define gits_write_vpendbaser(v, c)	writeq_relaxed(v, c)
-#define gits_read_vpendbaser(c)		readq_relaxed(c)
+#define gicr_write_vpendbaser(v, c)	writeq_relaxed(v, c)
+#define gicr_read_vpendbaser(c)		readq_relaxed(c)
 
 static inline bool gic_prio_masking_enabled(void)
 {
drivers/irqchip/Kconfig +2 -2
index 1006c694d9fb..6d397732138d 100644
@@ -438,7 +438,7 @@ config CSKY_MPINTC
 	help
 	  Say yes here to enable C-SKY SMP interrupt controller driver used
 	  for C-SKY SMP system.
-	  In fact it's not mmio map in hw and it use ld/st to visit the
+	  In fact it's not mmio map in hardware and it uses ld/st to visit the
 	  controller's register inside CPU.
 
 config CSKY_APB_INTC
@@ -446,7 +446,7 @@ config CSKY_APB_INTC
 	depends on CSKY
 	help
 	  Say yes here to enable C-SKY APB interrupt controller driver used
-	  by C-SKY single core SOC system. It use mmio map apb-bus to visit
+	  by C-SKY single core SOC system. It uses mmio map apb-bus to visit
 	  the controller's register.
 
 config IMX_IRQSTEER
drivers/irqchip/irq-gic-v3-its.c +100 -20

240 lines not on this page · raw message

drivers/irqchip/irq-gic-v3.c +7 -2
index 286f98222878..c1f7af9d9ae7 100644
@@ -1839,6 +1839,7 @@ static struct
 	struct redist_region *redist_regs;
 	u32 nr_redist_regions;
 	bool single_redist;
+	int enabled_rdists;
 	u32 maint_irq;
 	int maint_irq_mode;
 	phys_addr_t vcpu_base;
@@ -1933,8 +1934,10 @@ static int __init gic_acpi_match_gicc(union acpi_subtable_headers *header,
 	 * If GICC is enabled and has valid gicr base address, then it means
 	 * GICR base is presented via GICC
 	 */
-	if ((gicc->flags & ACPI_MADT_ENABLED) && gicc->gicr_base_address)
+	if ((gicc->flags & ACPI_MADT_ENABLED) && gicc->gicr_base_address) {
+		acpi_data.enabled_rdists++;
 		return 0;
+	}
 
 	/*
 	 * It's perfectly valid firmware can pass disabled GICC entry, driver
@@ -1964,8 +1967,10 @@ static int __init gic_acpi_count_gicr_regions(void)
 
 	count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,
 				      gic_acpi_match_gicc, 0);
-	if (count > 0)
+	if (count > 0) {
 		acpi_data.single_redist = true;
+		count = acpi_data.enabled_rdists;
+	}
 
 	return count;
 }
include/linux/irqchip/arm-gic-v3.h +1 -1
index f0b8ca766e7d..83439bfb6c5b 100644
@@ -652,10 +652,10 @@ struct rdists {
 	struct {
 		void __iomem	*rd_base;
 		struct page	*pend_page;
-		struct page	*vpe_l1_page;
 		phys_addr_t	phys_base;
 		bool		lpi_enabled;
 		cpumask_t	*vpe_table_mask;
+		void		*vpe_l1_base;
 	} __percpu		*rdist;
 	phys_addr_t		prop_table_pa;
 	void			*prop_table_va;
kernel/irq/manage.c +7 -0
index 818b2802d3e7..3089a60ea8f9 100644
@@ -731,6 +731,13 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on)
  *
  *	Wakeup mode lets this IRQ wake the system from sleep
  *	states like "suspend to RAM".
+ *
+ *	Note: irq enable/disable state is completely orthogonal
+ *	to the enable/disable state of irq wake. An irq can be
+ *	disabled with disable_irq() and still wake the system as
+ *	long as the irq has wake enabled. If this does not hold,
+ *	then the underlying irq chip and the related driver need
+ *	to be investigated.
  */
 int irq_set_irq_wake(unsigned int irq, unsigned int on)
 {
merge bot Merged
#12 lore raw

Re: [GIT pull] interrupt fixes for 5.6-rc1

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-urgent-2020-02-09

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

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#13 lore raw

[GIT pull] x86 fixes for 5.6-rc1

In reply to Thomas Gleixner

Linus,

please pull the latest x86/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2020-02-09

up to: 0f378d73d429: x86/apic: Mask IOAPIC entries when disabling the local APIC

A set of fixes for X86:

- Ensure that the PIT is set up when the local APIC is disable or configured in legacy mode. This is caused by an ordering issue introduced in the recent changes which skip PIT initialization when the TSC and APIC frequencies are already known.

- Handle malformed SRAT tables during early ACPI parsing which caused an infinite loop anda boot hang.

- Fix a long standing race in the affinity setting code which affects PCI devices with non-maskable MSI interrupts. The problem is caused by the non-atomic writes of the MSI address (destination APIC id) and data (vector) fields which the device uses to construct the MSI message. The non-atomic writes are mandated by PCI.

If both fields change and the device raises an interrupt after writing address and before writing data, then the MSI block constructs a inconsistent message which causes interrupts to be lost and subsequent malfunction of the device.

The fix is to redirect the interrupt to the new vector on the current CPU first and then switch it over to the new target CPU. This allows to observe an eventually raised interrupt in the transitional stage (old CPU, new vector) to be observed in the APIC IRR and retriggered on the new target CPU and the new vector. The potential spurious interrupts caused by this are harmless and can in the worst case expose a buggy driver (all handlers have to be able to deal with spurious interrupts as they can and do happen for various reasons).

- Add the missing suspend/resume mechanism for the HYPERV hypercall page which prevents resume hibernation on HYPERV guests. This change got lost before the merge window.

- Mask the IOAPIC before disabling the local APIC to prevent potentially stale IOAPIC remote IRR bits which cause stale interrupt lines after resume.

Thanks,

tglx

------------------>
Dexuan Cui (1):
x86/hyperv: Suspend/resume the hypercall page for hibernation

Steven Clarkson (1):
x86/boot: Handle malformed SRAT tables during early ACPI parsing

Thomas Gleixner (2):
x86/timer: Don't skip PIT setup when APIC is disabled or in legacy mode x86/apic/msi: Plug non-maskable MSI affinity race

Tony W Wang-oc (1):
x86/apic: Mask IOAPIC entries when disabling the local APIC

 arch/x86/boot/compressed/acpi.c |   6 ++
 arch/x86/hyperv/hv_init.c       |  50 ++++++++++++++++
 arch/x86/include/asm/apic.h     |  10 ++++
 arch/x86/include/asm/x86_init.h |   2 +
 arch/x86/kernel/apic/apic.c     |  30 ++++++++--
 arch/x86/kernel/apic/msi.c      | 128 +++++++++++++++++++++++++++++++++++++++-
 arch/x86/kernel/time.c          |  12 +++-
 arch/x86/kernel/x86_init.c      |   1 +
 arch/x86/xen/enlighten_pv.c     |   1 +
 include/linux/irq.h             |  18 ++++++
 include/linux/irqdomain.h       |   7 +++
 kernel/irq/debugfs.c            |   1 +
 kernel/irq/msi.c                |   5 +-
 13 files changed, 260 insertions(+), 11 deletions(-)
arch/x86/boot/compressed/acpi.c +6 -0
index 25019d42ae93..ef2ad7253cd5 100644
@@ -393,7 +393,13 @@ int count_immovable_mem_regions(void)
 	table = table_addr + sizeof(struct acpi_table_srat);
 
 	while (table + sizeof(struct acpi_subtable_header) < table_end) {
+
 		sub_table = (struct acpi_subtable_header *)table;
+		if (!sub_table->length) {
+			debug_putstr("Invalid zero length SRAT subtable.\n");
+			return 0;
+		}
+
 		if (sub_table->type == ACPI_SRAT_TYPE_MEMORY_AFFINITY) {
 			struct acpi_srat_mem_affinity *ma;
 
arch/x86/hyperv/hv_init.c +50 -0

79 lines not on this page · raw message

arch/x86/include/asm/apic.h +10 -0
index 2ebc17d9c72c..19e94af9cc5d 100644
@@ -140,6 +140,7 @@ extern void apic_soft_disable(void);
 extern void lapic_shutdown(void);
 extern void sync_Arb_IDs(void);
 extern void init_bsp_APIC(void);
+extern void apic_intr_mode_select(void);
 extern void apic_intr_mode_init(void);
 extern void init_apic_mappings(void);
 void register_lapic_address(unsigned long address);
@@ -188,6 +189,7 @@ static inline void disable_local_APIC(void) { }
 # define setup_secondary_APIC_clock x86_init_noop
 static inline void lapic_update_tsc_freq(void) { }
 static inline void init_bsp_APIC(void) { }
+static inline void apic_intr_mode_select(void) { }
 static inline void apic_intr_mode_init(void) { }
 static inline void lapic_assign_system_vectors(void) { }
 static inline void lapic_assign_legacy_vector(unsigned int i, bool r) { }
@@ -452,6 +454,14 @@ static inline void ack_APIC_irq(void)
 	apic_eoi();
 }
 
+
+static inline bool lapic_vector_set_in_irr(unsigned int vector)
+{
+	u32 irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
+
+	return !!(irr & (1U << (vector % 32)));
+}
+
 static inline unsigned default_get_apic_id(unsigned long x)
 {
 	unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
arch/x86/include/asm/x86_init.h +2 -0
index 19435858df5f..96d9cd208610 100644
@@ -51,12 +51,14 @@ struct x86_init_resources {
  *				are set up.
  * @intr_init:			interrupt init code
  * @trap_init:			platform specific trap setup
+ * @intr_mode_select:		interrupt delivery mode selection
  * @intr_mode_init:		interrupt delivery mode setup
  */
 struct x86_init_irqs {
 	void (*pre_vector_init)(void);
 	void (*intr_init)(void);
 	void (*trap_init)(void);
+	void (*intr_mode_select)(void);
 	void (*intr_mode_init)(void);
 };
 
arch/x86/kernel/apic/apic.c +25 -5
index 28446fa6bf18..5f973fed3c9f 100644
@@ -830,8 +830,17 @@ bool __init apic_needs_pit(void)
 	if (!tsc_khz || !cpu_khz)
 		return true;
 
-	/* Is there an APIC at all? */
-	if (!boot_cpu_has(X86_FEATURE_APIC))
+	/* Is there an APIC at all or is it disabled? */
+	if (!boot_cpu_has(X86_FEATURE_APIC) || disable_apic)
+		return true;
+
+	/*
+	 * If interrupt delivery mode is legacy PIC or virtual wire without
+	 * configuration, the local APIC timer wont be set up. Make sure
+	 * that the PIT is initialized.
+	 */
+	if (apic_intr_mode == APIC_PIC ||
+	    apic_intr_mode == APIC_VIRTUAL_WIRE_NO_CONFIG)
 		return true;
 
 	/* Virt guests may lack ARAT, but still have DEADLINE */
@@ -1322,7 +1331,7 @@ void __init sync_Arb_IDs(void)
 
 enum apic_intr_mode_id apic_intr_mode __ro_after_init;
 
-static int __init apic_intr_mode_select(void)
+static int __init __apic_intr_mode_select(void)
 {
 	/* Check kernel option */
 	if (disable_apic) {
@@ -1384,6 +1393,12 @@ static int __init apic_intr_mode_select(void)
 	return APIC_SYMMETRIC_IO;
 }
 
+/* Select the interrupt delivery mode for the BSP */
+void __init apic_intr_mode_select(void)
+{
+	apic_intr_mode = __apic_intr_mode_select();
+}
+
 /*
  * An initial setup of the virtual wire mode.
  */
@@ -1440,8 +1455,6 @@ void __init apic_intr_mode_init(void)
 {
 	bool upmode = IS_ENABLED(CONFIG_UP_LATE_INIT);
 
-	apic_intr_mode = apic_intr_mode_select();
-
 	switch (apic_intr_mode) {
 	case APIC_PIC:
 		pr_info("APIC: Keep in PIC mode(8259)\n");
@@ -2626,6 +2639,13 @@ static int lapic_suspend(void)
 #endif
 
 	local_irq_save(flags);
+
+	/*
+	 * Mask IOAPIC before disabling the local APIC to prevent stale IRR
+	 * entries on some implementations.
+	 */
+	mask_ioapic_entries();
+
 	disable_local_APIC();
 
 	irq_remapping_disable();
arch/x86/kernel/apic/msi.c +125 -3

153 lines not on this page · raw message

arch/x86/kernel/time.c +10 -2
index 7ce29cee9f9e..d8673d8a779b 100644
@@ -91,10 +91,18 @@ void __init hpet_time_init(void)
 
 static __init void x86_late_time_init(void)
 {
+	/*
+	 * Before PIT/HPET init, select the interrupt mode. This is required
+	 * to make the decision whether PIT should be initialized correct.
+	 */
+	x86_init.irqs.intr_mode_select();
+
+	/* Setup the legacy timers */
 	x86_init.timers.timer_init();
+
 	/*
-	 * After PIT/HPET timers init, select and setup
-	 * the final interrupt mode for delivering IRQs.
+	 * After PIT/HPET timers init, set up the final interrupt mode for
+	 * delivering IRQs.
 	 */
 	x86_init.irqs.intr_mode_init();
 	tsc_init();
arch/x86/kernel/x86_init.c +1 -0
index ce89430a7f80..9a89261dcd2a 100644
@@ -80,6 +80,7 @@ struct x86_init_ops x86_init __initdata = {
 		.pre_vector_init	= init_ISA_irqs,
 		.intr_init		= native_init_IRQ,
 		.trap_init		= x86_init_noop,
+		.intr_mode_select	= apic_intr_mode_select,
 		.intr_mode_init		= apic_intr_mode_init
 	},
 
arch/x86/xen/enlighten_pv.c +1 -0
index ae4a41ca19f6..1f756ffffe8b 100644
@@ -1205,6 +1205,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 	x86_platform.get_nmi_reason = xen_get_nmi_reason;
 
 	x86_init.resources.memory_setup = xen_memory_setup;
+	x86_init.irqs.intr_mode_select	= x86_init_noop;
 	x86_init.irqs.intr_mode_init	= x86_init_noop;
 	x86_init.oem.arch_setup = xen_arch_setup;
 	x86_init.oem.banner = xen_banner;
include/linux/irq.h +18 -0
index 7853eb9301f2..3ed5a055b5f4 100644
@@ -209,6 +209,8 @@ struct irq_data {
  * IRQD_SINGLE_TARGET		- IRQ allows only a single affinity target
  * IRQD_DEFAULT_TRIGGER_SET	- Expected trigger already been set
  * IRQD_CAN_RESERVE		- Can use reservation mode
+ * IRQD_MSI_NOMASK_QUIRK	- Non-maskable MSI quirk for affinity change
+ *				  required
  */
 enum {
 	IRQD_TRIGGER_MASK		= 0xf,
@@ -231,6 +233,7 @@ enum {
 	IRQD_SINGLE_TARGET		= (1 << 24),
 	IRQD_DEFAULT_TRIGGER_SET	= (1 << 25),
 	IRQD_CAN_RESERVE		= (1 << 26),
+	IRQD_MSI_NOMASK_QUIRK		= (1 << 27),
 };
 
 #define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
@@ -390,6 +393,21 @@ static inline bool irqd_can_reserve(struct irq_data *d)
 	return __irqd_to_state(d) & IRQD_CAN_RESERVE;
 }
 
+static inline void irqd_set_msi_nomask_quirk(struct irq_data *d)
+{
+	__irqd_to_state(d) |= IRQD_MSI_NOMASK_QUIRK;
+}
+
+static inline void irqd_clr_msi_nomask_quirk(struct irq_data *d)
+{
+	__irqd_to_state(d) &= ~IRQD_MSI_NOMASK_QUIRK;
+}
+
+static inline bool irqd_msi_nomask_quirk(struct irq_data *d)
+{
+	return __irqd_to_state(d) & IRQD_MSI_NOMASK_QUIRK;
+}
+
 #undef __irqd_to_state
 
 static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
include/linux/irqdomain.h +7 -0
index 3c340dbc5a1f..4da8df57618a 100644
@@ -206,6 +206,13 @@ enum {
 	/* Irq domain implements MSI remapping */
 	IRQ_DOMAIN_FLAG_MSI_REMAP	= (1 << 5),
 
+	/*
+	 * Quirk to handle MSI implementations which do not provide
+	 * masking. Currently known to affect x86, but partially
+	 * handled in core code.
+	 */
+	IRQ_DOMAIN_MSI_NOMASK_QUIRK	= (1 << 6),
+
 	/*
 	 * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
 	 * for implementation specific purposes and ignored by the
kernel/irq/debugfs.c +1 -0
index c1eccd4f6520..a949bd39e343 100644
@@ -114,6 +114,7 @@ static const struct irq_bit_descr irqdata_states[] = {
 	BIT_MASK_DESCR(IRQD_AFFINITY_MANAGED),
 	BIT_MASK_DESCR(IRQD_MANAGED_SHUTDOWN),
 	BIT_MASK_DESCR(IRQD_CAN_RESERVE),
+	BIT_MASK_DESCR(IRQD_MSI_NOMASK_QUIRK),
 
 	BIT_MASK_DESCR(IRQD_FORWARDED_TO_VCPU),
 
kernel/irq/msi.c +4 -1
index ad26fbcfbfc8..eb95f6106a1e 100644
@@ -453,8 +453,11 @@ int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
 			continue;
 
 		irq_data = irq_domain_get_irq_data(domain, desc->irq);
-		if (!can_reserve)
+		if (!can_reserve) {
 			irqd_clr_can_reserve(irq_data);
+			if (domain->flags & IRQ_DOMAIN_MSI_NOMASK_QUIRK)
+				irqd_set_msi_nomask_quirk(irq_data);
+		}
 		ret = irq_domain_activate_irq(irq_data, can_reserve);
 		if (ret)
 			goto cleanup;
merge bot Merged
#14 lore raw

Re: [GIT pull] x86 fixes for 5.6-rc1

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2020-02-09

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

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
merge bot Merged
#15 lore raw
In reply to Thomas Gleixner
The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

The pull request you sent on Sun, 09 Feb 2020 14:02:37 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-2020-02-09

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

Thank you!

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