Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull core fixes from Ingo Molnar:

- workaround for gcc asm handling

- futex race fixes

- objtool build warning fix

- two watchdog fixes: a crash fix (revert) and a bug fix for
/proc/sys/kernel/watchdog_thresh handling.

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
objtool: Prevent GCC from merging annotate_unreachable(), take 2
objtool: Resync objtool's instruction decoder source code copy with the kernel's latest version
watchdog/hardlockup/perf: Use atomics to track in-use cpu counter
watchdog/harclockup/perf: Revert a33d44843d45 ("watchdog/hardlockup/perf: Simplify deferred event destroy")
futex: Fix more put_pi_state() vs. exit_pi_state_list() races

+33 -10
+2 -2
include/linux/compiler.h
··· 191 191 asm("%c0:\n\t" \ 192 192 ".pushsection .discard.reachable\n\t" \ 193 193 ".long %c0b - .\n\t" \ 194 - ".popsection\n\t" : : "i" (__LINE__)); \ 194 + ".popsection\n\t" : : "i" (__COUNTER__)); \ 195 195 }) 196 196 #define annotate_unreachable() ({ \ 197 197 asm("%c0:\n\t" \ 198 198 ".pushsection .discard.unreachable\n\t" \ 199 199 ".long %c0b - .\n\t" \ 200 - ".popsection\n\t" : : "i" (__LINE__)); \ 200 + ".popsection\n\t" : : "i" (__COUNTER__)); \ 201 201 }) 202 202 #define ASM_UNREACHABLE \ 203 203 "999:\n\t" \
+20 -3
kernel/futex.c
··· 903 903 */ 904 904 raw_spin_lock_irq(&curr->pi_lock); 905 905 while (!list_empty(head)) { 906 - 907 906 next = head->next; 908 907 pi_state = list_entry(next, struct futex_pi_state, list); 909 908 key = pi_state->key; 910 909 hb = hash_futex(&key); 910 + 911 + /* 912 + * We can race against put_pi_state() removing itself from the 913 + * list (a waiter going away). put_pi_state() will first 914 + * decrement the reference count and then modify the list, so 915 + * its possible to see the list entry but fail this reference 916 + * acquire. 917 + * 918 + * In that case; drop the locks to let put_pi_state() make 919 + * progress and retry the loop. 920 + */ 921 + if (!atomic_inc_not_zero(&pi_state->refcount)) { 922 + raw_spin_unlock_irq(&curr->pi_lock); 923 + cpu_relax(); 924 + raw_spin_lock_irq(&curr->pi_lock); 925 + continue; 926 + } 911 927 raw_spin_unlock_irq(&curr->pi_lock); 912 928 913 929 spin_lock(&hb->lock); ··· 934 918 * task still owns the PI-state: 935 919 */ 936 920 if (head->next != next) { 921 + /* retain curr->pi_lock for the loop invariant */ 937 922 raw_spin_unlock(&pi_state->pi_mutex.wait_lock); 938 923 spin_unlock(&hb->lock); 924 + put_pi_state(pi_state); 939 925 continue; 940 926 } 941 927 ··· 945 927 WARN_ON(list_empty(&pi_state->list)); 946 928 list_del_init(&pi_state->list); 947 929 pi_state->owner = NULL; 948 - raw_spin_unlock(&curr->pi_lock); 949 930 950 - get_pi_state(pi_state); 931 + raw_spin_unlock(&curr->pi_lock); 951 932 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); 952 933 spin_unlock(&hb->lock); 953 934
+10 -5
kernel/watchdog_hld.c
··· 13 13 #define pr_fmt(fmt) "NMI watchdog: " fmt 14 14 15 15 #include <linux/nmi.h> 16 + #include <linux/atomic.h> 16 17 #include <linux/module.h> 17 18 #include <linux/sched/debug.h> 18 19 ··· 23 22 static DEFINE_PER_CPU(bool, hard_watchdog_warn); 24 23 static DEFINE_PER_CPU(bool, watchdog_nmi_touch); 25 24 static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); 25 + static DEFINE_PER_CPU(struct perf_event *, dead_event); 26 26 static struct cpumask dead_events_mask; 27 27 28 28 static unsigned long hardlockup_allcpu_dumped; 29 - static unsigned int watchdog_cpus; 29 + static atomic_t watchdog_cpus = ATOMIC_INIT(0); 30 30 31 31 void arch_touch_nmi_watchdog(void) 32 32 { ··· 191 189 if (hardlockup_detector_event_create()) 192 190 return; 193 191 194 - if (!watchdog_cpus++) 192 + /* use original value for check */ 193 + if (!atomic_fetch_inc(&watchdog_cpus)) 195 194 pr_info("Enabled. Permanently consumes one hw-PMU counter.\n"); 196 195 197 196 perf_event_enable(this_cpu_read(watchdog_ev)); ··· 207 204 208 205 if (event) { 209 206 perf_event_disable(event); 207 + this_cpu_write(watchdog_ev, NULL); 208 + this_cpu_write(dead_event, event); 210 209 cpumask_set_cpu(smp_processor_id(), &dead_events_mask); 211 - watchdog_cpus--; 210 + atomic_dec(&watchdog_cpus); 212 211 } 213 212 } 214 213 ··· 224 219 int cpu; 225 220 226 221 for_each_cpu(cpu, &dead_events_mask) { 227 - struct perf_event *event = per_cpu(watchdog_ev, cpu); 222 + struct perf_event *event = per_cpu(dead_event, cpu); 228 223 229 224 /* 230 225 * Required because for_each_cpu() reports unconditionally ··· 232 227 */ 233 228 if (event) 234 229 perf_event_release_kernel(event); 235 - per_cpu(watchdog_ev, cpu) = NULL; 230 + per_cpu(dead_event, cpu) = NULL; 236 231 } 237 232 cpumask_clear(&dead_events_mask); 238 233 }
+1
tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk
··· 1 1 #!/bin/awk -f 2 + # SPDX-License-Identifier: GPL-2.0 2 3 # gen-insn-attr-x86.awk: Instruction attribute table generator 3 4 # Written by Masami Hiramatsu <mhiramat@redhat.com> 4 5 #