···164164 select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE165165 select HAVE_ARCH_HARDENED_USERCOPY166166 select HAVE_KERNEL_GZIP167167- select HAVE_CC_STACKPROTECTOR168167169168config GENERIC_CSUM170169 def_bool CPU_LITTLE_ENDIAN···483484 bool "Build a relocatable kernel"484485 depends on (PPC64 && !COMPILE_TEST) || (FLATMEM && (44x || FSL_BOOKE))485486 select NONSTATIC_KERNEL487487+ select MODULE_REL_CRCS if MODVERSIONS486488 help487489 This builds a kernel image that is capable of running at the488490 location the kernel is loaded at. For ppc32, there is no any
+2
arch/powerpc/include/asm/cpu_has_feature.h
···2323{2424 int i;25252626+#ifndef __clang__ /* clang can't cope with this */2627 BUILD_BUG_ON(!__builtin_constant_p(feature));2828+#endif27292830#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG2931 if (!static_key_initialized) {
+2
arch/powerpc/include/asm/mmu.h
···160160{161161 int i;162162163163+#ifndef __clang__ /* clang can't cope with this */163164 BUILD_BUG_ON(!__builtin_constant_p(feature));165165+#endif164166165167#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG166168 if (!static_key_initialized) {
···11-/*22- * GCC stack protector support.33- *44- * Stack protector works by putting predefined pattern at the start of55- * the stack frame and verifying that it hasn't been overwritten when66- * returning from the function. The pattern is called stack canary77- * and gcc expects it to be defined by a global variable called88- * "__stack_chk_guard" on PPC. This unfortunately means that on SMP99- * we cannot have a different canary value per task.1010- */1111-1212-#ifndef _ASM_STACKPROTECTOR_H1313-#define _ASM_STACKPROTECTOR_H1414-1515-#include <linux/random.h>1616-#include <linux/version.h>1717-#include <asm/reg.h>1818-1919-extern unsigned long __stack_chk_guard;2020-2121-/*2222- * Initialize the stackprotector canary value.2323- *2424- * NOTE: this must only be called from functions that never return,2525- * and it must always be inlined.2626- */2727-static __always_inline void boot_init_stack_canary(void)2828-{2929- unsigned long canary;3030-3131- /* Try to get a semi random initial value. */3232- get_random_bytes(&canary, sizeof(canary));3333- canary ^= mftb();3434- canary ^= LINUX_VERSION_CODE;3535-3636- current->stack_canary = canary;3737- __stack_chk_guard = current->stack_canary;3838-}3939-4040-#endif /* _ASM_STACKPROTECTOR_H */
-4
arch/powerpc/kernel/Makefile
···1919CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)2020CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)21212222-# -fstack-protector triggers protection checks in this code,2323-# but it is being used too early to link to meaningful stack_chk logic.2424-CFLAGS_prom_init.o += $(call cc-option, -fno-stack-protector)2525-2622ifdef CONFIG_FUNCTION_TRACER2723# Do not trace early boot code2824CFLAGS_REMOVE_cputable.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
···286286 for (end = (void *)vers + size; vers < end; vers++)287287 if (vers->name[0] == '.') {288288 memmove(vers->name, vers->name+1, strlen(vers->name));289289-#ifdef ARCH_RELOCATES_KCRCTAB290290- /* The TOC symbol has no CRC computed. To avoid CRC291291- * check failing, we must force it to the expected292292- * value (see CRC check in module.c).293293- */294294- if (!strcmp(vers->name, "TOC."))295295- vers->crc = -(unsigned long)reloc_start;296296-#endif297289 }298290}299291
···10211021 unsigned long order = get_order(size);10221022 unsigned long p;1023102310241024- p = __get_free_pages(GFP_KERNEL, order);10241024+ p = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);10251025 if (!p) {10261026 prom_printf("SUN4V: Error, cannot allocate queue.\n");10271027 prom_halt();
···20512051 atomic_inc(&sun4v_resum_oflow_cnt);20522052}2053205320542054+/* Given a set of registers, get the virtual addressi that was being accessed20552055+ * by the faulting instructions at tpc.20562056+ */20572057+static unsigned long sun4v_get_vaddr(struct pt_regs *regs)20582058+{20592059+ unsigned int insn;20602060+20612061+ if (!copy_from_user(&insn, (void __user *)regs->tpc, 4)) {20622062+ return compute_effective_address(regs, insn,20632063+ (insn >> 25) & 0x1f);20642064+ }20652065+ return 0;20662066+}20672067+20682068+/* Attempt to handle non-resumable errors generated from userspace.20692069+ * Returns true if the signal was handled, false otherwise.20702070+ */20712071+bool sun4v_nonresum_error_user_handled(struct pt_regs *regs,20722072+ struct sun4v_error_entry *ent) {20732073+20742074+ unsigned int attrs = ent->err_attrs;20752075+20762076+ if (attrs & SUN4V_ERR_ATTRS_MEMORY) {20772077+ unsigned long addr = ent->err_raddr;20782078+ siginfo_t info;20792079+20802080+ if (addr == ~(u64)0) {20812081+ /* This seems highly unlikely to ever occur */20822082+ pr_emerg("SUN4V NON-RECOVERABLE ERROR: Memory error detected in unknown location!\n");20832083+ } else {20842084+ unsigned long page_cnt = DIV_ROUND_UP(ent->err_size,20852085+ PAGE_SIZE);20862086+20872087+ /* Break the unfortunate news. */20882088+ pr_emerg("SUN4V NON-RECOVERABLE ERROR: Memory failed at %016lX\n",20892089+ addr);20902090+ pr_emerg("SUN4V NON-RECOVERABLE ERROR: Claiming %lu ages.\n",20912091+ page_cnt);20922092+20932093+ while (page_cnt-- > 0) {20942094+ if (pfn_valid(addr >> PAGE_SHIFT))20952095+ get_page(pfn_to_page(addr >> PAGE_SHIFT));20962096+ addr += PAGE_SIZE;20972097+ }20982098+ }20992099+ info.si_signo = SIGKILL;21002100+ info.si_errno = 0;21012101+ info.si_trapno = 0;21022102+ force_sig_info(info.si_signo, &info, current);21032103+21042104+ return true;21052105+ }21062106+ if (attrs & SUN4V_ERR_ATTRS_PIO) {21072107+ siginfo_t info;21082108+21092109+ info.si_signo = SIGBUS;21102110+ info.si_code = BUS_ADRERR;21112111+ info.si_addr = (void __user *)sun4v_get_vaddr(regs);21122112+ force_sig_info(info.si_signo, &info, current);21132113+21142114+ return true;21152115+ }21162116+21172117+ /* Default to doing nothing */21182118+ return false;21192119+}21202120+20542121/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.20552122 * Log the event, clear the first word of the entry, and die.20562123 */···21412074 wmb();2142207521432076 put_cpu();20772077+20782078+ if (!(regs->tstate & TSTATE_PRIV) &&20792079+ sun4v_nonresum_error_user_handled(regs, &local_copy)) {20802080+ /* DON'T PANIC: This userspace error was handled. */20812081+ return;20822082+ }2144208321452084#ifdef CONFIG_PCI21462085 /* Check for the special PCI poke sequence. */
+26-34
arch/x86/events/intel/rapl.c
···161161162162static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu)163163{164164- return rapl_pmus->pmus[topology_logical_package_id(cpu)];164164+ unsigned int pkgid = topology_logical_package_id(cpu);165165+166166+ /*167167+ * The unsigned check also catches the '-1' return value for non168168+ * existent mappings in the topology map.169169+ */170170+ return pkgid < rapl_pmus->maxpkg ? rapl_pmus->pmus[pkgid] : NULL;165171}166172167173static inline u64 rapl_read_counter(struct perf_event *event)···408402409403 /* must be done before validate_group */410404 pmu = cpu_to_rapl_pmu(event->cpu);405405+ if (!pmu)406406+ return -EINVAL;411407 event->cpu = pmu->cpu;412408 event->pmu_private = pmu;413409 event->hw.event_base = msr;···593585 struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu);594586 int target;595587588588+ if (!pmu) {589589+ pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu));590590+ if (!pmu)591591+ return -ENOMEM;592592+593593+ raw_spin_lock_init(&pmu->lock);594594+ INIT_LIST_HEAD(&pmu->active_list);595595+ pmu->pmu = &rapl_pmus->pmu;596596+ pmu->timer_interval = ms_to_ktime(rapl_timer_ms);597597+ rapl_hrtimer_init(pmu);598598+599599+ rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu;600600+ }601601+596602 /*597603 * Check if there is an online cpu in the package which collects rapl598604 * events already.···617595618596 cpumask_set_cpu(cpu, &rapl_cpu_mask);619597 pmu->cpu = cpu;620620- return 0;621621-}622622-623623-static int rapl_cpu_prepare(unsigned int cpu)624624-{625625- struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu);626626-627627- if (pmu)628628- return 0;629629-630630- pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu));631631- if (!pmu)632632- return -ENOMEM;633633-634634- raw_spin_lock_init(&pmu->lock);635635- INIT_LIST_HEAD(&pmu->active_list);636636- pmu->pmu = &rapl_pmus->pmu;637637- pmu->timer_interval = ms_to_ktime(rapl_timer_ms);638638- pmu->cpu = -1;639639- rapl_hrtimer_init(pmu);640640- rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu;641598 return 0;642599}643600···804803 /*805804 * Install callbacks. Core will call them for each online cpu.806805 */807807-808808- ret = cpuhp_setup_state(CPUHP_PERF_X86_RAPL_PREP, "perf/x86/rapl:prepare",809809- rapl_cpu_prepare, NULL);810810- if (ret)811811- goto out;812812-813806 ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_RAPL_ONLINE,814807 "perf/x86/rapl:online",815808 rapl_cpu_online, rapl_cpu_offline);816809 if (ret)817817- goto out1;810810+ goto out;818811819812 ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1);820813 if (ret)821821- goto out2;814814+ goto out1;822815823816 rapl_advertise();824817 return 0;825818826826-out2:827827- cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE);828819out1:829829- cpuhp_remove_state(CPUHP_PERF_X86_RAPL_PREP);820820+ cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE);830821out:831822 pr_warn("Initialization failed (%d), disabled\n", ret);832823 cleanup_rapl_pmus();···829836static void __exit intel_rapl_exit(void)830837{831838 cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_RAPL_ONLINE);832832- cpuhp_remove_state_nocalls(CPUHP_PERF_X86_RAPL_PREP);833839 perf_pmu_unregister(&rapl_pmus->pmu);834840 cleanup_rapl_pmus();835841}
+91-141
arch/x86/events/intel/uncore.c
···100100101101struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)102102{103103- return pmu->boxes[topology_logical_package_id(cpu)];103103+ unsigned int pkgid = topology_logical_package_id(cpu);104104+105105+ /*106106+ * The unsigned check also catches the '-1' return value for non107107+ * existent mappings in the topology map.108108+ */109109+ return pkgid < max_packages ? pmu->boxes[pkgid] : NULL;104110}105111106112u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event)···770764 pmu->registered = false;771765}772766773773-static void __uncore_exit_boxes(struct intel_uncore_type *type, int cpu)774774-{775775- struct intel_uncore_pmu *pmu = type->pmus;776776- struct intel_uncore_box *box;777777- int i, pkg;778778-779779- if (pmu) {780780- pkg = topology_physical_package_id(cpu);781781- for (i = 0; i < type->num_boxes; i++, pmu++) {782782- box = pmu->boxes[pkg];783783- if (box)784784- uncore_box_exit(box);785785- }786786- }787787-}788788-789789-static void uncore_exit_boxes(void *dummy)790790-{791791- struct intel_uncore_type **types;792792-793793- for (types = uncore_msr_uncores; *types; types++)794794- __uncore_exit_boxes(*types++, smp_processor_id());795795-}796796-797767static void uncore_free_boxes(struct intel_uncore_pmu *pmu)798768{799769 int pkg;···10401058 }10411059}1042106010431043-static int uncore_cpu_dying(unsigned int cpu)10441044-{10451045- struct intel_uncore_type *type, **types = uncore_msr_uncores;10461046- struct intel_uncore_pmu *pmu;10471047- struct intel_uncore_box *box;10481048- int i, pkg;10491049-10501050- pkg = topology_logical_package_id(cpu);10511051- for (; *types; types++) {10521052- type = *types;10531053- pmu = type->pmus;10541054- for (i = 0; i < type->num_boxes; i++, pmu++) {10551055- box = pmu->boxes[pkg];10561056- if (box && atomic_dec_return(&box->refcnt) == 0)10571057- uncore_box_exit(box);10581058- }10591059- }10601060- return 0;10611061-}10621062-10631063-static int first_init;10641064-10651065-static int uncore_cpu_starting(unsigned int cpu)10661066-{10671067- struct intel_uncore_type *type, **types = uncore_msr_uncores;10681068- struct intel_uncore_pmu *pmu;10691069- struct intel_uncore_box *box;10701070- int i, pkg, ncpus = 1;10711071-10721072- if (first_init) {10731073- /*10741074- * On init we get the number of online cpus in the package10751075- * and set refcount for all of them.10761076- */10771077- ncpus = cpumask_weight(topology_core_cpumask(cpu));10781078- }10791079-10801080- pkg = topology_logical_package_id(cpu);10811081- for (; *types; types++) {10821082- type = *types;10831083- pmu = type->pmus;10841084- for (i = 0; i < type->num_boxes; i++, pmu++) {10851085- box = pmu->boxes[pkg];10861086- if (!box)10871087- continue;10881088- /* The first cpu on a package activates the box */10891089- if (atomic_add_return(ncpus, &box->refcnt) == ncpus)10901090- uncore_box_init(box);10911091- }10921092- }10931093-10941094- return 0;10951095-}10961096-10971097-static int uncore_cpu_prepare(unsigned int cpu)10981098-{10991099- struct intel_uncore_type *type, **types = uncore_msr_uncores;11001100- struct intel_uncore_pmu *pmu;11011101- struct intel_uncore_box *box;11021102- int i, pkg;11031103-11041104- pkg = topology_logical_package_id(cpu);11051105- for (; *types; types++) {11061106- type = *types;11071107- pmu = type->pmus;11081108- for (i = 0; i < type->num_boxes; i++, pmu++) {11091109- if (pmu->boxes[pkg])11101110- continue;11111111- /* First cpu of a package allocates the box */11121112- box = uncore_alloc_box(type, cpu_to_node(cpu));11131113- if (!box)11141114- return -ENOMEM;11151115- box->pmu = pmu;11161116- box->pkgid = pkg;11171117- pmu->boxes[pkg] = box;11181118- }11191119- }11201120- return 0;11211121-}11221122-11231061static void uncore_change_type_ctx(struct intel_uncore_type *type, int old_cpu,11241062 int new_cpu)11251063{···1079117710801178static int uncore_event_cpu_offline(unsigned int cpu)10811179{10821082- int target;11801180+ struct intel_uncore_type *type, **types = uncore_msr_uncores;11811181+ struct intel_uncore_pmu *pmu;11821182+ struct intel_uncore_box *box;11831183+ int i, pkg, target;1083118410841185 /* Check if exiting cpu is used for collecting uncore events */10851186 if (!cpumask_test_and_clear_cpu(cpu, &uncore_cpu_mask))10861086- return 0;10871087-11871187+ goto unref;10881188 /* Find a new cpu to collect uncore events */10891189 target = cpumask_any_but(topology_core_cpumask(cpu), cpu);10901190···1098119410991195 uncore_change_context(uncore_msr_uncores, cpu, target);11001196 uncore_change_context(uncore_pci_uncores, cpu, target);11971197+11981198+unref:11991199+ /* Clear the references */12001200+ pkg = topology_logical_package_id(cpu);12011201+ for (; *types; types++) {12021202+ type = *types;12031203+ pmu = type->pmus;12041204+ for (i = 0; i < type->num_boxes; i++, pmu++) {12051205+ box = pmu->boxes[pkg];12061206+ if (box && atomic_dec_return(&box->refcnt) == 0)12071207+ uncore_box_exit(box);12081208+ }12091209+ }11011210 return 0;12111211+}12121212+12131213+static int allocate_boxes(struct intel_uncore_type **types,12141214+ unsigned int pkg, unsigned int cpu)12151215+{12161216+ struct intel_uncore_box *box, *tmp;12171217+ struct intel_uncore_type *type;12181218+ struct intel_uncore_pmu *pmu;12191219+ LIST_HEAD(allocated);12201220+ int i;12211221+12221222+ /* Try to allocate all required boxes */12231223+ for (; *types; types++) {12241224+ type = *types;12251225+ pmu = type->pmus;12261226+ for (i = 0; i < type->num_boxes; i++, pmu++) {12271227+ if (pmu->boxes[pkg])12281228+ continue;12291229+ box = uncore_alloc_box(type, cpu_to_node(cpu));12301230+ if (!box)12311231+ goto cleanup;12321232+ box->pmu = pmu;12331233+ box->pkgid = pkg;12341234+ list_add(&box->active_list, &allocated);12351235+ }12361236+ }12371237+ /* Install them in the pmus */12381238+ list_for_each_entry_safe(box, tmp, &allocated, active_list) {12391239+ list_del_init(&box->active_list);12401240+ box->pmu->boxes[pkg] = box;12411241+ }12421242+ return 0;12431243+12441244+cleanup:12451245+ list_for_each_entry_safe(box, tmp, &allocated, active_list) {12461246+ list_del_init(&box->active_list);12471247+ kfree(box);12481248+ }12491249+ return -ENOMEM;11021250}1103125111041252static int uncore_event_cpu_online(unsigned int cpu)11051253{11061106- int target;12541254+ struct intel_uncore_type *type, **types = uncore_msr_uncores;12551255+ struct intel_uncore_pmu *pmu;12561256+ struct intel_uncore_box *box;12571257+ int i, ret, pkg, target;12581258+12591259+ pkg = topology_logical_package_id(cpu);12601260+ ret = allocate_boxes(types, pkg, cpu);12611261+ if (ret)12621262+ return ret;12631263+12641264+ for (; *types; types++) {12651265+ type = *types;12661266+ pmu = type->pmus;12671267+ for (i = 0; i < type->num_boxes; i++, pmu++) {12681268+ box = pmu->boxes[pkg];12691269+ if (!box && atomic_inc_return(&box->refcnt) == 1)12701270+ uncore_box_init(box);12711271+ }12721272+ }1107127311081274 /*11091275 * Check if there is an online cpu in the package···13631389 if (cret && pret)13641390 return -ENODEV;1365139113661366- /*13671367- * Install callbacks. Core will call them for each online cpu.13681368- *13691369- * The first online cpu of each package allocates and takes13701370- * the refcounts for all other online cpus in that package.13711371- * If msrs are not enabled no allocation is required and13721372- * uncore_cpu_prepare() is not called for each online cpu.13731373- */13741374- if (!cret) {13751375- ret = cpuhp_setup_state(CPUHP_PERF_X86_UNCORE_PREP,13761376- "perf/x86/intel/uncore:prepare",13771377- uncore_cpu_prepare, NULL);13781378- if (ret)13791379- goto err;13801380- } else {13811381- cpuhp_setup_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP,13821382- "perf/x86/intel/uncore:prepare",13831383- uncore_cpu_prepare, NULL);13841384- }13851385- first_init = 1;13861386- cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_STARTING,13871387- "perf/x86/uncore:starting",13881388- uncore_cpu_starting, uncore_cpu_dying);13891389- first_init = 0;13901390- cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE,13911391- "perf/x86/uncore:online",13921392- uncore_event_cpu_online, uncore_event_cpu_offline);13921392+ /* Install hotplug callbacks to setup the targets for each package */13931393+ ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE,13941394+ "perf/x86/intel/uncore:online",13951395+ uncore_event_cpu_online,13961396+ uncore_event_cpu_offline);13971397+ if (ret)13981398+ goto err;13931399 return 0;1394140013951401err:13961396- /* Undo box->init_box() */13971397- on_each_cpu_mask(&uncore_cpu_mask, uncore_exit_boxes, NULL, 1);13981402 uncore_types_exit(uncore_msr_uncores);13991403 uncore_pci_exit();14001404 return ret;···1381142913821430static void __exit intel_uncore_exit(void)13831431{13841384- cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_UNCORE_ONLINE);13851385- cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_UNCORE_STARTING);13861386- cpuhp_remove_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP);14321432+ cpuhp_remove_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE);13871433 uncore_types_exit(uncore_msr_uncores);13881434 uncore_pci_exit();13891435}
···4646static struct microcode_ops *microcode_ops;4747static bool dis_ucode_ldr = true;48484949+bool initrd_gone;5050+4951LIST_HEAD(microcode_cache);50525153/*···192190static int __init save_microcode_in_initrd(void)193191{194192 struct cpuinfo_x86 *c = &boot_cpu_data;193193+ int ret = -EINVAL;195194196195 switch (c->x86_vendor) {197196 case X86_VENDOR_INTEL:198197 if (c->x86 >= 6)199199- return save_microcode_in_initrd_intel();198198+ ret = save_microcode_in_initrd_intel();200199 break;201200 case X86_VENDOR_AMD:202201 if (c->x86 >= 0x10)203203- return save_microcode_in_initrd_amd(c->x86);202202+ ret = save_microcode_in_initrd_amd(c->x86);204203 break;205204 default:206205 break;207206 }208207209209- return -EINVAL;208208+ initrd_gone = true;209209+210210+ return ret;210211}211212212213struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa)···252247 * has the virtual address of the beginning of the initrd. It also253248 * possibly relocates the ramdisk. In either case, initrd_start contains254249 * the updated address so use that instead.250250+ *251251+ * initrd_gone is for the hotplug case where we've thrown out initrd252252+ * already.255253 */256256- if (!use_pa && initrd_start)257257- start = initrd_start;254254+ if (!use_pa) {255255+ if (initrd_gone)256256+ return (struct cpio_data){ NULL, 0, "" };257257+ if (initrd_start)258258+ start = initrd_start;259259+ }258260259261 return find_cpio_data(path, (void *)start, size, NULL);260262#else /* !CONFIG_BLK_DEV_INITRD */
+1-8
arch/x86/kernel/cpu/microcode/intel.c
···41414242static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin";43434444-/* Current microcode patch used in early patching */4444+/* Current microcode patch used in early patching on the APs. */4545struct microcode_intel *intel_ucode_patch;46464747static inline bool cpu_signatures_match(unsigned int s1, unsigned int p1,···607607 struct ucode_cpu_info uci;608608 struct cpio_data cp;609609610610- /*611611- * AP loading didn't find any microcode patch, no need to save anything.612612- */613613- if (!intel_ucode_patch || IS_ERR(intel_ucode_patch))614614- return 0;615615-616610 if (!load_builtin_intel_microcode(&cp))617611 cp = find_microcode_in_initrd(ucode_path, false);618612···621627622628 return 0;623629}624624-625630626631/*627632 * @res_patch, output: a pointer to the patch we found.
+3-1
arch/x86/kernel/fpu/core.c
···99#include <asm/fpu/regset.h>1010#include <asm/fpu/signal.h>1111#include <asm/fpu/types.h>1212+#include <asm/fpu/xstate.h>1213#include <asm/traps.h>13141415#include <linux/hardirq.h>···184183 * it will #GP. Make sure it is replaced after the memset().185184 */186185 if (static_cpu_has(X86_FEATURE_XSAVES))187187- state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT;186186+ state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT |187187+ xfeatures_mask;188188189189 if (static_cpu_has(X86_FEATURE_FXSR))190190 fpstate_init_fxstate(&state->fxsave);
···269269 efi_scratch.use_pgd = true;270270271271 /*272272+ * Certain firmware versions are way too sentimential and still believe273273+ * they are exclusive and unquestionable owners of the first physical page,274274+ * even though they explicitly mark it as EFI_CONVENTIONAL_MEMORY275275+ * (but then write-access it later during SetVirtualAddressMap()).276276+ *277277+ * Create a 1:1 mapping for this page, to avoid triple faults during early278278+ * boot with such firmware. We are free to hand this page to the BIOS,279279+ * as trim_bios_range() will reserve the first page and isolate it away280280+ * from memory allocators anyway.281281+ */282282+ if (kernel_map_pages_in_pgd(pgd, 0x0, 0x0, 1, _PAGE_RW)) {283283+ pr_err("Failed to create 1:1 mapping for the first page!\n");284284+ return 1;285285+ }286286+287287+ /*272288 * When making calls to the firmware everything needs to be 1:1273289 * mapped and addressable with 32-bit pointers. Map the kernel274290 * text and allocate a new stack because we can't rely on the
+1-1
arch/xtensa/kernel/setup.c
···419419420420void cpu_reset(void)421421{422422-#if XCHAL_HAVE_PTP_MMU422422+#if XCHAL_HAVE_PTP_MMU && IS_ENABLED(CONFIG_MMU)423423 local_irq_disable();424424 /*425425 * We have full MMU: all autoload ways, ways 7, 8 and 9 of DTLB must
+1
crypto/algapi.c
···356356 struct crypto_larval *larval;357357 int err;358358359359+ alg->cra_flags &= ~CRYPTO_ALG_DEAD;359360 err = crypto_check_alg(alg);360361 if (err)361362 return err;
+4-2
drivers/ata/libata-core.c
···1702170217031703 if (qc->err_mask & ~AC_ERR_OTHER)17041704 qc->err_mask &= ~AC_ERR_OTHER;17051705+ } else if (qc->tf.command == ATA_CMD_REQ_SENSE_DATA) {17061706+ qc->result_tf.command |= ATA_SENSE;17051707 }1706170817071709 /* finish up */···43584356 { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 },4359435743604358 /*43614361- * Device times out with higher max sects.43594359+ * These devices time out with higher max sects.43624360 * https://bugzilla.kernel.org/show_bug.cgi?id=12167143634361 */43644364- { "LITEON CX1-JB256-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 },43624362+ { "LITEON CX1-JB*-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 },4365436343664364 /* Devices we expect to fail diagnostics */43674365
···153153154154 /* context for suspend/resume */155155 unsigned int dma_tdfdq;156156+157157+ bool is_suspended;156158};157159158160#define FIST_COMPLETION_QUEUE 93···259257 BUG_ON(desc_num >= ALLOC_DECS_NUM);260258 c = cdd->chan_busy[desc_num];261259 cdd->chan_busy[desc_num] = NULL;260260+261261+ /* Usecount for chan_busy[], paired with push_desc_queue() */262262+ pm_runtime_put(cdd->ddev.dev);263263+262264 return c;263265}264266···323317324318 while (val) {325319 u32 desc, len;326326- int error;327320328328- error = pm_runtime_get(cdd->ddev.dev);329329- if (error < 0)330330- dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",331331- __func__, error);321321+ /*322322+ * This should never trigger, see the comments in323323+ * push_desc_queue()324324+ */325325+ WARN_ON(cdd->is_suspended);332326333327 q_num = __fls(val);334328 val &= ~(1 << q_num);···349343 c->residue = pd_trans_len(c->desc->pd6) - len;350344 dma_cookie_complete(&c->txd);351345 dmaengine_desc_get_callback_invoke(&c->txd, NULL);352352-353353- pm_runtime_mark_last_busy(cdd->ddev.dev);354354- pm_runtime_put_autosuspend(cdd->ddev.dev);355346 }356347 }357348 return IRQ_HANDLED;···450447 */451448 __iowmb();452449450450+ /*451451+ * DMA transfers can take at least 200ms to complete with USB mass452452+ * storage connected. To prevent autosuspend timeouts, we must use453453+ * pm_runtime_get/put() when chan_busy[] is modified. This will get454454+ * cleared in desc_to_chan() or cppi41_stop_chan() depending on the455455+ * outcome of the transfer.456456+ */457457+ pm_runtime_get(cdd->ddev.dev);458458+453459 desc_phys = lower_32_bits(c->desc_phys);454460 desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc);455461 WARN_ON(cdd->chan_busy[desc_num]);···469457 cppi_writel(reg, cdd->qmgr_mem + QMGR_QUEUE_D(c->q_num));470458}471459472472-static void pending_desc(struct cppi41_channel *c)460460+/*461461+ * Caller must hold cdd->lock to prevent push_desc_queue()462462+ * getting called out of order. We have both cppi41_dma_issue_pending()463463+ * and cppi41_runtime_resume() call this function.464464+ */465465+static void cppi41_run_queue(struct cppi41_dd *cdd)473466{474474- struct cppi41_dd *cdd = c->cdd;475475- unsigned long flags;467467+ struct cppi41_channel *c, *_c;476468477477- spin_lock_irqsave(&cdd->lock, flags);478478- list_add_tail(&c->node, &cdd->pending);479479- spin_unlock_irqrestore(&cdd->lock, flags);469469+ list_for_each_entry_safe(c, _c, &cdd->pending, node) {470470+ push_desc_queue(c);471471+ list_del(&c->node);472472+ }480473}481474482475static void cppi41_dma_issue_pending(struct dma_chan *chan)483476{484477 struct cppi41_channel *c = to_cpp41_chan(chan);485478 struct cppi41_dd *cdd = c->cdd;479479+ unsigned long flags;486480 int error;487481488482 error = pm_runtime_get(cdd->ddev.dev);···500482 return;501483 }502484503503- if (likely(pm_runtime_active(cdd->ddev.dev)))504504- push_desc_queue(c);505505- else506506- pending_desc(c);485485+ spin_lock_irqsave(&cdd->lock, flags);486486+ list_add_tail(&c->node, &cdd->pending);487487+ if (!cdd->is_suspended)488488+ cppi41_run_queue(cdd);489489+ spin_unlock_irqrestore(&cdd->lock, flags);507490508491 pm_runtime_mark_last_busy(cdd->ddev.dev);509492 pm_runtime_put_autosuspend(cdd->ddev.dev);···723704724705 WARN_ON(!cdd->chan_busy[desc_num]);725706 cdd->chan_busy[desc_num] = NULL;707707+708708+ /* Usecount for chan_busy[], paired with push_desc_queue() */709709+ pm_runtime_put(cdd->ddev.dev);726710727711 return 0;728712}···11721150static int __maybe_unused cppi41_runtime_suspend(struct device *dev)11731151{11741152 struct cppi41_dd *cdd = dev_get_drvdata(dev);11531153+ unsigned long flags;1175115411551155+ spin_lock_irqsave(&cdd->lock, flags);11561156+ cdd->is_suspended = true;11761157 WARN_ON(!list_empty(&cdd->pending));11581158+ spin_unlock_irqrestore(&cdd->lock, flags);1177115911781160 return 0;11791161}···11851159static int __maybe_unused cppi41_runtime_resume(struct device *dev)11861160{11871161 struct cppi41_dd *cdd = dev_get_drvdata(dev);11881188- struct cppi41_channel *c, *_c;11891162 unsigned long flags;1190116311911164 spin_lock_irqsave(&cdd->lock, flags);11921192- list_for_each_entry_safe(c, _c, &cdd->pending, node) {11931193- push_desc_queue(c);11941194- list_del(&c->node);11951195- }11651165+ cdd->is_suspended = false;11661166+ cppi41_run_queue(cdd);11961167 spin_unlock_irqrestore(&cdd->lock, flags);1197116811981169 return 0;
+6-13
drivers/dma/pl330.c
···16991699static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)17001700{17011701 struct pl330_thread *thrd = NULL;17021702- unsigned long flags;17031702 int chans, i;1704170317051704 if (pl330->state == DYING)17061705 return NULL;1707170617081707 chans = pl330->pcfg.num_chan;17091709-17101710- spin_lock_irqsave(&pl330->lock, flags);1711170817121709 for (i = 0; i < chans; i++) {17131710 thrd = &pl330->channels[i];···17231726 thrd = NULL;17241727 }1725172817261726- spin_unlock_irqrestore(&pl330->lock, flags);17271727-17281729 return thrd;17291730}17301731···17401745static void pl330_release_channel(struct pl330_thread *thrd)17411746{17421747 struct pl330_dmac *pl330;17431743- unsigned long flags;1744174817451749 if (!thrd || thrd->free)17461750 return;···1751175717521758 pl330 = thrd->dmac;1753175917541754- spin_lock_irqsave(&pl330->lock, flags);17551760 _free_event(thrd, thrd->ev);17561761 thrd->free = true;17571757- spin_unlock_irqrestore(&pl330->lock, flags);17581762}1759176317601764/* Initialize the structure for PL330 configuration, that can be used···21142122 struct pl330_dmac *pl330 = pch->dmac;21152123 unsigned long flags;2116212421172117- spin_lock_irqsave(&pch->lock, flags);21252125+ spin_lock_irqsave(&pl330->lock, flags);2118212621192127 dma_cookie_init(chan);21202128 pch->cyclic = false;2121212921222130 pch->thread = pl330_request_channel(pl330);21232131 if (!pch->thread) {21242124- spin_unlock_irqrestore(&pch->lock, flags);21322132+ spin_unlock_irqrestore(&pl330->lock, flags);21252133 return -ENOMEM;21262134 }2127213521282136 tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch);2129213721302130- spin_unlock_irqrestore(&pch->lock, flags);21382138+ spin_unlock_irqrestore(&pl330->lock, flags);2131213921322140 return 1;21332141}···22302238static void pl330_free_chan_resources(struct dma_chan *chan)22312239{22322240 struct dma_pl330_chan *pch = to_pchan(chan);22412241+ struct pl330_dmac *pl330 = pch->dmac;22332242 unsigned long flags;2234224322352244 tasklet_kill(&pch->task);2236224522372246 pm_runtime_get_sync(pch->dmac->ddma.dev);22382238- spin_lock_irqsave(&pch->lock, flags);22472247+ spin_lock_irqsave(&pl330->lock, flags);2239224822402249 pl330_release_channel(pch->thread);22412250 pch->thread = NULL;···22442251 if (pch->cyclic)22452252 list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool);2246225322472247- spin_unlock_irqrestore(&pch->lock, flags);22542254+ spin_unlock_irqrestore(&pl330->lock, flags);22482255 pm_runtime_mark_last_busy(pch->dmac->ddma.dev);22492256 pm_runtime_put_autosuspend(pch->dmac->ddma.dev);22502257}
+3-11
drivers/firmware/efi/libstub/fdt.c
···187187struct exit_boot_struct {188188 efi_memory_desc_t *runtime_map;189189 int *runtime_entry_count;190190+ void *new_fdt_addr;190191};191192192193static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg,···203202 efi_get_virtmap(*map->map, *map->map_size, *map->desc_size,204203 p->runtime_map, p->runtime_entry_count);205204206206- return EFI_SUCCESS;205205+ return update_fdt_memmap(p->new_fdt_addr, map);207206}208207209208/*···301300302301 priv.runtime_map = runtime_map;303302 priv.runtime_entry_count = &runtime_entry_count;303303+ priv.new_fdt_addr = (void *)*new_fdt_addr;304304 status = efi_exit_boot_services(sys_table, handle, &map, &priv,305305 exit_boot_func);306306307307 if (status == EFI_SUCCESS) {308308 efi_set_virtual_address_map_t *svam;309309-310310- status = update_fdt_memmap((void *)*new_fdt_addr, &map);311311- if (status != EFI_SUCCESS) {312312- /*313313- * The kernel won't get far without the memory map, but314314- * may still be able to print something meaningful so315315- * return success here.316316- */317317- return EFI_SUCCESS;318318- }319309320310 /* Install the new virtual address map */321311 svam = sys_table->runtime->set_virtual_address_map;
+3-1
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
···254254 }255255 WREG32(mmHDP_REG_COHERENCY_FLUSH_CNTL, 0);256256257257+ if (adev->mode_info.num_crtc)258258+ amdgpu_display_set_vga_render_state(adev, false);259259+257260 gmc_v6_0_mc_stop(adev, &save);258261259262 if (gmc_v6_0_wait_for_idle((void *)adev)) {···286283 dev_warn(adev->dev, "Wait for MC idle timedout !\n");287284 }288285 gmc_v6_0_mc_resume(adev, &save);289289- amdgpu_display_set_vga_render_state(adev, false);290286}291287292288static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
+8-5
drivers/gpu/drm/drm_atomic.c
···20322032 }2033203320342034 for_each_crtc_in_state(state, crtc, crtc_state, i) {20352035+ struct drm_pending_vblank_event *event = crtc_state->event;20352036 /*20362036- * TEST_ONLY and PAGE_FLIP_EVENT are mutually20372037- * exclusive, if they weren't, this code should be20382038- * called on success for TEST_ONLY too.20372037+ * Free the allocated event. drm_atomic_helper_setup_commit20382038+ * can allocate an event too, so only free it if it's ours20392039+ * to prevent a double free in drm_atomic_state_clear.20392040 */20402040- if (crtc_state->event)20412041- drm_event_cancel_free(dev, &crtc_state->event->base);20412041+ if (event && (event->base.fence || event->base.file_priv)) {20422042+ drm_event_cancel_free(dev, &event->base);20432043+ crtc_state->event = NULL;20442044+ }20422045 }2043204620442047 if (!fence_state)
-9
drivers/gpu/drm/drm_atomic_helper.c
···1666166616671667 funcs = plane->helper_private;1668166816691669- if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc))16701670- continue;16711671-16721669 if (funcs->prepare_fb) {16731670 ret = funcs->prepare_fb(plane, plane_state);16741671 if (ret)···16801683 const struct drm_plane_helper_funcs *funcs;1681168416821685 if (j >= i)16831683- continue;16841684-16851685- if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc))16861686 continue;1687168716881688 funcs = plane->helper_private;···1947195319481954 for_each_plane_in_state(old_state, plane, plane_state, i) {19491955 const struct drm_plane_helper_funcs *funcs;19501950-19511951- if (!drm_atomic_helper_framebuffer_changed(dev, old_state, plane_state->crtc))19521952- continue;1953195619541957 funcs = plane->helper_private;19551958
+18-5
drivers/gpu/drm/drm_connector.c
···225225226226 INIT_LIST_HEAD(&connector->probed_modes);227227 INIT_LIST_HEAD(&connector->modes);228228+ mutex_init(&connector->mutex);228229 connector->edid_blob_ptr = NULL;229230 connector->status = connector_status_unknown;230231···360359 connector->funcs->atomic_destroy_state(connector,361360 connector->state);362361362362+ mutex_destroy(&connector->mutex);363363+363364 memset(connector, 0, sizeof(*connector));364365}365366EXPORT_SYMBOL(drm_connector_cleanup);···377374 */378375int drm_connector_register(struct drm_connector *connector)379376{380380- int ret;377377+ int ret = 0;381378382382- if (connector->registered)379379+ if (!connector->dev->registered)383380 return 0;381381+382382+ mutex_lock(&connector->mutex);383383+ if (connector->registered)384384+ goto unlock;384385385386 ret = drm_sysfs_connector_add(connector);386387 if (ret)387387- return ret;388388+ goto unlock;388389389390 ret = drm_debugfs_connector_add(connector);390391 if (ret) {···404397 drm_mode_object_register(connector->dev, &connector->base);405398406399 connector->registered = true;407407- return 0;400400+ goto unlock;408401409402err_debugfs:410403 drm_debugfs_connector_remove(connector);411404err_sysfs:412405 drm_sysfs_connector_remove(connector);406406+unlock:407407+ mutex_unlock(&connector->mutex);413408 return ret;414409}415410EXPORT_SYMBOL(drm_connector_register);···424415 */425416void drm_connector_unregister(struct drm_connector *connector)426417{427427- if (!connector->registered)418418+ mutex_lock(&connector->mutex);419419+ if (!connector->registered) {420420+ mutex_unlock(&connector->mutex);428421 return;422422+ }429423430424 if (connector->funcs->early_unregister)431425 connector->funcs->early_unregister(connector);···437425 drm_debugfs_connector_remove(connector);438426439427 connector->registered = false;428428+ mutex_unlock(&connector->mutex);440429}441430EXPORT_SYMBOL(drm_connector_unregister);442431
+4
drivers/gpu/drm/drm_drv.c
···745745 if (ret)746746 goto err_minors;747747748748+ dev->registered = true;749749+748750 if (dev->driver->load) {749751 ret = dev->driver->load(dev, flags);750752 if (ret)···786784 struct drm_map_list *r_list, *list_temp;787785788786 drm_lastclose(dev);787787+788788+ dev->registered = false;789789790790 if (drm_core_check_feature(dev, DRIVER_MODESET))791791 drm_modeset_unregister_all(dev);
···85858686 __drm_atomic_helper_plane_duplicate_state(plane, state);87878888+ intel_state->vma = NULL;8989+8890 return state;8991}9092···102100intel_plane_destroy_state(struct drm_plane *plane,103101 struct drm_plane_state *state)104102{103103+ struct i915_vma *vma;104104+105105+ vma = fetch_and_zero(&to_intel_plane_state(state)->vma);106106+107107+ /*108108+ * FIXME: Normally intel_cleanup_plane_fb handles destruction of vma.109109+ * We currently don't clear all planes during driver unload, so we have110110+ * to be able to unpin vma here for now.111111+ *112112+ * Normally this can only happen during unload when kmscon is disabled113113+ * and userspace doesn't attempt to set a framebuffer at all.114114+ */115115+ if (vma) {116116+ mutex_lock(&plane->dev->struct_mutex);117117+ intel_unpin_fb_vma(vma);118118+ mutex_unlock(&plane->dev->struct_mutex);119119+ }120120+105121 drm_atomic_helper_plane_destroy_state(plane, state);106122}107123
+42-83
drivers/gpu/drm/i915/intel_display.c
···22352235 i915_vma_pin_fence(vma);22362236 }2237223722382238+ i915_vma_get(vma);22382239err:22392240 intel_runtime_pm_put(dev_priv);22402241 return vma;22412242}2242224322432243-void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation)22442244+void intel_unpin_fb_vma(struct i915_vma *vma)22442245{22452245- struct drm_i915_gem_object *obj = intel_fb_obj(fb);22462246- struct i915_ggtt_view view;22472247- struct i915_vma *vma;22482248-22492249- WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));22502250-22512251- intel_fill_fb_ggtt_view(&view, fb, rotation);22522252- vma = i915_gem_object_to_ggtt(obj, &view);22462246+ lockdep_assert_held(&vma->vm->dev->struct_mutex);2253224722542248 if (WARN_ON_ONCE(!vma))22552249 return;2256225022572251 i915_vma_unpin_fence(vma);22582252 i915_gem_object_unpin_from_display_plane(vma);22532253+ i915_vma_put(vma);22592254}2260225522612256static int intel_fb_pitch(const struct drm_framebuffer *fb, int plane,···27452750 struct drm_device *dev = intel_crtc->base.dev;27462751 struct drm_i915_private *dev_priv = to_i915(dev);27472752 struct drm_crtc *c;27482748- struct intel_crtc *i;27492753 struct drm_i915_gem_object *obj;27502754 struct drm_plane *primary = intel_crtc->base.primary;27512755 struct drm_plane_state *plane_state = primary->state;···27692775 * an fb with another CRTC instead27702776 */27712777 for_each_crtc(dev, c) {27722772- i = to_intel_crtc(c);27782778+ struct intel_plane_state *state;2773277927742780 if (c == &intel_crtc->base)27752781 continue;2776278227772777- if (!i->active)27832783+ if (!to_intel_crtc(c)->active)27782784 continue;2779278527802780- fb = c->primary->fb;27812781- if (!fb)27862786+ state = to_intel_plane_state(c->primary->state);27872787+ if (!state->vma)27822788 continue;2783278927842784- obj = intel_fb_obj(fb);27852785- if (i915_gem_object_ggtt_offset(obj, NULL) == plane_config->base) {27902790+ if (intel_plane_ggtt_offset(state) == plane_config->base) {27912791+ fb = c->primary->fb;27862792 drm_framebuffer_reference(fb);27872793 goto valid_fb;27882794 }···28032809 return;2804281028052811valid_fb:28122812+ mutex_lock(&dev->struct_mutex);28132813+ intel_state->vma =28142814+ intel_pin_and_fence_fb_obj(fb, primary->state->rotation);28152815+ mutex_unlock(&dev->struct_mutex);28162816+ if (IS_ERR(intel_state->vma)) {28172817+ DRM_ERROR("failed to pin boot fb on pipe %d: %li\n",28182818+ intel_crtc->pipe, PTR_ERR(intel_state->vma));28192819+28202820+ intel_state->vma = NULL;28212821+ drm_framebuffer_unreference(fb);28222822+ return;28232823+ }28242824+28062825 plane_state->src_x = 0;28072826 plane_state->src_y = 0;28082827 plane_state->src_w = fb->width << 16;···31113104 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]);31123105 if (INTEL_GEN(dev_priv) >= 4) {31133106 I915_WRITE(DSPSURF(plane),31143114- intel_fb_gtt_offset(fb, rotation) +31073107+ intel_plane_ggtt_offset(plane_state) +31153108 intel_crtc->dspaddr_offset);31163109 I915_WRITE(DSPTILEOFF(plane), (y << 16) | x);31173110 I915_WRITE(DSPLINOFF(plane), linear_offset);31183111 } else {31193112 I915_WRITE(DSPADDR(plane),31203120- intel_fb_gtt_offset(fb, rotation) +31133113+ intel_plane_ggtt_offset(plane_state) +31213114 intel_crtc->dspaddr_offset);31223115 }31233116 POSTING_READ(reg);···3214320732153208 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]);32163209 I915_WRITE(DSPSURF(plane),32173217- intel_fb_gtt_offset(fb, rotation) +32103210+ intel_plane_ggtt_offset(plane_state) +32183211 intel_crtc->dspaddr_offset);32193212 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {32203213 I915_WRITE(DSPOFFSET(plane), (y << 16) | x);···3235322832363229 return intel_tile_width_bytes(dev_priv, fb_modifier, cpp);32373230 }32383238-}32393239-32403240-u32 intel_fb_gtt_offset(struct drm_framebuffer *fb,32413241- unsigned int rotation)32423242-{32433243- struct drm_i915_gem_object *obj = intel_fb_obj(fb);32443244- struct i915_ggtt_view view;32453245- struct i915_vma *vma;32463246-32473247- intel_fill_fb_ggtt_view(&view, fb, rotation);32483248-32493249- vma = i915_gem_object_to_ggtt(obj, &view);32503250- if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n",32513251- view.type))32523252- return -1;32533253-32543254- return i915_ggtt_offset(vma);32553231}3256323232573233static void skl_detach_scaler(struct intel_crtc *intel_crtc, int id)···34313441 }3432344234333443 I915_WRITE(PLANE_SURF(pipe, 0),34343434- intel_fb_gtt_offset(fb, rotation) + surf_addr);34443444+ intel_plane_ggtt_offset(plane_state) + surf_addr);3435344534363446 POSTING_READ(PLANE_SURF(pipe, 0));34373447}···1152611536 flush_work(&work->mmio_work);11527115371152811538 mutex_lock(&dev->struct_mutex);1152911529- intel_unpin_fb_obj(work->old_fb, primary->state->rotation);1153911539+ intel_unpin_fb_vma(work->old_vma);1153011540 i915_gem_object_put(work->pending_flip_obj);1153111541 mutex_unlock(&dev->struct_mutex);1153211542···1223612246 goto cleanup_pending;1223712247 }12238122481223912239- work->gtt_offset = intel_fb_gtt_offset(fb, primary->state->rotation);1224012240- work->gtt_offset += intel_crtc->dspaddr_offset;1224912249+ work->old_vma = to_intel_plane_state(primary->state)->vma;1225012250+ to_intel_plane_state(primary->state)->vma = vma;1225112251+1225212252+ work->gtt_offset = i915_ggtt_offset(vma) + intel_crtc->dspaddr_offset;1224112253 work->rotation = crtc->primary->state->rotation;12242122541224312255 /*···1229312301cleanup_request:1229412302 i915_add_request_no_flush(request);1229512303cleanup_unpin:1229612296- intel_unpin_fb_obj(fb, crtc->primary->state->rotation);1230412304+ to_intel_plane_state(primary->state)->vma = work->old_vma;1230512305+ intel_unpin_fb_vma(vma);1229712306cleanup_pending:1229812307 atomic_dec(&intel_crtc->unpin_work_count);1229912308unlock:···1478714794 DRM_DEBUG_KMS("failed to pin object\n");1478814795 return PTR_ERR(vma);1478914796 }1479714797+1479814798+ to_intel_plane_state(new_state)->vma = vma;1479014799 }14791148001479214801 return 0;···1480714812intel_cleanup_plane_fb(struct drm_plane *plane,1480814813 struct drm_plane_state *old_state)1480914814{1481014810- struct drm_i915_private *dev_priv = to_i915(plane->dev);1481114811- struct intel_plane_state *old_intel_state;1481214812- struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb);1481314813- struct drm_i915_gem_object *obj = intel_fb_obj(plane->state->fb);1481514815+ struct i915_vma *vma;14814148161481514815- old_intel_state = to_intel_plane_state(old_state);1481614816-1481714817- if (!obj && !old_obj)1481814818- return;1481914819-1482014820- if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR ||1482114821- !INTEL_INFO(dev_priv)->cursor_needs_physical))1482214822- intel_unpin_fb_obj(old_state->fb, old_state->rotation);1481714817+ /* Should only be called after a successful intel_prepare_plane_fb()! */1481814818+ vma = fetch_and_zero(&to_intel_plane_state(old_state)->vma);1481914819+ if (vma)1482014820+ intel_unpin_fb_vma(vma);1482314821}14824148221482514823int···1515415166 if (!obj)1515515167 addr = 0;1515615168 else if (!INTEL_INFO(dev_priv)->cursor_needs_physical)1515715157- addr = i915_gem_object_ggtt_offset(obj, NULL);1516915169+ addr = intel_plane_ggtt_offset(state);1515815170 else1515915171 addr = obj->phys_handle->busaddr;1516015172···1705417066void intel_modeset_gem_init(struct drm_device *dev)1705517067{1705617068 struct drm_i915_private *dev_priv = to_i915(dev);1705717057- struct drm_crtc *c;1705817058- struct drm_i915_gem_object *obj;17059170691706017070 intel_init_gt_powersave(dev_priv);17061170711706217072 intel_modeset_init_hw(dev);17063170731706417074 intel_setup_overlay(dev_priv);1706517065-1706617066- /*1706717067- * Make sure any fbs we allocated at startup are properly1706817068- * pinned & fenced. When we do the allocation it's too early1706917069- * for this.1707017070- */1707117071- for_each_crtc(dev, c) {1707217072- struct i915_vma *vma;1707317073-1707417074- obj = intel_fb_obj(c->primary->fb);1707517075- if (obj == NULL)1707617076- continue;1707717077-1707817078- mutex_lock(&dev->struct_mutex);1707917079- vma = intel_pin_and_fence_fb_obj(c->primary->fb,1708017080- c->primary->state->rotation);1708117081- mutex_unlock(&dev->struct_mutex);1708217082- if (IS_ERR(vma)) {1708317083- DRM_ERROR("failed to pin boot fb on pipe %d\n",1708417084- to_intel_crtc(c)->pipe);1708517085- drm_framebuffer_unreference(c->primary->fb);1708617086- c->primary->fb = NULL;1708717087- c->primary->crtc = c->primary->state->crtc = NULL;1708817088- update_state_fb(c->primary);1708917089- c->state->plane_mask &= ~(1 << drm_plane_index(c->primary));1709017090- }1709117091- }1709217075}17093170761709417077int intel_connector_register(struct drm_connector *connector)
···238238239239 mutex_lock(&data->lock);240240241241- while (cnt || (cnt = max30100_fifo_count(data) > 0)) {241241+ while (cnt || (cnt = max30100_fifo_count(data)) > 0) {242242 ret = max30100_read_measurement(data);243243 if (ret)244244 break;
+4-2
drivers/iio/humidity/dht11.c
···7171 * a) select an implementation using busy loop polling on those systems7272 * b) use the checksum to do some probabilistic decoding7373 */7474-#define DHT11_START_TRANSMISSION 18 /* ms */7474+#define DHT11_START_TRANSMISSION_MIN 18000 /* us */7575+#define DHT11_START_TRANSMISSION_MAX 20000 /* us */7576#define DHT11_MIN_TIMERES 34000 /* ns */7677#define DHT11_THRESHOLD 49000 /* ns */7778#define DHT11_AMBIG_LOW 23000 /* ns */···229228 ret = gpio_direction_output(dht11->gpio, 0);230229 if (ret)231230 goto err;232232- msleep(DHT11_START_TRANSMISSION);231231+ usleep_range(DHT11_START_TRANSMISSION_MIN,232232+ DHT11_START_TRANSMISSION_MAX);233233 ret = gpio_direction_input(dht11->gpio);234234 if (ret)235235 goto err;
+2-2
drivers/input/rmi4/rmi_driver.c
···901901 data->enabled = true;902902 if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {903903 retval = disable_irq_wake(irq);904904- if (!retval)904904+ if (retval)905905 dev_warn(&rmi_dev->dev,906906 "Failed to disable irq for wake: %d\n",907907 retval);···936936 disable_irq(irq);937937 if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {938938 retval = enable_irq_wake(irq);939939- if (!retval)939939+ if (retval)940940 dev_warn(&rmi_dev->dev,941941 "Failed to enable irq for wake: %d\n",942942 retval);
···116116 int speed = 2;117117118118 if (!xcv) {119119- dev_err(&xcv->pdev->dev,120120- "XCV init not done, probe may have failed\n");119119+ pr_err("XCV init not done, probe may have failed\n");121120 return;122121 }123122
+28-5
drivers/net/ethernet/emulex/benet/be_main.c
···362362 status = -EPERM;363363 goto err;364364 }365365-done:365365+366366+ /* Remember currently programmed MAC */366367 ether_addr_copy(adapter->dev_mac, addr->sa_data);368368+done:367369 ether_addr_copy(netdev->dev_addr, addr->sa_data);368370 dev_info(dev, "MAC address changed to %pM\n", addr->sa_data);369371 return 0;···36203618{36213619 /* Don't delete MAC on BE3 VFs without FILTMGMT privilege */36223620 if (!BEx_chip(adapter) || !be_virtfn(adapter) ||36233623- check_privilege(adapter, BE_PRIV_FILTMGMT))36213621+ check_privilege(adapter, BE_PRIV_FILTMGMT)) {36243622 be_dev_mac_del(adapter, adapter->pmac_id[0]);36233623+ eth_zero_addr(adapter->dev_mac);36243624+ }3625362536263626 be_clear_uc_list(adapter);36273627 be_clear_mc_list(adapter);···37773773 if (status)37783774 return status;3779377537803780- /* Don't add MAC on BE3 VFs without FILTMGMT privilege */37813781- if (!BEx_chip(adapter) || !be_virtfn(adapter) ||37823782- check_privilege(adapter, BE_PRIV_FILTMGMT)) {37763776+ /* Normally this condition usually true as the ->dev_mac is zeroed.37773777+ * But on BE3 VFs the initial MAC is pre-programmed by PF and37783778+ * subsequent be_dev_mac_add() can fail (after fresh boot)37793779+ */37803780+ if (!ether_addr_equal(adapter->dev_mac, adapter->netdev->dev_addr)) {37813781+ int old_pmac_id = -1;37823782+37833783+ /* Remember old programmed MAC if any - can happen on BE3 VF */37843784+ if (!is_zero_ether_addr(adapter->dev_mac))37853785+ old_pmac_id = adapter->pmac_id[0];37863786+37833787 status = be_dev_mac_add(adapter, adapter->netdev->dev_addr);37843788 if (status)37853789 return status;37903790+37913791+ /* Delete the old programmed MAC as we successfully programmed37923792+ * a new MAC37933793+ */37943794+ if (old_pmac_id >= 0 && old_pmac_id != adapter->pmac_id[0])37953795+ be_dev_mac_del(adapter, old_pmac_id);37963796+37863797 ether_addr_copy(adapter->dev_mac, adapter->netdev->dev_addr);37873798 }37883799···4571455245724553 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);45734554 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);45554555+45564556+ /* Initial MAC for BE3 VFs is already programmed by PF */45574557+ if (BEx_chip(adapter) && be_virtfn(adapter))45584558+ memcpy(adapter->dev_mac, mac, ETH_ALEN);45744559 }4575456045764561 return 0;
···620620 u32 out[MLX5_ST_SZ_DW(qtct_reg)];621621622622 if (!MLX5_CAP_GEN(mdev, ets))623623- return -ENOTSUPP;623623+ return -EOPNOTSUPP;624624625625 return mlx5_core_access_reg(mdev, in, inlen, out, sizeof(out),626626 MLX5_REG_QETCR, 0, 1);···632632 u32 in[MLX5_ST_SZ_DW(qtct_reg)];633633634634 if (!MLX5_CAP_GEN(mdev, ets))635635- return -ENOTSUPP;635635+ return -EOPNOTSUPP;636636637637 memset(in, 0, sizeof(in));638638 return mlx5_core_access_reg(mdev, in, sizeof(in), out, outlen,
+1-1
drivers/net/ethernet/mellanox/mlx5/core/vport.c
···532532 if (!MLX5_CAP_GEN(mdev, vport_group_manager))533533 return -EACCES;534534 if (!MLX5_CAP_ESW(mdev, nic_vport_node_guid_modify))535535- return -ENOTSUPP;535535+ return -EOPNOTSUPP;536536537537 in = mlx5_vzalloc(inlen);538538 if (!in)
···11641164 .frame_limit = IWL_FRAME_LIMIT,11651165 };1166116611671167- /* Make sure reserved queue is still marked as such (or allocated) */11681168- mvm->queue_info[mvm_sta->reserved_queue].status =11691169- IWL_MVM_QUEUE_RESERVED;11671167+ /* Make sure reserved queue is still marked as such (if allocated) */11681168+ if (mvm_sta->reserved_queue != IEEE80211_INVAL_HW_QUEUE)11691169+ mvm->queue_info[mvm_sta->reserved_queue].status =11701170+ IWL_MVM_QUEUE_RESERVED;1170117111711172 for (i = 0; i <= IWL_MAX_TID_COUNT; i++) {11721173 struct iwl_mvm_tid_data *tid_data = &mvm_sta->tid_data[i];
···731731 int reg)732732{733733 struct byt_community *comm = byt_get_community(vg, offset);734734- u32 reg_offset = 0;734734+ u32 reg_offset;735735736736 if (!comm)737737 return NULL;738738739739 offset -= comm->pin_base;740740- if (reg == BYT_INT_STAT_REG)740740+ switch (reg) {741741+ case BYT_INT_STAT_REG:741742 reg_offset = (offset / 32) * 4;742742- else743743+ break;744744+ case BYT_DEBOUNCE_REG:745745+ reg_offset = 0;746746+ break;747747+ default:743748 reg_offset = comm->pad_map[offset] * 16;749749+ break;750750+ }744751745752 return comm->reg_base + reg_offset + reg;746753}···12501243 debounce = readl(db_reg);12511244 debounce &= ~BYT_DEBOUNCE_PULSE_MASK;1252124512461246+ if (arg)12471247+ conf |= BYT_DEBOUNCE_EN;12481248+ else12491249+ conf &= ~BYT_DEBOUNCE_EN;12501250+12531251 switch (arg) {12541254- case 0:12551255- conf &= BYT_DEBOUNCE_EN;12561256- break;12571252 case 375:12581253 debounce |= BYT_DEBOUNCE_PULSE_375US;12591254 break;···12781269 debounce |= BYT_DEBOUNCE_PULSE_24MS;12791270 break;12801271 default:12811281- ret = -EINVAL;12721272+ if (arg)12731273+ ret = -EINVAL;12741274+ break;12821275 }1283127612841277 if (!ret)···16231612 continue;16241613 }1625161416151615+ raw_spin_lock(&vg->lock);16261616 pending = readl(reg);16171617+ raw_spin_unlock(&vg->lock);16271618 for_each_set_bit(pin, &pending, 32) {16281619 virq = irq_find_mapping(vg->chip.irqdomain, base + pin);16291620 generic_handle_irq(virq);
+3
drivers/pinctrl/intel/pinctrl-merrifield.c
···794794 unsigned int i;795795 int ret;796796797797+ if (!mrfld_buf_available(mp, pin))798798+ return -ENOTSUPP;799799+797800 for (i = 0; i < nconfigs; i++) {798801 switch (pinconf_to_config_param(configs[i])) {799802 case PIN_CONFIG_BIAS_DISABLE:
+1-2
drivers/pinctrl/sunxi/pinctrl-sunxi.c
···564564 val = arg / 10 - 1;565565 break;566566 case PIN_CONFIG_BIAS_DISABLE:567567- val = 0;568568- break;567567+ continue;569568 case PIN_CONFIG_BIAS_PULL_UP:570569 if (arg == 0)571570 return -EINVAL;
···15511551 will be called rtc-mpc5121.1552155215531553config RTC_DRV_JZ474015541554- bool "Ingenic JZ4740 SoC"15541554+ tristate "Ingenic JZ4740 SoC"15551555 depends on MACH_INGENIC || COMPILE_TEST15561556 help15571557 If you say yes here you get support for the Ingenic JZ47xx SoCs RTC15581558 controllers.15591559+15601560+ This driver can also be buillt as a module. If so, the module15611561+ will be called rtc-jz4740.1559156215601563config RTC_DRV_LPC24XX15611564 tristate "NXP RTC for LPC178x/18xx/408x/43xx"
···159159 if (xen_domain())160160 return true;161161162162- /*163163- * On ARM-based machines, the DMA ops will do the right thing,164164- * so always use them with legacy devices.165165- */166166- if (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64))167167- return !virtio_has_feature(vdev, VIRTIO_F_VERSION_1);168168-169162 return false;170163}171164
···542542 hlist_for_each_entry(object, &cookie->backing_objects, cookie_link) {543543 if (invalidate)544544 set_bit(FSCACHE_OBJECT_RETIRED, &object->flags);545545+ clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);545546 fscache_raise_event(object, FSCACHE_OBJECT_EV_KILL);546547 }547548 } else {···560559 if (!atomic_dec_and_test(&cookie->n_active))561560 wait_on_atomic_t(&cookie->n_active, fscache_wait_atomic_t,562561 TASK_UNINTERRUPTIBLE);562562+563563+ /* Make sure any pending writes are cancelled. */564564+ if (cookie->def->type != FSCACHE_COOKIE_TYPE_INDEX)565565+ fscache_invalidate_writes(cookie);563566564567 /* Reset the cookie state if it wasn't relinquished */565568 if (!test_bit(FSCACHE_COOKIE_RELINQUISHED, &cookie->flags)) {
+1
fs/fscache/netfs.c
···4848 cookie->flags = 1 << FSCACHE_COOKIE_ENABLED;49495050 spin_lock_init(&cookie->lock);5151+ spin_lock_init(&cookie->stores_lock);5152 INIT_HLIST_HEAD(&cookie->backing_objects);52535354 /* check the netfs type is not already present */
+30-2
fs/fscache/object.c
···3030static const struct fscache_state *fscache_object_available(struct fscache_object *, int);3131static const struct fscache_state *fscache_parent_ready(struct fscache_object *, int);3232static const struct fscache_state *fscache_update_object(struct fscache_object *, int);3333+static const struct fscache_state *fscache_object_dead(struct fscache_object *, int);33343435#define __STATE_NAME(n) fscache_osm_##n3536#define STATE(n) (&__STATE_NAME(n))···9291static WORK_STATE(KILL_OBJECT, "KILL", fscache_kill_object);9392static WORK_STATE(KILL_DEPENDENTS, "KDEP", fscache_kill_dependents);9493static WORK_STATE(DROP_OBJECT, "DROP", fscache_drop_object);9595-static WORK_STATE(OBJECT_DEAD, "DEAD", (void*)2UL);9494+static WORK_STATE(OBJECT_DEAD, "DEAD", fscache_object_dead);96959796static WAIT_STATE(WAIT_FOR_INIT, "?INI",9897 TRANSIT_TO(INIT_OBJECT, 1 << FSCACHE_OBJECT_EV_NEW_CHILD));···230229 event = -1;231230 if (new_state == NO_TRANSIT) {232231 _debug("{OBJ%x} %s notrans", object->debug_id, state->name);232232+ if (unlikely(state == STATE(OBJECT_DEAD))) {233233+ _leave(" [dead]");234234+ return;235235+ }233236 fscache_enqueue_object(object);234237 event_mask = object->oob_event_mask;235238 goto unmask_events;···244239 object->state = state = new_state;245240246241 if (state->work) {247247- if (unlikely(state->work == ((void *)2UL))) {242242+ if (unlikely(state == STATE(OBJECT_DEAD))) {248243 _leave(" [dead]");249244 return;250245 }···649644650645 fscache_mark_object_dead(object);651646 object->oob_event_mask = 0;647647+648648+ if (test_bit(FSCACHE_OBJECT_RETIRED, &object->flags)) {649649+ /* Reject any new read/write ops and abort any that are pending. */650650+ clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);651651+ fscache_cancel_all_ops(object);652652+ }652653653654 if (list_empty(&object->dependents) &&654655 object->n_ops == 0 &&···10881077 }10891078}10901079EXPORT_SYMBOL(fscache_object_mark_killed);10801080+10811081+/*10821082+ * The object is dead. We can get here if an object gets queued by an event10831083+ * that would lead to its death (such as EV_KILL) when the dispatcher is10841084+ * already running (and so can be requeued) but hasn't yet cleared the event10851085+ * mask.10861086+ */10871087+static const struct fscache_state *fscache_object_dead(struct fscache_object *object,10881088+ int event)10891089+{10901090+ if (!test_and_set_bit(FSCACHE_OBJECT_RUN_AFTER_DEAD,10911091+ &object->flags))10921092+ return NO_TRANSIT;10931093+10941094+ WARN(true, "FS-Cache object redispatched after death");10951095+ return NO_TRANSIT;10961096+}
+3
fs/iomap.c
···114114115115 BUG_ON(pos + len > iomap->offset + iomap->length);116116117117+ if (fatal_signal_pending(current))118118+ return -EINTR;119119+117120 page = grab_cache_page_write_begin(inode->i_mapping, index, flags);118121 if (!page)119122 return -ENOMEM;
+60-37
fs/nfsd/vfs.c
···332332 }333333}334334335335+static __be32336336+nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,337337+ struct iattr *iap)338338+{339339+ struct inode *inode = d_inode(fhp->fh_dentry);340340+ int host_err;341341+342342+ if (iap->ia_size < inode->i_size) {343343+ __be32 err;344344+345345+ err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry,346346+ NFSD_MAY_TRUNC | NFSD_MAY_OWNER_OVERRIDE);347347+ if (err)348348+ return err;349349+ }350350+351351+ host_err = get_write_access(inode);352352+ if (host_err)353353+ goto out_nfserrno;354354+355355+ host_err = locks_verify_truncate(inode, NULL, iap->ia_size);356356+ if (host_err)357357+ goto out_put_write_access;358358+ return 0;359359+360360+out_put_write_access:361361+ put_write_access(inode);362362+out_nfserrno:363363+ return nfserrno(host_err);364364+}365365+335366/*336367 * Set various file attributes. After this call fhp needs an fh_put.337368 */···377346 __be32 err;378347 int host_err;379348 bool get_write_count;349349+ int size_change = 0;380350381351 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))382352 accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE;···390358 /* Get inode */391359 err = fh_verify(rqstp, fhp, ftype, accmode);392360 if (err)393393- return err;361361+ goto out;394362 if (get_write_count) {395363 host_err = fh_want_write(fhp);396364 if (host_err)397397- goto out_host_err;365365+ return nfserrno(host_err);398366 }399367400368 dentry = fhp->fh_dentry;···405373 iap->ia_valid &= ~ATTR_MODE;406374407375 if (!iap->ia_valid)408408- return 0;376376+ goto out;409377410378 nfsd_sanitize_attrs(inode, iap);411379412412- if (check_guard && guardtime != inode->i_ctime.tv_sec)413413- return nfserr_notsync;414414-415380 /*416381 * The size case is special, it changes the file in addition to the417417- * attributes, and file systems don't expect it to be mixed with418418- * "random" attribute changes. We thus split out the size change419419- * into a separate call for vfs_truncate, and do the rest as a420420- * a separate setattr call.382382+ * attributes.421383 */422384 if (iap->ia_valid & ATTR_SIZE) {423423- struct path path = {424424- .mnt = fhp->fh_export->ex_path.mnt,425425- .dentry = dentry,426426- };427427- bool implicit_mtime = false;385385+ err = nfsd_get_write_access(rqstp, fhp, iap);386386+ if (err)387387+ goto out;388388+ size_change = 1;428389429390 /*430430- * vfs_truncate implicity updates the mtime IFF the file size431431- * actually changes. Avoid the additional seattr call below if432432- * the only other attribute that the client sends is the mtime.391391+ * RFC5661, Section 18.30.4:392392+ * Changing the size of a file with SETATTR indirectly393393+ * changes the time_modify and change attributes.394394+ *395395+ * (and similar for the older RFCs)433396 */434434- if (iap->ia_size != i_size_read(inode) &&435435- ((iap->ia_valid & ~(ATTR_SIZE | ATTR_MTIME)) == 0))436436- implicit_mtime = true;437437-438438- host_err = vfs_truncate(&path, iap->ia_size);439439- if (host_err)440440- goto out_host_err;441441-442442- iap->ia_valid &= ~ATTR_SIZE;443443- if (implicit_mtime)444444- iap->ia_valid &= ~ATTR_MTIME;445445- if (!iap->ia_valid)446446- goto done;397397+ if (iap->ia_size != i_size_read(inode))398398+ iap->ia_valid |= ATTR_MTIME;447399 }448400449401 iap->ia_valid |= ATTR_CTIME;450402403403+ if (check_guard && guardtime != inode->i_ctime.tv_sec) {404404+ err = nfserr_notsync;405405+ goto out_put_write_access;406406+ }407407+451408 fh_lock(fhp);452409 host_err = notify_change(dentry, iap, NULL);453410 fh_unlock(fhp);454454- if (host_err)455455- goto out_host_err;411411+ err = nfserrno(host_err);456412457457-done:458458- host_err = commit_metadata(fhp);459459-out_host_err:460460- return nfserrno(host_err);413413+out_put_write_access:414414+ if (size_change)415415+ put_write_access(inode);416416+ if (!err)417417+ err = nfserrno(commit_metadata(fhp));418418+out:419419+ return err;461420}462421463422#if defined(CONFIG_NFSD_V4)
···517517 struct drm_minor *control; /**< Control node */518518 struct drm_minor *primary; /**< Primary node */519519 struct drm_minor *render; /**< Render node */520520+ bool registered;520521521522 /* currently active master for this device. Protected by master_mutex */522523 struct drm_master *master;
+15-1
include/drm/drm_connector.h
···381381 * core drm connector interfaces. Everything added from this callback382382 * should be unregistered in the early_unregister callback.383383 *384384+ * This is called while holding drm_connector->mutex.385385+ *384386 * Returns:385387 *386388 * 0 on success, or a negative error code on failure.···397395 * late_register(). It is called from drm_connector_unregister(),398396 * early in the driver unload sequence to disable userspace access399397 * before data structures are torndown.398398+ *399399+ * This is called while holding drm_connector->mutex.400400 */401401 void (*early_unregister)(struct drm_connector *connector);402402···563559 * @interlace_allowed: can this connector handle interlaced modes?564560 * @doublescan_allowed: can this connector handle doublescan?565561 * @stereo_allowed: can this connector handle stereo modes?566566- * @registered: is this connector exposed (registered) with userspace?567562 * @modes: modes available on this connector (from fill_modes() + user)568563 * @status: one of the drm_connector_status enums (connected, not, or unknown)569564 * @probed_modes: list of modes derived directly from the display···611608 char *name;612609613610 /**611611+ * @mutex: Lock for general connector state, but currently only protects612612+ * @registered. Most of the connector state is still protected by the613613+ * mutex in &drm_mode_config.614614+ */615615+ struct mutex mutex;616616+617617+ /**614618 * @index: Compacted connector index, which matches the position inside615619 * the mode_config.list for drivers not supporting hot-add/removing. Can616620 * be used as an array index. It is invariant over the lifetime of the···630620 bool interlace_allowed;631621 bool doublescan_allowed;632622 bool stereo_allowed;623623+ /**624624+ * @registered: Is this connector exposed (registered) with userspace?625625+ * Protected by @mutex.626626+ */633627 bool registered;634628 struct list_head modes; /* list of modes on this connector */635629
···360360#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */361361#define FSCACHE_OBJECT_RETIRED 6 /* T if object was retired on relinquishment */362362#define FSCACHE_OBJECT_KILLED_BY_CACHE 7 /* T if object was killed by the cache */363363+#define FSCACHE_OBJECT_RUN_AFTER_DEAD 8 /* T if object has been dispatched after death */363364364365 struct list_head cache_link; /* link in cache->object_list */365366 struct hlist_node cookie_link; /* link in cookie->backing_objects */
+30-2
include/linux/hyperv.h
···128128 u32 ring_data_startoffset;129129 u32 priv_write_index;130130 u32 priv_read_index;131131+ u32 cached_read_index;131132};132133133134/*···181180 return write;182181}183182183183+static inline u32 hv_get_cached_bytes_to_write(184184+ const struct hv_ring_buffer_info *rbi)185185+{186186+ u32 read_loc, write_loc, dsize, write;187187+188188+ dsize = rbi->ring_datasize;189189+ read_loc = rbi->cached_read_index;190190+ write_loc = rbi->ring_buffer->write_index;191191+192192+ write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :193193+ read_loc - write_loc;194194+ return write;195195+}184196/*185197 * VMBUS version is 32 bit entity broken up into186198 * two 16 bit quantities: major_number. minor_number.···1502148815031489static inline void hv_signal_on_read(struct vmbus_channel *channel)15041490{15051505- u32 cur_write_sz;14911491+ u32 cur_write_sz, cached_write_sz;15061492 u32 pending_sz;15071493 struct hv_ring_buffer_info *rbi = &channel->inbound;15081494···1526151215271513 cur_write_sz = hv_get_bytes_to_write(rbi);1528151415291529- if (cur_write_sz >= pending_sz)15151515+ if (cur_write_sz < pending_sz)15161516+ return;15171517+15181518+ cached_write_sz = hv_get_cached_bytes_to_write(rbi);15191519+ if (cached_write_sz < pending_sz)15301520 vmbus_setevent(channel);1531152115321522 return;15231523+}15241524+15251525+static inline void15261526+init_cached_read_index(struct vmbus_channel *channel)15271527+{15281528+ struct hv_ring_buffer_info *rbi = &channel->inbound;15291529+15301530+ rbi->cached_read_index = rbi->ring_buffer->read_index;15331531}1534153215351533/*···15941568/*15951569 * This call commits the read index and potentially signals the host.15961570 * Here is the pattern for using the "in-place" consumption APIs:15711571+ *15721572+ * init_cached_read_index();15971573 *15981574 * while (get_next_pkt_raw() {15991575 * process the packet "in-place";
···8585extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);8686/* VM interface that may be used by firmware interface */8787extern int online_pages(unsigned long, unsigned long, int);8888-extern int test_pages_in_a_zone(unsigned long, unsigned long);8888+extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,8989+ unsigned long *valid_start, unsigned long *valid_end);8990extern void __offline_isolated_pages(unsigned long, unsigned long);90919192typedef void (*online_page_callback_t)(struct page *page);
+7-7
include/linux/module.h
···346346347347 /* Exported symbols */348348 const struct kernel_symbol *syms;349349- const unsigned long *crcs;349349+ const s32 *crcs;350350 unsigned int num_syms;351351352352 /* Kernel parameters. */···359359 /* GPL-only exported symbols. */360360 unsigned int num_gpl_syms;361361 const struct kernel_symbol *gpl_syms;362362- const unsigned long *gpl_crcs;362362+ const s32 *gpl_crcs;363363364364#ifdef CONFIG_UNUSED_SYMBOLS365365 /* unused exported symbols. */366366 const struct kernel_symbol *unused_syms;367367- const unsigned long *unused_crcs;367367+ const s32 *unused_crcs;368368 unsigned int num_unused_syms;369369370370 /* GPL-only, unused exported symbols. */371371 unsigned int num_unused_gpl_syms;372372 const struct kernel_symbol *unused_gpl_syms;373373- const unsigned long *unused_gpl_crcs;373373+ const s32 *unused_gpl_crcs;374374#endif375375376376#ifdef CONFIG_MODULE_SIG···382382383383 /* symbols that will be GPL-only in the near future. */384384 const struct kernel_symbol *gpl_future_syms;385385- const unsigned long *gpl_future_crcs;385385+ const s32 *gpl_future_crcs;386386 unsigned int num_gpl_future_syms;387387388388 /* Exception table */···523523524524struct symsearch {525525 const struct kernel_symbol *start, *stop;526526- const unsigned long *crcs;526526+ const s32 *crcs;527527 enum {528528 NOT_GPL_ONLY,529529 GPL_ONLY,···539539 */540540const struct kernel_symbol *find_symbol(const char *name,541541 struct module **owner,542542- const unsigned long **crc,542542+ const s32 **crc,543543 bool gplok,544544 bool warn);545545
+15-14
include/linux/netdevice.h
···866866 * of useless work if you return NETDEV_TX_BUSY.867867 * Required; cannot be NULL.868868 *869869- * netdev_features_t (*ndo_fix_features)(struct net_device *dev,870870- * netdev_features_t features);871871- * Adjusts the requested feature flags according to device-specific872872- * constraints, and returns the resulting flags. Must not modify873873- * the device state.869869+ * netdev_features_t (*ndo_features_check)(struct sk_buff *skb,870870+ * struct net_device *dev871871+ * netdev_features_t features);872872+ * Called by core transmit path to determine if device is capable of873873+ * performing offload operations on a given packet. This is to give874874+ * the device an opportunity to implement any restrictions that cannot875875+ * be otherwise expressed by feature flags. The check is called with876876+ * the set of features that the stack has calculated and it returns877877+ * those the driver believes to be appropriate.874878 *875879 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,876880 * void *accel_priv, select_queue_fallback_t fallback);···10321028 * Called to release previously enslaved netdev.10331029 *10341030 * Feature/offload setting functions.10311031+ * netdev_features_t (*ndo_fix_features)(struct net_device *dev,10321032+ * netdev_features_t features);10331033+ * Adjusts the requested feature flags according to device-specific10341034+ * constraints, and returns the resulting flags. Must not modify10351035+ * the device state.10361036+ *10351037 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);10361038 * Called to update device configuration to new features. Passed10371039 * feature set might be less than what was returned by ndo_fix_features()).···11101100 * Callback to use for xmit over the accelerated station. This11111101 * is used in place of ndo_start_xmit on accelerated net11121102 * devices.11131113- * netdev_features_t (*ndo_features_check)(struct sk_buff *skb,11141114- * struct net_device *dev11151115- * netdev_features_t features);11161116- * Called by core transmit path to determine if device is capable of11171117- * performing offload operations on a given packet. This is to give11181118- * the device an opportunity to implement any restrictions that cannot11191119- * be otherwise expressed by feature flags. The check is called with11201120- * the set of features that the stack has calculated and it returns11211121- * those the driver believes to be appropriate.11221103 * int (*ndo_set_tx_maxrate)(struct net_device *dev,11231104 * int queue_index, u32 maxrate);11241105 * Called when a user wants to set a max-rate limitation of specific
+2-2
include/linux/percpu-refcount.h
···204204static inline bool percpu_ref_tryget(struct percpu_ref *ref)205205{206206 unsigned long __percpu *percpu_count;207207- int ret;207207+ bool ret;208208209209 rcu_read_lock_sched();210210···238238static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)239239{240240 unsigned long __percpu *percpu_count;241241- int ret = false;241241+ bool ret = false;242242243243 rcu_read_lock_sched();244244
+5
include/net/ipv6.h
···776776{777777 u32 hash;778778779779+ /* @flowlabel may include more than a flow label, eg, the traffic class.780780+ * Here we want only the flow label value.781781+ */782782+ flowlabel &= IPV6_FLOWLABEL_MASK;783783+779784 if (flowlabel ||780785 net->ipv6.sysctl.auto_flowlabels == IP6_AUTO_FLOW_LABEL_OFF ||781786 (!autolabel &&
+3-1
include/uapi/linux/ethtool.h
···13841384 ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44,13851385 ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45,13861386 ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46,13871387+ ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47,13881388+ ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48,138713891388139013891391 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit···13951393 */1396139413971395 __ETHTOOL_LINK_MODE_LAST13981398- = ETHTOOL_LINK_MODE_10000baseER_Full_BIT,13961396+ = ETHTOOL_LINK_MODE_5000baseT_Full_BIT,13991397};1400139814011399#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
+4
init/Kconfig
···19871987 make them incompatible with the kernel you are running. If19881988 unsure, say N.1989198919901990+config MODULE_REL_CRCS19911991+ bool19921992+ depends on MODVERSIONS19931993+19901994config MODULE_SRCVERSION_ALL19911995 bool "Source checksum for all modules"19921996 help
+5-8
kernel/cgroup.c
···52215221 return ERR_PTR(err);52225222}5223522352245224+/*52255225+ * The returned cgroup is fully initialized including its control mask, but52265226+ * it isn't associated with its kernfs_node and doesn't have the control52275227+ * mask applied.52285228+ */52245229static struct cgroup *cgroup_create(struct cgroup *parent)52255230{52265231 struct cgroup_root *root = parent->root;···5293528852945289 cgroup_propagate_control(cgrp);5295529052965296- /* @cgrp doesn't have dir yet so the following will only create csses */52975297- ret = cgroup_apply_control_enable(cgrp);52985298- if (ret)52995299- goto out_destroy;53005300-53015291 return cgrp;5302529253035293out_cancel_ref:53045294 percpu_ref_exit(&cgrp->self.refcnt);53055295out_free_cgrp:53065296 kfree(cgrp);53075307- return ERR_PTR(ret);53085308-out_destroy:53095309- cgroup_destroy_locked(cgrp);53105297 return ERR_PTR(ret);53115298}53125299
+46-23
kernel/events/core.c
···14691469static void14701470list_add_event(struct perf_event *event, struct perf_event_context *ctx)14711471{14721472-14731472 lockdep_assert_held(&ctx->lock);1474147314751474 WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT);···16231624{16241625 struct perf_event *group_leader = event->group_leader, *pos;1625162616271627+ lockdep_assert_held(&event->ctx->lock);16281628+16261629 /*16271630 * We can have double attach due to group movement in perf_event_open.16281631 */···16971696{16981697 struct perf_event *sibling, *tmp;16991698 struct list_head *list = NULL;16991699+17001700+ lockdep_assert_held(&event->ctx->lock);1700170117011702 /*17021703 * We can have double detach due to exit/hot-unplug + close.···18981895 */18991896static void perf_remove_from_context(struct perf_event *event, unsigned long flags)19001897{19011901- lockdep_assert_held(&event->ctx->mutex);18981898+ struct perf_event_context *ctx = event->ctx;18991899+19001900+ lockdep_assert_held(&ctx->mutex);1902190119031902 event_function_call(event, __perf_remove_from_context, (void *)flags);19031903+19041904+ /*19051905+ * The above event_function_call() can NO-OP when it hits19061906+ * TASK_TOMBSTONE. In that case we must already have been detached19071907+ * from the context (by perf_event_exit_event()) but the grouping19081908+ * might still be in-tact.19091909+ */19101910+ WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT);19111911+ if ((flags & DETACH_GROUP) &&19121912+ (event->attach_state & PERF_ATTACH_GROUP)) {19131913+ /*19141914+ * Since in that case we cannot possibly be scheduled, simply19151915+ * detach now.19161916+ */19171917+ raw_spin_lock_irq(&ctx->lock);19181918+ perf_group_detach(event);19191919+ raw_spin_unlock_irq(&ctx->lock);19201920+ }19041921}1905192219061923/*···66326609 char *buf = NULL;66336610 char *name;6634661166126612+ if (vma->vm_flags & VM_READ)66136613+ prot |= PROT_READ;66146614+ if (vma->vm_flags & VM_WRITE)66156615+ prot |= PROT_WRITE;66166616+ if (vma->vm_flags & VM_EXEC)66176617+ prot |= PROT_EXEC;66186618+66196619+ if (vma->vm_flags & VM_MAYSHARE)66206620+ flags = MAP_SHARED;66216621+ else66226622+ flags = MAP_PRIVATE;66236623+66246624+ if (vma->vm_flags & VM_DENYWRITE)66256625+ flags |= MAP_DENYWRITE;66266626+ if (vma->vm_flags & VM_MAYEXEC)66276627+ flags |= MAP_EXECUTABLE;66286628+ if (vma->vm_flags & VM_LOCKED)66296629+ flags |= MAP_LOCKED;66306630+ if (vma->vm_flags & VM_HUGETLB)66316631+ flags |= MAP_HUGETLB;66326632+66356633 if (file) {66366634 struct inode *inode;66376635 dev_t dev;···66786634 gen = inode->i_generation;66796635 maj = MAJOR(dev);66806636 min = MINOR(dev);66816681-66826682- if (vma->vm_flags & VM_READ)66836683- prot |= PROT_READ;66846684- if (vma->vm_flags & VM_WRITE)66856685- prot |= PROT_WRITE;66866686- if (vma->vm_flags & VM_EXEC)66876687- prot |= PROT_EXEC;66886688-66896689- if (vma->vm_flags & VM_MAYSHARE)66906690- flags = MAP_SHARED;66916691- else66926692- flags = MAP_PRIVATE;66936693-66946694- if (vma->vm_flags & VM_DENYWRITE)66956695- flags |= MAP_DENYWRITE;66966696- if (vma->vm_flags & VM_MAYEXEC)66976697- flags |= MAP_EXECUTABLE;66986698- if (vma->vm_flags & VM_LOCKED)66996699- flags |= MAP_LOCKED;67006700- if (vma->vm_flags & VM_HUGETLB)67016701- flags |= MAP_HUGETLB;6702663767036638 goto got_name;67046639 } else {
+30-14
kernel/irq/irqdomain.c
···13461346}13471347EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent);1348134813491349+static void __irq_domain_activate_irq(struct irq_data *irq_data)13501350+{13511351+ if (irq_data && irq_data->domain) {13521352+ struct irq_domain *domain = irq_data->domain;13531353+13541354+ if (irq_data->parent_data)13551355+ __irq_domain_activate_irq(irq_data->parent_data);13561356+ if (domain->ops->activate)13571357+ domain->ops->activate(domain, irq_data);13581358+ }13591359+}13601360+13611361+static void __irq_domain_deactivate_irq(struct irq_data *irq_data)13621362+{13631363+ if (irq_data && irq_data->domain) {13641364+ struct irq_domain *domain = irq_data->domain;13651365+13661366+ if (domain->ops->deactivate)13671367+ domain->ops->deactivate(domain, irq_data);13681368+ if (irq_data->parent_data)13691369+ __irq_domain_deactivate_irq(irq_data->parent_data);13701370+ }13711371+}13721372+13491373/**13501374 * irq_domain_activate_irq - Call domain_ops->activate recursively to activate13511375 * interrupt···13801356 */13811357void irq_domain_activate_irq(struct irq_data *irq_data)13821358{13831383- if (irq_data && irq_data->domain) {13841384- struct irq_domain *domain = irq_data->domain;13851385-13861386- if (irq_data->parent_data)13871387- irq_domain_activate_irq(irq_data->parent_data);13881388- if (domain->ops->activate)13891389- domain->ops->activate(domain, irq_data);13591359+ if (!irqd_is_activated(irq_data)) {13601360+ __irq_domain_activate_irq(irq_data);13611361+ irqd_set_activated(irq_data);13901362 }13911363}13921364···13961376 */13971377void irq_domain_deactivate_irq(struct irq_data *irq_data)13981378{13991399- if (irq_data && irq_data->domain) {14001400- struct irq_domain *domain = irq_data->domain;14011401-14021402- if (domain->ops->deactivate)14031403- domain->ops->deactivate(domain, irq_data);14041404- if (irq_data->parent_data)14051405- irq_domain_deactivate_irq(irq_data->parent_data);13791379+ if (irqd_is_activated(irq_data)) {13801380+ __irq_domain_deactivate_irq(irq_data);13811381+ irqd_clr_activated(irq_data);14061382 }14071383}14081384
+25-28
kernel/module.c
···389389extern const struct kernel_symbol __stop___ksymtab_gpl[];390390extern const struct kernel_symbol __start___ksymtab_gpl_future[];391391extern const struct kernel_symbol __stop___ksymtab_gpl_future[];392392-extern const unsigned long __start___kcrctab[];393393-extern const unsigned long __start___kcrctab_gpl[];394394-extern const unsigned long __start___kcrctab_gpl_future[];392392+extern const s32 __start___kcrctab[];393393+extern const s32 __start___kcrctab_gpl[];394394+extern const s32 __start___kcrctab_gpl_future[];395395#ifdef CONFIG_UNUSED_SYMBOLS396396extern const struct kernel_symbol __start___ksymtab_unused[];397397extern const struct kernel_symbol __stop___ksymtab_unused[];398398extern const struct kernel_symbol __start___ksymtab_unused_gpl[];399399extern const struct kernel_symbol __stop___ksymtab_unused_gpl[];400400-extern const unsigned long __start___kcrctab_unused[];401401-extern const unsigned long __start___kcrctab_unused_gpl[];400400+extern const s32 __start___kcrctab_unused[];401401+extern const s32 __start___kcrctab_unused_gpl[];402402#endif403403404404#ifndef CONFIG_MODVERSIONS···497497498498 /* Output */499499 struct module *owner;500500- const unsigned long *crc;500500+ const s32 *crc;501501 const struct kernel_symbol *sym;502502};503503···563563 * (optional) module which owns it. Needs preempt disabled or module_mutex. */564564const struct kernel_symbol *find_symbol(const char *name,565565 struct module **owner,566566- const unsigned long **crc,566566+ const s32 **crc,567567 bool gplok,568568 bool warn)569569{···12491249}1250125012511251#ifdef CONFIG_MODVERSIONS12521252-/* If the arch applies (non-zero) relocations to kernel kcrctab, unapply it. */12531253-static unsigned long maybe_relocated(unsigned long crc,12541254- const struct module *crc_owner)12521252+12531253+static u32 resolve_rel_crc(const s32 *crc)12551254{12561256-#ifdef ARCH_RELOCATES_KCRCTAB12571257- if (crc_owner == NULL)12581258- return crc - (unsigned long)reloc_start;12591259-#endif12601260- return crc;12551255+ return *(u32 *)((void *)crc + *crc);12611256}1262125712631258static int check_version(Elf_Shdr *sechdrs,12641259 unsigned int versindex,12651260 const char *symname,12661261 struct module *mod,12671267- const unsigned long *crc,12681268- const struct module *crc_owner)12621262+ const s32 *crc)12691263{12701264 unsigned int i, num_versions;12711265 struct modversion_info *versions;···12771283 / sizeof(struct modversion_info);1278128412791285 for (i = 0; i < num_versions; i++) {12861286+ u32 crcval;12871287+12801288 if (strcmp(versions[i].name, symname) != 0)12811289 continue;1282129012831283- if (versions[i].crc == maybe_relocated(*crc, crc_owner))12911291+ if (IS_ENABLED(CONFIG_MODULE_REL_CRCS))12921292+ crcval = resolve_rel_crc(crc);12931293+ else12941294+ crcval = *crc;12951295+ if (versions[i].crc == crcval)12841296 return 1;12851285- pr_debug("Found checksum %lX vs module %lX\n",12861286- maybe_relocated(*crc, crc_owner), versions[i].crc);12971297+ pr_debug("Found checksum %X vs module %lX\n",12981298+ crcval, versions[i].crc);12871299 goto bad_version;12881300 }12891301···13071307 unsigned int versindex,13081308 struct module *mod)13091309{13101310- const unsigned long *crc;13101310+ const s32 *crc;1311131113121312 /*13131313 * Since this should be found in kernel (which can't be removed), no···13211321 }13221322 preempt_enable();13231323 return check_version(sechdrs, versindex,13241324- VMLINUX_SYMBOL_STR(module_layout), mod, crc,13251325- NULL);13241324+ VMLINUX_SYMBOL_STR(module_layout), mod, crc);13261325}1327132613281327/* First part is kernel version, which we ignore if module has crcs. */···13391340 unsigned int versindex,13401341 const char *symname,13411342 struct module *mod,13421342- const unsigned long *crc,13431343- const struct module *crc_owner)13431343+ const s32 *crc)13441344{13451345 return 1;13461346}···13661368{13671369 struct module *owner;13681370 const struct kernel_symbol *sym;13691369- const unsigned long *crc;13711371+ const s32 *crc;13701372 int err;1371137313721374 /*···13811383 if (!sym)13821384 goto unlock;1383138513841384- if (!check_version(info->sechdrs, info->index.vers, name, mod, crc,13851385- owner)) {13861386+ if (!check_version(info->sechdrs, info->index.vers, name, mod, crc)) {13861387 sym = ERR_PTR(-EINVAL);13871388 goto getname;13881389 }
+5-3
kernel/trace/trace_hwlat.c
···266266static struct cpumask save_cpumask;267267static bool disable_migrate;268268269269-static void move_to_next_cpu(void)269269+static void move_to_next_cpu(bool initmask)270270{271271 static struct cpumask *current_mask;272272 int next_cpu;···275275 return;276276277277 /* Just pick the first CPU on first iteration */278278- if (!current_mask) {278278+ if (initmask) {279279 current_mask = &save_cpumask;280280 get_online_cpus();281281 cpumask_and(current_mask, cpu_online_mask, tracing_buffer_mask);···330330static int kthread_fn(void *data)331331{332332 u64 interval;333333+ bool initmask = true;333334334335 while (!kthread_should_stop()) {335336336336- move_to_next_cpu();337337+ move_to_next_cpu(initmask);338338+ initmask = false;337339338340 local_irq_disable();339341 get_sample();
···14831483}1484148414851485/*14861486- * Confirm all pages in a range [start, end) is belongs to the same zone.14861486+ * Confirm all pages in a range [start, end) belong to the same zone.14871487+ * When true, return its valid [start, end).14871488 */14881488-int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn)14891489+int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,14901490+ unsigned long *valid_start, unsigned long *valid_end)14891491{14901492 unsigned long pfn, sec_end_pfn;14931493+ unsigned long start, end;14911494 struct zone *zone = NULL;14921495 struct page *page;14931496 int i;14941494- for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn);14971497+ for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn + 1);14951498 pfn < end_pfn;14961496- pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) {14991499+ pfn = sec_end_pfn, sec_end_pfn += PAGES_PER_SECTION) {14971500 /* Make sure the memory section is present first */14981501 if (!present_section_nr(pfn_to_section_nr(pfn)))14991502 continue;···15121509 page = pfn_to_page(pfn + i);15131510 if (zone && page_zone(page) != zone)15141511 return 0;15121512+ if (!zone)15131513+ start = pfn + i;15151514 zone = page_zone(page);15151515+ end = pfn + MAX_ORDER_NR_PAGES;15161516 }15171517 }15181518- return 1;15181518+15191519+ if (zone) {15201520+ *valid_start = start;15211521+ *valid_end = end;15221522+ return 1;15231523+ } else {15241524+ return 0;15251525+ }15191526}1520152715211528/*···18521839 long offlined_pages;18531840 int ret, drain, retry_max, node;18541841 unsigned long flags;18421842+ unsigned long valid_start, valid_end;18551843 struct zone *zone;18561844 struct memory_notify arg;18571845···18631849 return -EINVAL;18641850 /* This makes hotplug much easier...and readable.18651851 we assume this for now. .*/18661866- if (!test_pages_in_a_zone(start_pfn, end_pfn))18521852+ if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end))18671853 return -EINVAL;1868185418691869- zone = page_zone(pfn_to_page(start_pfn));18551855+ zone = page_zone(pfn_to_page(valid_start));18701856 node = zone_to_nid(zone);18711857 nr_pages = end_pfn - start_pfn;18721858
+9-2
mm/shmem.c
···415415 struct shrink_control *sc, unsigned long nr_to_split)416416{417417 LIST_HEAD(list), *pos, *next;418418+ LIST_HEAD(to_remove);418419 struct inode *inode;419420 struct shmem_inode_info *info;420421 struct page *page;···442441 /* Check if there's anything to gain */443442 if (round_up(inode->i_size, PAGE_SIZE) ==444443 round_up(inode->i_size, HPAGE_PMD_SIZE)) {445445- list_del_init(&info->shrinklist);444444+ list_move(&info->shrinklist, &to_remove);446445 removed++;447447- iput(inode);448446 goto next;449447 }450448···453453 break;454454 }455455 spin_unlock(&sbinfo->shrinklist_lock);456456+457457+ list_for_each_safe(pos, next, &to_remove) {458458+ info = list_entry(pos, struct shmem_inode_info, shrinklist);459459+ inode = &info->vfs_inode;460460+ list_del_init(&info->shrinklist);461461+ iput(inode);462462+ }456463457464 list_for_each_safe(pos, next, &list) {458465 int ret;
+29-1
mm/zswap.c
···78787979/* Enable/disable zswap (disabled by default) */8080static bool zswap_enabled;8181-module_param_named(enabled, zswap_enabled, bool, 0644);8181+static int zswap_enabled_param_set(const char *,8282+ const struct kernel_param *);8383+static struct kernel_param_ops zswap_enabled_param_ops = {8484+ .set = zswap_enabled_param_set,8585+ .get = param_get_bool,8686+};8787+module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644);82888389/* Crypto compressor to use */8490#define ZSWAP_COMPRESSOR_DEFAULT "lzo"···181175182176/* used by param callback function */183177static bool zswap_init_started;178178+179179+/* fatal error during init */180180+static bool zswap_init_failed;184181185182/*********************************186183* helpers and fwd declarations···633624 char *s = strstrip((char *)val);634625 int ret;635626627627+ if (zswap_init_failed) {628628+ pr_err("can't set param, initialization failed\n");629629+ return -ENODEV;630630+ }631631+636632 /* no change required */637633 if (!strcmp(s, *(char **)kp->arg))638634 return 0;···715701 const struct kernel_param *kp)716702{717703 return __zswap_param_set(val, kp, NULL, zswap_compressor);704704+}705705+706706+static int zswap_enabled_param_set(const char *val,707707+ const struct kernel_param *kp)708708+{709709+ if (zswap_init_failed) {710710+ pr_err("can't enable, initialization failed\n");711711+ return -ENODEV;712712+ }713713+714714+ return param_set_bool(val, kp);718715}719716720717/*********************************···12261201dstmem_fail:12271202 zswap_entry_cache_destroy();12281203cache_fail:12041204+ /* if built-in, we aren't unloaded on failure; don't allow use */12051205+ zswap_init_failed = true;12061206+ zswap_enabled = false;12291207 return -ENOMEM;12301208}12311209/* must be late so crypto has time to come up */
+10-2
net/can/af_can.c
···445445 * @func: callback function on filter match446446 * @data: returned parameter for callback function447447 * @ident: string for calling module identification448448+ * @sk: socket pointer (might be NULL)448449 *449450 * Description:450451 * Invokes the callback function with the received sk_buff and the given···469468 */470469int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,471470 void (*func)(struct sk_buff *, void *), void *data,472472- char *ident)471471+ char *ident, struct sock *sk)473472{474473 struct receiver *r;475474 struct hlist_head *rl;···497496 r->func = func;498497 r->data = data;499498 r->ident = ident;499499+ r->sk = sk;500500501501 hlist_add_head_rcu(&r->list, rl);502502 d->entries++;···522520static void can_rx_delete_receiver(struct rcu_head *rp)523521{524522 struct receiver *r = container_of(rp, struct receiver, rcu);523523+ struct sock *sk = r->sk;525524526525 kmem_cache_free(rcv_cache, r);526526+ if (sk)527527+ sock_put(sk);527528}528529529530/**···601596 spin_unlock(&can_rcvlists_lock);602597603598 /* schedule the receiver item for deletion */604604- if (r)599599+ if (r) {600600+ if (r->sk)601601+ sock_hold(r->sk);605602 call_rcu(&r->rcu, can_rx_delete_receiver);603603+ }606604}607605EXPORT_SYMBOL(can_rx_unregister);608606
···441441 if (i + sizeof(*tel) > optlen)442442 break;443443444444- tel = (struct ipv6_tlv_tnl_enc_lim *) skb->data + off + i;444444+ tel = (struct ipv6_tlv_tnl_enc_lim *)(skb->data + off + i);445445 /* return index of option if found and valid */446446 if (tel->type == IPV6_TLV_TNL_ENCAP_LIMIT &&447447 tel->length == 1)