···1313Kernel comes with a simple CLI tool which should be useful when1414developing Netlink related code. The tool is implemented in Python1515and can use a YAML specification to issue Netlink requests1616-to the kernel. Only Generic Netlink is supported.1616+to the kernel.17171818The tool is located at ``tools/net/ynl/pyynl/cli.py``. It accepts1919-a handul of arguments, the most important ones are:1919+a handful of arguments, the most important ones are:20202121 - ``--spec`` - point to the spec file2222 - ``--do $name`` / ``--dump $name`` - issue request ``$name``
+26-20
MAINTAINERS
···915915ALPHA PORT916916M: Richard Henderson <richard.henderson@linaro.org>917917M: Matt Turner <mattst88@gmail.com>918918+M: Magnus Lindholm <linmag7@gmail.com>918919L: linux-alpha@vger.kernel.org919920S: Odd Fixes920921F: arch/alpha/···43994398M: Jens Axboe <axboe@kernel.dk>44004399L: linux-block@vger.kernel.org44014400S: Maintained44024402-T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git44014401+T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git44034402F: Documentation/ABI/stable/sysfs-block44044403F: Documentation/block/44054404F: block/···48194818F: drivers/net/dsa/bcm_sf2*48204819F: include/linux/dsa/brcm.h48214820F: include/linux/platform_data/b53.h48214821+F: net/dsa/tag_brcm.c4822482248234823BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE48244824M: Florian Fainelli <florian.fainelli@broadcom.com>···92099207R: Jeffle Xu <jefflexu@linux.alibaba.com>92109208R: Sandeep Dhavale <dhavale@google.com>92119209R: Hongbo Li <lihongbo22@huawei.com>92109210+R: Chunhai Guo <guochunhai@vivo.com>92129211L: linux-erofs@lists.ozlabs.org92139212S: Maintained92149213W: https://erofs.docs.kernel.org···1152811525HUGETLB SUBSYSTEM1152911526M: Muchun Song <muchun.song@linux.dev>1153011527M: Oscar Salvador <osalvador@suse.de>1153111531-R: David Hildenbrand <david@redhat.com>1152811528+R: David Hildenbrand <david@kernel.org>1153211529L: linux-mm@kvack.org1153311530S: Maintained1153411531F: Documentation/ABI/testing/sysfs-kernel-mm-hugepages···1252412521F: include/linux/net/intel/*/12525125221252612523INTEL ETHERNET PROTOCOL DRIVER FOR RDMA1252412524+M: Krzysztof Czurylo <krzysztof.czurylo@intel.com>1252712525M: Tatyana Nikolova <tatyana.e.nikolova@intel.com>1252812526L: linux-rdma@vger.kernel.org1252912527S: Supported···1286512861K: \bSGX_12866128621286712863INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER1286812868-M: Daniel Scally <djrscally@gmail.com>1286412864+M: Daniel Scally <dan.scally@ideasonboard.com>1286512865+M: Sakari Ailus <sakari.ailus@linux.intel.com>1286912866S: Maintained1287012867F: drivers/platform/x86/intel/int3472/1287112868F: include/linux/platform_data/x86/int3472.h···13661136561366213657KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)1366313658M: Marc Zyngier <maz@kernel.org>1366413664-M: Oliver Upton <oliver.upton@linux.dev>1365913659+M: Oliver Upton <oupton@kernel.org>1366513660R: Joey Gouly <joey.gouly@arm.com>1366613661R: Suzuki K Poulose <suzuki.poulose@arm.com>1366713662R: Zenghui Yu <yuzenghui@huawei.com>···1373513730M: Christian Borntraeger <borntraeger@linux.ibm.com>1373613731M: Janosch Frank <frankja@linux.ibm.com>1373713732M: Claudio Imbrenda <imbrenda@linux.ibm.com>1373813738-R: David Hildenbrand <david@redhat.com>1373313733+R: David Hildenbrand <david@kernel.org>1373913734L: kvm@vger.kernel.org1374013735S: Supported1374113736T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git···1622216217F: drivers/devfreq/tegra30-devfreq.c16223162181622416219MEMORY HOT(UN)PLUG1622516225-M: David Hildenbrand <david@redhat.com>1622016220+M: David Hildenbrand <david@kernel.org>1622616221M: Oscar Salvador <osalvador@suse.de>1622716222L: linux-mm@kvack.org1622816223S: Maintained···16247162421624816243MEMORY MANAGEMENT - CORE1624916244M: Andrew Morton <akpm@linux-foundation.org>1625016250-M: David Hildenbrand <david@redhat.com>1624516245+M: David Hildenbrand <david@kernel.org>1625116246R: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>1625216247R: Liam R. Howlett <Liam.Howlett@oracle.com>1625316248R: Vlastimil Babka <vbabka@suse.cz>···16303162981630416299MEMORY MANAGEMENT - GUP (GET USER PAGES)1630516300M: Andrew Morton <akpm@linux-foundation.org>1630616306-M: David Hildenbrand <david@redhat.com>1630116301+M: David Hildenbrand <david@kernel.org>1630716302R: Jason Gunthorpe <jgg@nvidia.com>1630816303R: John Hubbard <jhubbard@nvidia.com>1630916304R: Peter Xu <peterx@redhat.com>···16319163141632016315MEMORY MANAGEMENT - KSM (Kernel Samepage Merging)1632116316M: Andrew Morton <akpm@linux-foundation.org>1632216322-M: David Hildenbrand <david@redhat.com>1631716317+M: David Hildenbrand <david@kernel.org>1632316318R: Xu Xin <xu.xin16@zte.com.cn>1632416319R: Chengming Zhou <chengming.zhou@linux.dev>1632516320L: linux-mm@kvack.org···16335163301633616331MEMORY MANAGEMENT - MEMORY POLICY AND MIGRATION1633716332M: Andrew Morton <akpm@linux-foundation.org>1633816338-M: David Hildenbrand <david@redhat.com>1633316333+M: David Hildenbrand <david@kernel.org>1633916334R: Zi Yan <ziy@nvidia.com>1634016335R: Matthew Brost <matthew.brost@intel.com>1634116336R: Joshua Hahn <joshua.hahnjy@gmail.com>···16375163701637616371MEMORY MANAGEMENT - MISC1637716372M: Andrew Morton <akpm@linux-foundation.org>1637816378-M: David Hildenbrand <david@redhat.com>1637316373+M: David Hildenbrand <david@kernel.org>1637916374R: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>1638016375R: Liam R. Howlett <Liam.Howlett@oracle.com>1638116376R: Vlastimil Babka <vbabka@suse.cz>···1646316458MEMORY MANAGEMENT - RECLAIM1646416459M: Andrew Morton <akpm@linux-foundation.org>1646516460M: Johannes Weiner <hannes@cmpxchg.org>1646616466-R: David Hildenbrand <david@redhat.com>1646116461+R: David Hildenbrand <david@kernel.org>1646716462R: Michal Hocko <mhocko@kernel.org>1646816463R: Qi Zheng <zhengqi.arch@bytedance.com>1646916464R: Shakeel Butt <shakeel.butt@linux.dev>···16476164711647716472MEMORY MANAGEMENT - RMAP (REVERSE MAPPING)1647816473M: Andrew Morton <akpm@linux-foundation.org>1647916479-M: David Hildenbrand <david@redhat.com>1647416474+M: David Hildenbrand <david@kernel.org>1648016475M: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>1648116476R: Rik van Riel <riel@surriel.com>1648216477R: Liam R. Howlett <Liam.Howlett@oracle.com>···16500164951650116496MEMORY MANAGEMENT - SWAP1650216497M: Andrew Morton <akpm@linux-foundation.org>1649816498+M: Chris Li <chrisl@kernel.org>1649916499+M: Kairui Song <kasong@tencent.com>1650316500R: Kemeng Shi <shikemeng@huaweicloud.com>1650416504-R: Kairui Song <kasong@tencent.com>1650516501R: Nhat Pham <nphamcs@gmail.com>1650616502R: Baoquan He <bhe@redhat.com>1650716503R: Barry Song <baohua@kernel.org>1650816508-R: Chris Li <chrisl@kernel.org>1650916504L: linux-mm@kvack.org1651016505S: Maintained1651116506F: Documentation/mm/swap-table.rst···16521165161652216517MEMORY MANAGEMENT - THP (TRANSPARENT HUGE PAGE)1652316518M: Andrew Morton <akpm@linux-foundation.org>1652416524-M: David Hildenbrand <david@redhat.com>1651916519+M: David Hildenbrand <david@kernel.org>1652516520M: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>1652616521R: Zi Yan <ziy@nvidia.com>1652716522R: Baolin Wang <baolin.wang@linux.alibaba.com>···1662316618M: Andrew Morton <akpm@linux-foundation.org>1662416619M: Liam R. Howlett <Liam.Howlett@oracle.com>1662516620M: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>1662616626-M: David Hildenbrand <david@redhat.com>1662116621+M: David Hildenbrand <david@kernel.org>1662716622R: Vlastimil Babka <vbabka@suse.cz>1662816623R: Jann Horn <jannh@google.com>1662916624L: linux-mm@kvack.org···2016520160R: Jiri Olsa <jolsa@kernel.org>2016620161R: Ian Rogers <irogers@google.com>2016720162R: Adrian Hunter <adrian.hunter@intel.com>2016320163+R: James Clark <james.clark@linaro.org>2016820164L: linux-perf-users@vger.kernel.org2016920165L: linux-kernel@vger.kernel.org2017020166S: Supported···27090270842709127085VIRTIO BALLOON2709227086M: "Michael S. Tsirkin" <mst@redhat.com>2709327093-M: David Hildenbrand <david@redhat.com>2708727087+M: David Hildenbrand <david@kernel.org>2709427088L: virtualization@lists.linux.dev2709527089S: Maintained2709627090F: drivers/virtio/virtio_balloon.c···2724527239F: include/uapi/linux/virtio_iommu.h27246272402724727241VIRTIO MEM DRIVER2724827248-M: David Hildenbrand <david@redhat.com>2724227242+M: David Hildenbrand <david@kernel.org>2724927243L: virtualization@lists.linux.dev2725027244S: Maintained2725127245W: https://virtio-mem.gitlab.io/···2785127845F: arch/x86/kernel/unwind_*.c27852278462785327847X86 TRUST DOMAIN EXTENSIONS (TDX)2785427854-M: Kirill A. Shutemov <kas@kernel.org>2784827848+M: Kiryl Shutsemau <kas@kernel.org>2785527849R: Dave Hansen <dave.hansen@linux.intel.com>2785627850R: Rick Edgecombe <rick.p.edgecombe@intel.com>2785727851L: x86@kernel.org
···917917 An architecture should select this option if it requires the918918 .kcfi_traps section for KCFI trap handling.919919920920+config ARCH_USES_CFI_GENERIC_LLVM_PASS921921+ bool922922+ help923923+ An architecture should select this option if it uses the generic924924+ KCFIPass in LLVM to expand kCFI bundles instead of architecture-specific925925+ lowering.926926+920927config CFI921928 bool "Use Kernel Control Flow Integrity (kCFI)"922929 default CFI_CLANG
···197197 */198198void __init acpi_boot_table_init(void)199199{200200- int ret;201201-202200 /*203201 * Enable ACPI instead of device tree unless204202 * - ACPI has been disabled explicitly (acpi=off), or···250252 * behaviour, use acpi=nospcr to disable console in ACPI SPCR251253 * table as default serial console.252254 */253253- ret = acpi_parse_spcr(earlycon_acpi_spcr_enable,255255+ acpi_parse_spcr(earlycon_acpi_spcr_enable,254256 !param_acpi_nospcr);255255- if (!ret || param_acpi_nospcr || !IS_ENABLED(CONFIG_ACPI_SPCR_TABLE))256256- pr_info("Use ACPI SPCR as default console: No\n");257257- else258258- pr_info("Use ACPI SPCR as default console: Yes\n");259257260258 if (IS_ENABLED(CONFIG_ACPI_BGRT))261259 acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
···9595#include <asm/vectors.h>9696#include <asm/virt.h>97979898+#include <asm/spectre.h>9899/* Kernel representation of AT_HWCAP and AT_HWCAP2 */99100static DECLARE_BITMAP(elf_hwcap, MAX_CPU_FEATURES) __read_mostly;100101···38763875 */38773876 if (system_uses_ttbr0_pan())38783877 pr_info("emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching\n");38783878+38793879+ /*38803880+ * Report Spectre mitigations status.38813881+ */38823882+ spectre_print_disabled_mitigations();38793883}3880388438813885void __init setup_system_features(void)
+17-4
arch/arm64/kernel/module.c
···489489 int ret;490490491491 s = find_section(hdr, sechdrs, ".altinstructions");492492- if (s)493493- apply_alternatives_module((void *)s->sh_addr, s->sh_size);492492+ if (s) {493493+ ret = apply_alternatives_module((void *)s->sh_addr, s->sh_size);494494+ if (ret < 0) {495495+ pr_err("module %s: error occurred when applying alternatives\n", me->name);496496+ return ret;497497+ }498498+ }494499495500 if (scs_is_dynamic()) {496501 s = find_section(hdr, sechdrs, ".init.eh_frame");497502 if (s) {498498- ret = __pi_scs_patch((void *)s->sh_addr, s->sh_size);499499- if (ret)503503+ /*504504+ * Because we can reject modules that are malformed505505+ * so SCS patching fails, skip dry run and try to patch506506+ * it in place. If patching fails, the module would not507507+ * be loaded anyway.508508+ */509509+ ret = __pi_scs_patch((void *)s->sh_addr, s->sh_size, true);510510+ if (ret) {500511 pr_err("module %s: error occurred during dynamic SCS patching (%d)\n",501512 me->name, ret);513513+ return -ENOEXEC;514514+ }502515 }503516 }504517
···91919292static bool spectre_v2_mitigations_off(void)9393{9494- bool ret = __nospectre_v2 || cpu_mitigations_off();9595-9696- if (ret)9797- pr_info_once("spectre-v2 mitigation disabled by command line option\n");9898-9999- return ret;9494+ return __nospectre_v2 || cpu_mitigations_off();10095}1019610297static const char *get_bhb_affected_string(enum mitigation_state bhb_state)···416421 */417422static bool spectre_v4_mitigations_off(void)418423{419419- bool ret = cpu_mitigations_off() ||420420- __spectre_v4_policy == SPECTRE_V4_POLICY_MITIGATION_DISABLED;421421-422422- if (ret)423423- pr_info_once("spectre-v4 mitigation disabled by command-line option\n");424424-425425- return ret;424424+ return cpu_mitigations_off() ||425425+ __spectre_v4_policy == SPECTRE_V4_POLICY_MITIGATION_DISABLED;426426}427427428428/* Do we need to toggle the mitigation state on entry to/exit from the kernel? */···1032104210331043 if (arm64_get_spectre_v2_state() == SPECTRE_VULNERABLE) {10341044 /* No point mitigating Spectre-BHB alone. */10351035- } else if (!IS_ENABLED(CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY)) {10361036- pr_info_once("spectre-bhb mitigation disabled by compile time option\n");10371037- } else if (cpu_mitigations_off() || __nospectre_bhb) {10381038- pr_info_once("spectre-bhb mitigation disabled by command line option\n");10391045 } else if (supports_ecbhb(SCOPE_LOCAL_CPU)) {10401046 state = SPECTRE_MITIGATED;10411047 set_bit(BHB_HW, &system_bhb_mitigations);···11851199 pr_err("WARNING: %s", EBPF_WARN);11861200}11871201#endif12021202+12031203+void spectre_print_disabled_mitigations(void)12041204+{12051205+ /* Keep a single copy of the common message suffix to avoid duplication. */12061206+ const char *spectre_disabled_suffix = "mitigation disabled by command-line option\n";12071207+12081208+ if (spectre_v2_mitigations_off())12091209+ pr_info("spectre-v2 %s", spectre_disabled_suffix);12101210+12111211+ if (spectre_v4_mitigations_off())12121212+ pr_info("spectre-v4 %s", spectre_disabled_suffix);12131213+12141214+ if (__nospectre_bhb || cpu_mitigations_off())12151215+ pr_info("spectre-bhb %s", spectre_disabled_suffix);12161216+}
+7-2
arch/arm64/kvm/hyp/nvhe/ffa.c
···479479 struct ffa_mem_region_attributes *ep_mem_access;480480 struct ffa_composite_mem_region *reg;481481 struct ffa_mem_region *buf;482482- u32 offset, nr_ranges;482482+ u32 offset, nr_ranges, checked_offset;483483 int ret = 0;484484485485 if (addr_mbz || npages_mbz || fraglen > len ||···516516 goto out_unlock;517517 }518518519519- if (fraglen < offset + sizeof(struct ffa_composite_mem_region)) {519519+ if (check_add_overflow(offset, sizeof(struct ffa_composite_mem_region), &checked_offset)) {520520+ ret = FFA_RET_INVALID_PARAMETERS;521521+ goto out_unlock;522522+ }523523+524524+ if (fraglen < checked_offset) {520525 ret = FFA_RET_INVALID_PARAMETERS;521526 goto out_unlock;522527 }
+28
arch/arm64/kvm/hyp/nvhe/mem_protect.c
···367367 return kvm_pgtable_stage2_unmap(pgt, addr, BIT(pgt->ia_bits) - addr);368368}369369370370+/*371371+ * Ensure the PFN range is contained within PA-range.372372+ *373373+ * This check is also robust to overflows and is therefore a requirement before374374+ * using a pfn/nr_pages pair from an untrusted source.375375+ */376376+static bool pfn_range_is_valid(u64 pfn, u64 nr_pages)377377+{378378+ u64 limit = BIT(kvm_phys_shift(&host_mmu.arch.mmu) - PAGE_SHIFT);379379+380380+ return pfn < limit && ((limit - pfn) >= nr_pages);381381+}382382+370383struct kvm_mem_range {371384 u64 start;372385 u64 end;···789776 void *virt = __hyp_va(phys);790777 int ret;791778779779+ if (!pfn_range_is_valid(pfn, nr_pages))780780+ return -EINVAL;781781+792782 host_lock_component();793783 hyp_lock_component();794784···819803 u64 size = PAGE_SIZE * nr_pages;820804 u64 virt = (u64)__hyp_va(phys);821805 int ret;806806+807807+ if (!pfn_range_is_valid(pfn, nr_pages))808808+ return -EINVAL;822809823810 host_lock_component();824811 hyp_lock_component();···906887 u64 size = PAGE_SIZE * nr_pages;907888 int ret;908889890890+ if (!pfn_range_is_valid(pfn, nr_pages))891891+ return -EINVAL;892892+909893 host_lock_component();910894 ret = __host_check_page_state_range(phys, size, PKVM_PAGE_OWNED);911895 if (!ret)···923901 u64 phys = hyp_pfn_to_phys(pfn);924902 u64 size = PAGE_SIZE * nr_pages;925903 int ret;904904+905905+ if (!pfn_range_is_valid(pfn, nr_pages))906906+ return -EINVAL;926907927908 host_lock_component();928909 ret = __host_check_page_state_range(phys, size, PKVM_PAGE_SHARED_OWNED);···968943 int ret;969944970945 if (prot & ~KVM_PGTABLE_PROT_RWX)946946+ return -EINVAL;947947+948948+ if (!pfn_range_is_valid(pfn, nr_pages))971949 return -EINVAL;972950973951 ret = __guest_check_transition_size(phys, ipa, nr_pages, &size);
+38-33
arch/arm64/kvm/sys_regs.c
···25952595 .val = 0, \25962596}2597259725982598-/* sys_reg_desc initialiser for known cpufeature ID registers */25992599-#define AA32_ID_SANITISED(name) { \26002600- ID_DESC(name), \26012601- .visibility = aa32_id_visibility, \26022602- .val = 0, \26032603-}26042604-26052598/* sys_reg_desc initialiser for writable ID registers */26062599#define ID_WRITABLE(name, mask) { \26072600 ID_DESC(name), \26082601 .val = mask, \26022602+}26032603+26042604+/*26052605+ * 32bit ID regs are fully writable when the guest is 32bit26062606+ * capable. Nothing in the KVM code should rely on 32bit features26072607+ * anyway, only 64bit, so let the VMM do its worse.26082608+ */26092609+#define AA32_ID_WRITABLE(name) { \26102610+ ID_DESC(name), \26112611+ .visibility = aa32_id_visibility, \26122612+ .val = GENMASK(31, 0), \26092613}2610261426112615/* sys_reg_desc initialiser for cpufeature ID registers that need filtering */···3132312831333129 /* AArch64 mappings of the AArch32 ID registers */31343130 /* CRm=1 */31353135- AA32_ID_SANITISED(ID_PFR0_EL1),31363136- AA32_ID_SANITISED(ID_PFR1_EL1),31313131+ AA32_ID_WRITABLE(ID_PFR0_EL1),31323132+ AA32_ID_WRITABLE(ID_PFR1_EL1),31373133 { SYS_DESC(SYS_ID_DFR0_EL1),31383134 .access = access_id_reg,31393135 .get_user = get_id_reg,31403136 .set_user = set_id_dfr0_el1,31413137 .visibility = aa32_id_visibility,31423138 .reset = read_sanitised_id_dfr0_el1,31433143- .val = ID_DFR0_EL1_PerfMon_MASK |31443144- ID_DFR0_EL1_CopDbg_MASK, },31393139+ .val = GENMASK(31, 0) },31453140 ID_HIDDEN(ID_AFR0_EL1),31463146- AA32_ID_SANITISED(ID_MMFR0_EL1),31473147- AA32_ID_SANITISED(ID_MMFR1_EL1),31483148- AA32_ID_SANITISED(ID_MMFR2_EL1),31493149- AA32_ID_SANITISED(ID_MMFR3_EL1),31413141+ AA32_ID_WRITABLE(ID_MMFR0_EL1),31423142+ AA32_ID_WRITABLE(ID_MMFR1_EL1),31433143+ AA32_ID_WRITABLE(ID_MMFR2_EL1),31443144+ AA32_ID_WRITABLE(ID_MMFR3_EL1),3150314531513146 /* CRm=2 */31523152- AA32_ID_SANITISED(ID_ISAR0_EL1),31533153- AA32_ID_SANITISED(ID_ISAR1_EL1),31543154- AA32_ID_SANITISED(ID_ISAR2_EL1),31553155- AA32_ID_SANITISED(ID_ISAR3_EL1),31563156- AA32_ID_SANITISED(ID_ISAR4_EL1),31573157- AA32_ID_SANITISED(ID_ISAR5_EL1),31583158- AA32_ID_SANITISED(ID_MMFR4_EL1),31593159- AA32_ID_SANITISED(ID_ISAR6_EL1),31473147+ AA32_ID_WRITABLE(ID_ISAR0_EL1),31483148+ AA32_ID_WRITABLE(ID_ISAR1_EL1),31493149+ AA32_ID_WRITABLE(ID_ISAR2_EL1),31503150+ AA32_ID_WRITABLE(ID_ISAR3_EL1),31513151+ AA32_ID_WRITABLE(ID_ISAR4_EL1),31523152+ AA32_ID_WRITABLE(ID_ISAR5_EL1),31533153+ AA32_ID_WRITABLE(ID_MMFR4_EL1),31543154+ AA32_ID_WRITABLE(ID_ISAR6_EL1),3160315531613156 /* CRm=3 */31623162- AA32_ID_SANITISED(MVFR0_EL1),31633163- AA32_ID_SANITISED(MVFR1_EL1),31643164- AA32_ID_SANITISED(MVFR2_EL1),31573157+ AA32_ID_WRITABLE(MVFR0_EL1),31583158+ AA32_ID_WRITABLE(MVFR1_EL1),31593159+ AA32_ID_WRITABLE(MVFR2_EL1),31653160 ID_UNALLOCATED(3,3),31663166- AA32_ID_SANITISED(ID_PFR2_EL1),31613161+ AA32_ID_WRITABLE(ID_PFR2_EL1),31673162 ID_HIDDEN(ID_DFR1_EL1),31683168- AA32_ID_SANITISED(ID_MMFR5_EL1),31633163+ AA32_ID_WRITABLE(ID_MMFR5_EL1),31693164 ID_UNALLOCATED(3,7),3170316531713166 /* AArch64 ID registers */···5609560656105607 guard(mutex)(&kvm->arch.config_lock);5611560856125612- if (!(static_branch_unlikely(&kvm_vgic_global_state.gicv3_cpuif) &&56135613- irqchip_in_kernel(kvm) &&56145614- kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3)) {56155615- kvm->arch.id_regs[IDREG_IDX(SYS_ID_AA64PFR0_EL1)] &= ~ID_AA64PFR0_EL1_GIC_MASK;56165616- kvm->arch.id_regs[IDREG_IDX(SYS_ID_PFR1_EL1)] &= ~ID_PFR1_EL1_GIC_MASK;56095609+ if (!irqchip_in_kernel(kvm)) {56105610+ u64 val;56115611+56125612+ val = kvm_read_vm_id_reg(kvm, SYS_ID_AA64PFR0_EL1) & ~ID_AA64PFR0_EL1_GIC;56135613+ kvm_set_vm_id_reg(kvm, SYS_ID_AA64PFR0_EL1, val);56145614+ val = kvm_read_vm_id_reg(kvm, SYS_ID_PFR1_EL1) & ~ID_PFR1_EL1_GIC;56155615+ kvm_set_vm_id_reg(kvm, SYS_ID_PFR1_EL1, val);56175616 }5618561756195618 if (vcpu_has_nv(vcpu)) {
+12-4
arch/arm64/kvm/vgic/vgic-debug.c
···6464static int iter_mark_lpis(struct kvm *kvm)6565{6666 struct vgic_dist *dist = &kvm->arch.vgic;6767+ unsigned long intid, flags;6768 struct vgic_irq *irq;6868- unsigned long intid;6969 int nr_lpis = 0;7070+7171+ xa_lock_irqsave(&dist->lpi_xa, flags);70727173 xa_for_each(&dist->lpi_xa, intid, irq) {7274 if (!vgic_try_get_irq_ref(irq))7375 continue;74767575- xa_set_mark(&dist->lpi_xa, intid, LPI_XA_MARK_DEBUG_ITER);7777+ __xa_set_mark(&dist->lpi_xa, intid, LPI_XA_MARK_DEBUG_ITER);7678 nr_lpis++;7779 }8080+8181+ xa_unlock_irqrestore(&dist->lpi_xa, flags);78827983 return nr_lpis;8084}···8682static void iter_unmark_lpis(struct kvm *kvm)8783{8884 struct vgic_dist *dist = &kvm->arch.vgic;8585+ unsigned long intid, flags;8986 struct vgic_irq *irq;9090- unsigned long intid;91879288 xa_for_each_marked(&dist->lpi_xa, intid, irq, LPI_XA_MARK_DEBUG_ITER) {9393- xa_clear_mark(&dist->lpi_xa, intid, LPI_XA_MARK_DEBUG_ITER);8989+ xa_lock_irqsave(&dist->lpi_xa, flags);9090+ __xa_clear_mark(&dist->lpi_xa, intid, LPI_XA_MARK_DEBUG_ITER);9191+ xa_unlock_irqrestore(&dist->lpi_xa, flags);9292+9393+ /* vgic_put_irq() expects to be called outside of the xa_lock */9494 vgic_put_irq(kvm, irq);9595 }9696}
···7878{7979 struct vgic_dist *dist = &kvm->arch.vgic;8080 struct vgic_irq *irq = vgic_get_irq(kvm, intid), *oldirq;8181+ unsigned long flags;8182 int ret;82838384 /* In this case there is no put, since we keep the reference. */···8988 if (!irq)9089 return ERR_PTR(-ENOMEM);91909292- ret = xa_reserve(&dist->lpi_xa, intid, GFP_KERNEL_ACCOUNT);9191+ ret = xa_reserve_irq(&dist->lpi_xa, intid, GFP_KERNEL_ACCOUNT);9392 if (ret) {9493 kfree(irq);9594 return ERR_PTR(ret);···104103 irq->target_vcpu = vcpu;105104 irq->group = 1;106105107107- xa_lock(&dist->lpi_xa);106106+ xa_lock_irqsave(&dist->lpi_xa, flags);108107109108 /*110109 * There could be a race with another vgic_add_lpi(), so we need to···115114 /* Someone was faster with adding this LPI, lets use that. */116115 kfree(irq);117116 irq = oldirq;118118-119119- goto out_unlock;117117+ } else {118118+ ret = xa_err(__xa_store(&dist->lpi_xa, intid, irq, 0));120119 }121120122122- ret = xa_err(__xa_store(&dist->lpi_xa, intid, irq, 0));121121+ xa_unlock_irqrestore(&dist->lpi_xa, flags);122122+123123 if (ret) {124124 xa_release(&dist->lpi_xa, intid);125125 kfree(irq);126126- }127126128128-out_unlock:129129- xa_unlock(&dist->lpi_xa);130130-131131- if (ret)132127 return ERR_PTR(ret);128128+ }133129134130 /*135131 * We "cache" the configuration table entries in our struct vgic_irq's.
+2-1
arch/arm64/kvm/vgic/vgic-v3.c
···301301 return;302302303303 /* Hide GICv3 sysreg if necessary */304304- if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2) {304304+ if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2 ||305305+ !irqchip_in_kernel(vcpu->kvm)) {305306 vgic_v3->vgic_hcr |= (ICH_HCR_EL2_TALL0 | ICH_HCR_EL2_TALL1 |306307 ICH_HCR_EL2_TC);307308 return;
+15-8
arch/arm64/kvm/vgic/vgic.c
···2828 * kvm->arch.config_lock (mutex)2929 * its->cmd_lock (mutex)3030 * its->its_lock (mutex)3131- * vgic_dist->lpi_xa.xa_lock3131+ * vgic_dist->lpi_xa.xa_lock must be taken with IRQs disabled3232 * vgic_cpu->ap_list_lock must be taken with IRQs disabled3333 * vgic_irq->irq_lock must be taken with IRQs disabled3434 *···141141void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq)142142{143143 struct vgic_dist *dist = &kvm->arch.vgic;144144+ unsigned long flags;144145145145- if (irq->intid >= VGIC_MIN_LPI)146146- might_lock(&dist->lpi_xa.xa_lock);146146+ /*147147+ * Normally the lock is only taken when the refcount drops to 0.148148+ * Acquire/release it early on lockdep kernels to make locking issues149149+ * in rare release paths a bit more obvious.150150+ */151151+ if (IS_ENABLED(CONFIG_LOCKDEP) && irq->intid >= VGIC_MIN_LPI) {152152+ guard(spinlock_irqsave)(&dist->lpi_xa.xa_lock);153153+ }147154148155 if (!__vgic_put_irq(kvm, irq))149156 return;150157151151- xa_lock(&dist->lpi_xa);158158+ xa_lock_irqsave(&dist->lpi_xa, flags);152159 vgic_release_lpi_locked(dist, irq);153153- xa_unlock(&dist->lpi_xa);160160+ xa_unlock_irqrestore(&dist->lpi_xa, flags);154161}155162156163static void vgic_release_deleted_lpis(struct kvm *kvm)157164{158165 struct vgic_dist *dist = &kvm->arch.vgic;159159- unsigned long intid;166166+ unsigned long flags, intid;160167 struct vgic_irq *irq;161168162162- xa_lock(&dist->lpi_xa);169169+ xa_lock_irqsave(&dist->lpi_xa, flags);163170164171 xa_for_each(&dist->lpi_xa, intid, irq) {165172 if (irq->pending_release)166173 vgic_release_lpi_locked(dist, irq);167174 }168175169169- xa_unlock(&dist->lpi_xa);176176+ xa_unlock_irqrestore(&dist->lpi_xa, flags);170177}171178172179void vgic_flush_pending_lpis(struct kvm_vcpu *vcpu)
+10
arch/arm64/mm/fault.c
···969969970970void tag_clear_highpage(struct page *page)971971{972972+ /*973973+ * Check if MTE is supported and fall back to clear_highpage().974974+ * get_huge_zero_folio() unconditionally passes __GFP_ZEROTAGS and975975+ * post_alloc_hook() will invoke tag_clear_highpage().976976+ */977977+ if (!system_supports_mte()) {978978+ clear_highpage(page);979979+ return;980980+ }981981+972982 /* Newly allocated page, shouldn't have been tagged yet */973983 WARN_ON_ONCE(!try_page_mte_tagging(page));974984 mte_zero_clear_page_tags(page_address(page));
+80-31
arch/arm64/mm/mmu.c
···708708 return ret;709709}710710711711+static inline bool force_pte_mapping(void)712712+{713713+ const bool bbml2 = system_capabilities_finalized() ?714714+ system_supports_bbml2_noabort() : cpu_supports_bbml2_noabort();715715+716716+ if (debug_pagealloc_enabled())717717+ return true;718718+ if (bbml2)719719+ return false;720720+ return rodata_full || arm64_kfence_can_set_direct_map() || is_realm_world();721721+}722722+723723+static inline bool split_leaf_mapping_possible(void)724724+{725725+ /*726726+ * !BBML2_NOABORT systems should never run into scenarios where we would727727+ * have to split. So exit early and let calling code detect it and raise728728+ * a warning.729729+ */730730+ if (!system_supports_bbml2_noabort())731731+ return false;732732+ return !force_pte_mapping();733733+}734734+711735static DEFINE_MUTEX(pgtable_split_lock);712736713737int split_kernel_leaf_mapping(unsigned long start, unsigned long end)···739715 int ret;740716741717 /*742742- * !BBML2_NOABORT systems should not be trying to change permissions on743743- * anything that is not pte-mapped in the first place. Just return early744744- * and let the permission change code raise a warning if not already745745- * pte-mapped.718718+ * Exit early if the region is within a pte-mapped area or if we can't719719+ * split. For the latter case, the permission change code will raise a720720+ * warning if not already pte-mapped.746721 */747747- if (!system_supports_bbml2_noabort())722722+ if (!split_leaf_mapping_possible() || is_kfence_address((void *)start))748723 return 0;749724750725 /*···781758 return ret;782759}783760784784-static int __init split_to_ptes_pud_entry(pud_t *pudp, unsigned long addr,785785- unsigned long next,786786- struct mm_walk *walk)761761+static int split_to_ptes_pud_entry(pud_t *pudp, unsigned long addr,762762+ unsigned long next, struct mm_walk *walk)787763{764764+ gfp_t gfp = *(gfp_t *)walk->private;788765 pud_t pud = pudp_get(pudp);789766 int ret = 0;790767791768 if (pud_leaf(pud))792792- ret = split_pud(pudp, pud, GFP_ATOMIC, false);769769+ ret = split_pud(pudp, pud, gfp, false);793770794771 return ret;795772}796773797797-static int __init split_to_ptes_pmd_entry(pmd_t *pmdp, unsigned long addr,798798- unsigned long next,799799- struct mm_walk *walk)774774+static int split_to_ptes_pmd_entry(pmd_t *pmdp, unsigned long addr,775775+ unsigned long next, struct mm_walk *walk)800776{777777+ gfp_t gfp = *(gfp_t *)walk->private;801778 pmd_t pmd = pmdp_get(pmdp);802779 int ret = 0;803780804781 if (pmd_leaf(pmd)) {805782 if (pmd_cont(pmd))806783 split_contpmd(pmdp);807807- ret = split_pmd(pmdp, pmd, GFP_ATOMIC, false);784784+ ret = split_pmd(pmdp, pmd, gfp, false);808785809786 /*810787 * We have split the pmd directly to ptes so there is no need to···816793 return ret;817794}818795819819-static int __init split_to_ptes_pte_entry(pte_t *ptep, unsigned long addr,820820- unsigned long next,821821- struct mm_walk *walk)796796+static int split_to_ptes_pte_entry(pte_t *ptep, unsigned long addr,797797+ unsigned long next, struct mm_walk *walk)822798{823799 pte_t pte = __ptep_get(ptep);824800···827805 return 0;828806}829807830830-static const struct mm_walk_ops split_to_ptes_ops __initconst = {808808+static const struct mm_walk_ops split_to_ptes_ops = {831809 .pud_entry = split_to_ptes_pud_entry,832810 .pmd_entry = split_to_ptes_pmd_entry,833811 .pte_entry = split_to_ptes_pte_entry,834812};813813+814814+static int range_split_to_ptes(unsigned long start, unsigned long end, gfp_t gfp)815815+{816816+ int ret;817817+818818+ arch_enter_lazy_mmu_mode();819819+ ret = walk_kernel_page_table_range_lockless(start, end,820820+ &split_to_ptes_ops, NULL, &gfp);821821+ arch_leave_lazy_mmu_mode();822822+823823+ return ret;824824+}835825836826static bool linear_map_requires_bbml2 __initdata;837827···881847 * PTE. The kernel alias remains static throughout runtime so882848 * can continue to be safely mapped with large mappings.883849 */884884- ret = walk_kernel_page_table_range_lockless(lstart, kstart,885885- &split_to_ptes_ops, NULL, NULL);850850+ ret = range_split_to_ptes(lstart, kstart, GFP_ATOMIC);886851 if (!ret)887887- ret = walk_kernel_page_table_range_lockless(kend, lend,888888- &split_to_ptes_ops, NULL, NULL);852852+ ret = range_split_to_ptes(kend, lend, GFP_ATOMIC);889853 if (ret)890854 panic("Failed to split linear map\n");891855 flush_tlb_kernel_range(lstart, lend);···10341002 memblock_clear_nomap(kfence_pool, KFENCE_POOL_SIZE);10351003 __kfence_pool = phys_to_virt(kfence_pool);10361004}10051005+10061006+bool arch_kfence_init_pool(void)10071007+{10081008+ unsigned long start = (unsigned long)__kfence_pool;10091009+ unsigned long end = start + KFENCE_POOL_SIZE;10101010+ int ret;10111011+10121012+ /* Exit early if we know the linear map is already pte-mapped. */10131013+ if (!split_leaf_mapping_possible())10141014+ return true;10151015+10161016+ /* Kfence pool is already pte-mapped for the early init case. */10171017+ if (kfence_early_init)10181018+ return true;10191019+10201020+ mutex_lock(&pgtable_split_lock);10211021+ ret = range_split_to_ptes(start, end, GFP_PGTABLE_KERNEL);10221022+ mutex_unlock(&pgtable_split_lock);10231023+10241024+ /*10251025+ * Since the system supports bbml2_noabort, tlb invalidation is not10261026+ * required here; the pgtable mappings have been split to pte but larger10271027+ * entries may safely linger in the TLB.10281028+ */10291029+10301030+ return !ret;10311031+}10371032#else /* CONFIG_KFENCE */1038103310391034static inline phys_addr_t arm64_kfence_alloc_pool(void) { return 0; }10401035static inline void arm64_kfence_map_pool(phys_addr_t kfence_pool, pgd_t *pgdp) { }1041103610421037#endif /* CONFIG_KFENCE */10431043-10441044-static inline bool force_pte_mapping(void)10451045-{10461046- bool bbml2 = system_capabilities_finalized() ?10471047- system_supports_bbml2_noabort() : cpu_supports_bbml2_noabort();10481048-10491049- return (!bbml2 && (rodata_full || arm64_kfence_can_set_direct_map() ||10501050- is_realm_world())) ||10511051- debug_pagealloc_enabled();10521052-}1053103810541039static void __init map_mem(pgd_t *pgdp)10551040{
+1-1
arch/loongarch/Makefile
···109109ifdef CONFIG_RUSTC_HAS_ANNOTATE_TABLEJUMP110110KBUILD_RUSTFLAGS += -Cllvm-args=--loongarch-annotate-tablejump111111else112112-KBUILD_RUSTFLAGS += -Zno-jump-tables # keep compatibility with older compilers112112+KBUILD_RUSTFLAGS += $(if $(call rustc-min-version,109300),-Cjump-tables=n,-Zno-jump-tables) # keep compatibility with older compilers113113endif114114ifdef CONFIG_LTO_CLANG115115# The annotate-tablejump option can not be passed to LLVM backend when LTO is enabled.
···101101#define CPU_FEATURE_HYPERVISOR 26 /* CPU has hypervisor (running in VM) */102102#define CPU_FEATURE_PTW 27 /* CPU has hardware page table walker */103103#define CPU_FEATURE_LSPW 28 /* CPU has LSPW (lddir/ldpte instructions) */104104-#define CPU_FEATURE_AVECINT 29 /* CPU has AVEC interrupt */104104+#define CPU_FEATURE_MSGINT 29 /* CPU has MSG interrupt */105105+#define CPU_FEATURE_AVECINT 30 /* CPU has AVEC interrupt */106106+#define CPU_FEATURE_REDIRECTINT 31 /* CPU has interrupt remapping */105107106108#define LOONGARCH_CPU_CPUCFG BIT_ULL(CPU_FEATURE_CPUCFG)107109#define LOONGARCH_CPU_LAM BIT_ULL(CPU_FEATURE_LAM)···134132#define LOONGARCH_CPU_HYPERVISOR BIT_ULL(CPU_FEATURE_HYPERVISOR)135133#define LOONGARCH_CPU_PTW BIT_ULL(CPU_FEATURE_PTW)136134#define LOONGARCH_CPU_LSPW BIT_ULL(CPU_FEATURE_LSPW)135135+#define LOONGARCH_CPU_MSGINT BIT_ULL(CPU_FEATURE_MSGINT)137136#define LOONGARCH_CPU_AVECINT BIT_ULL(CPU_FEATURE_AVECINT)137137+#define LOONGARCH_CPU_REDIRECTINT BIT_ULL(CPU_FEATURE_REDIRECTINT)138138139139#endif /* _ASM_CPU_H */
+2-2
arch/loongarch/include/asm/hw_breakpoint.h
···134134/* Determine number of BRP registers available. */135135static inline int get_num_brps(void)136136{137137- return csr_read64(LOONGARCH_CSR_FWPC) & CSR_FWPC_NUM;137137+ return csr_read32(LOONGARCH_CSR_FWPC) & CSR_FWPC_NUM;138138}139139140140/* Determine number of WRP registers available. */141141static inline int get_num_wrps(void)142142{143143- return csr_read64(LOONGARCH_CSR_MWPC) & CSR_MWPC_NUM;143143+ return csr_read32(LOONGARCH_CSR_MWPC) & CSR_MWPC_NUM;144144}145145146146#endif /* __KERNEL__ */
+4-1
arch/loongarch/include/asm/io.h
···1414#include <asm/pgtable-bits.h>1515#include <asm/string.h>16161717-extern void __init __iomem *early_ioremap(u64 phys_addr, unsigned long size);1717+extern void __init __iomem *early_ioremap(phys_addr_t phys_addr, unsigned long size);1818extern void __init early_iounmap(void __iomem *addr, unsigned long size);19192020#define early_memremap early_ioremap···2525static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,2626 pgprot_t prot)2727{2828+ if (offset > TO_PHYS_MASK)2929+ return NULL;3030+2831 switch (pgprot_val(prot) & _CACHE_MASK) {2932 case _CACHE_CC:3033 return (void __iomem *)(unsigned long)(CACHE_BASE + offset);
···439439 spin_lock_irqsave(&s->lock, flags);440440 switch (type) {441441 case KVM_DEV_LOONGARCH_EXTIOI_CTRL_INIT_NUM_CPU:442442- if (val >= EIOINTC_ROUTE_MAX_VCPUS)442442+ if (val > EIOINTC_ROUTE_MAX_VCPUS)443443 ret = -EINVAL;444444 else445445 s->num_cpu = val;
+1-1
arch/loongarch/kvm/mmu.c
···857857858858 if (writeable) {859859 prot_bits = kvm_pte_mkwriteable(prot_bits);860860- if (write)860860+ if (write || !kvm_slot_dirty_track_enabled(memslot))861861 prot_bits = kvm_pte_mkdirty(prot_bits);862862 }863863
+2
arch/loongarch/kvm/timer.c
···44 */5566#include <linux/kvm_host.h>77+#include <asm/delay.h>78#include <asm/kvm_csr.h>89#include <asm/kvm_vcpu.h>910···9695 * and set CSR TVAL with -19796 */9897 write_gcsr_timertick(0);9898+ __delay(2); /* Wait cycles until timer interrupt injected */9999100100 /*101101 * Writing CSR_TINTCLR_TI to LOONGARCH_CSR_TINTCLR will clear
+9-10
arch/loongarch/kvm/vcpu.c
···132132 * Clear KVM_LARCH_PMU if the guest is not using PMU CSRs when133133 * exiting the guest, so that the next time trap into the guest.134134 * We don't need to deal with PMU CSRs contexts.135135+ *136136+ * Otherwise set the request bit KVM_REQ_PMU to restore guest PMU137137+ * before entering guest VM135138 */136139 val = kvm_read_sw_gcsr(csr, LOONGARCH_CSR_PERFCTRL0);137140 val |= kvm_read_sw_gcsr(csr, LOONGARCH_CSR_PERFCTRL1);···142139 val |= kvm_read_sw_gcsr(csr, LOONGARCH_CSR_PERFCTRL3);143140 if (!(val & KVM_PMU_EVENT_ENABLED))144141 vcpu->arch.aux_inuse &= ~KVM_LARCH_PMU;142142+ else143143+ kvm_make_request(KVM_REQ_PMU, vcpu);145144146145 kvm_restore_host_pmu(vcpu);147147-}148148-149149-static void kvm_restore_pmu(struct kvm_vcpu *vcpu)150150-{151151- if ((vcpu->arch.aux_inuse & KVM_LARCH_PMU))152152- kvm_make_request(KVM_REQ_PMU, vcpu);153146}154147155148static void kvm_check_pmu(struct kvm_vcpu *vcpu)···298299 vcpu->arch.aux_inuse &= ~KVM_LARCH_SWCSR_LATEST;299300300301 if (kvm_request_pending(vcpu) || xfer_to_guest_mode_work_pending()) {301301- kvm_lose_pmu(vcpu);302302+ if (vcpu->arch.aux_inuse & KVM_LARCH_PMU) {303303+ kvm_lose_pmu(vcpu);304304+ kvm_make_request(KVM_REQ_PMU, vcpu);305305+ }302306 /* make sure the vcpu mode has been written */303307 smp_store_mb(vcpu->mode, OUTSIDE_GUEST_MODE);304308 local_irq_enable();···16051603 /* Restore timer state regardless */16061604 kvm_restore_timer(vcpu);16071605 kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);16081608-16091609- /* Restore hardware PMU CSRs */16101610- kvm_restore_pmu(vcpu);1611160616121607 /* Don't bother restoring registers multiple times unless necessary */16131608 if (vcpu->arch.aux_inuse & KVM_LARCH_HWCSR_USABLE)
···137137 select ARCH_HAS_DMA_OPS if PPC64138138 select ARCH_HAS_FORTIFY_SOURCE139139 select ARCH_HAS_GCOV_PROFILE_ALL140140+ select ARCH_HAS_GIGANTIC_PAGE if ARCH_SUPPORTS_HUGETLBFS140141 select ARCH_HAS_KCOV141142 select ARCH_HAS_KERNEL_FPU_SUPPORT if PPC64 && PPC_FPU142143 select ARCH_HAS_MEMBARRIER_CALLBACKS
-1
arch/powerpc/platforms/Kconfig.cputype
···423423config PPC_RADIX_MMU424424 bool "Radix MMU Support"425425 depends on PPC_BOOK3S_64426426- select ARCH_HAS_GIGANTIC_PAGE427426 default y428427 help429428 Enable support for the Power ISA 3.0 Radix style MMU. Currently this
+1-1
arch/riscv/Kconfig
···367367 systems to handle cache management.368368369369config AS_HAS_INSN370370- def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)370370+ def_bool $(as-instr,.insn 0x100000f)371371372372config AS_HAS_OPTION_ARCH373373 # https://github.com/llvm/llvm-project/commit/9e8ed3403c191ab9c4903e8eeb8f732ff8a43cb4
···119119 unsigned int num_plts = 0;120120 unsigned int num_gots = 0;121121 Elf_Rela *scratch = NULL;122122+ Elf_Rela *new_scratch;122123 size_t scratch_size = 0;123124 int i;124125···169168 scratch_size_needed = (num_scratch_relas + num_relas) * sizeof(*scratch);170169 if (scratch_size_needed > scratch_size) {171170 scratch_size = scratch_size_needed;172172- scratch = kvrealloc(scratch, scratch_size, GFP_KERNEL);173173- if (!scratch)171171+ new_scratch = kvrealloc(scratch, scratch_size, GFP_KERNEL);172172+ if (!new_scratch) {173173+ kvfree(scratch);174174 return -ENOMEM;175175+ }176176+ scratch = new_scratch;175177 }176178177179 for (size_t j = 0; j < num_relas; j++)
+19-2
arch/riscv/kernel/stacktrace.c
···16161717#ifdef CONFIG_FRAME_POINTER18181919+/*2020+ * This disables KASAN checking when reading a value from another task's stack,2121+ * since the other task could be running on another CPU and could have poisoned2222+ * the stack in the meantime.2323+ */2424+#define READ_ONCE_TASK_STACK(task, x) \2525+({ \2626+ unsigned long val; \2727+ unsigned long addr = x; \2828+ if ((task) == current) \2929+ val = READ_ONCE(addr); \3030+ else \3131+ val = READ_ONCE_NOCHECK(addr); \3232+ val; \3333+})3434+1935extern asmlinkage void handle_exception(void);2036extern unsigned long ret_from_exception_end;2137···8569 fp = frame->ra;8670 pc = regs->ra;8771 } else {8888- fp = frame->fp;8989- pc = ftrace_graph_ret_addr(current, &graph_idx, frame->ra,7272+ fp = READ_ONCE_TASK_STACK(task, frame->fp);7373+ pc = READ_ONCE_TASK_STACK(task, frame->ra);7474+ pc = ftrace_graph_ret_addr(current, &graph_idx, pc,9075 &frame->ra);9176 if (pc >= (unsigned long)handle_exception &&9277 pc < (unsigned long)&ret_from_exception_end) {
+1-1
arch/riscv/kernel/tests/Kconfig.debug
···3131 If unsure, say N.32323333config RISCV_KPROBES_KUNIT3434- bool "KUnit test for riscv kprobes" if !KUNIT_ALL_TESTS3434+ tristate "KUnit test for riscv kprobes" if !KUNIT_ALL_TESTS3535 depends on KUNIT3636 depends on KPROBES3737 default KUNIT_ALL_TESTS
···4949};50505151static struct kunit_suite kprobes_test_suite = {5252- .name = "kprobes_test_riscv",5252+ .name = "kprobes_riscv",5353 .test_cases = kprobes_testcases,5454};55555656kunit_test_suites(&kprobes_test_suite);5757+5858+MODULE_LICENSE("GPL");5959+MODULE_DESCRIPTION("KUnit test for riscv kprobes");
+14-2
arch/riscv/kvm/aia_imsic.c
···689689 */690690691691 read_lock_irqsave(&imsic->vsfile_lock, flags);692692- if (imsic->vsfile_cpu > -1)693693- ret = !!(csr_read(CSR_HGEIP) & BIT(imsic->vsfile_hgei));692692+ if (imsic->vsfile_cpu > -1) {693693+ /*694694+ * This function is typically called from kvm_vcpu_block() via695695+ * kvm_arch_vcpu_runnable() upon WFI trap. The kvm_vcpu_block()696696+ * can be preempted and the blocking VCPU might resume on a697697+ * different CPU. This means it is possible that current CPU698698+ * does not match the imsic->vsfile_cpu hence this function699699+ * must check imsic->vsfile_cpu before accessing HGEIP CSR.700700+ */701701+ if (imsic->vsfile_cpu != vcpu->cpu)702702+ ret = true;703703+ else704704+ ret = !!(csr_read(CSR_HGEIP) & BIT(imsic->vsfile_hgei));705705+ }694706 read_unlock_irqrestore(&imsic->vsfile_lock, flags);695707696708 return ret;
+2-23
arch/riscv/kvm/mmu.c
···171171 enum kvm_mr_change change)172172{173173 hva_t hva, reg_end, size;174174- gpa_t base_gpa;175174 bool writable;176175 int ret = 0;177176···189190 hva = new->userspace_addr;190191 size = new->npages << PAGE_SHIFT;191192 reg_end = hva + size;192192- base_gpa = new->base_gfn << PAGE_SHIFT;193193 writable = !(new->flags & KVM_MEM_READONLY);194194195195 mmap_read_lock(current->mm);196196197197 /*198198 * A memory region could potentially cover multiple VMAs, and199199- * any holes between them, so iterate over all of them to find200200- * out if we can map any of them right now.199199+ * any holes between them, so iterate over all of them.201200 *202201 * +--------------------------------------------+203202 * +---------------+----------------+ +----------------+···206209 */207210 do {208211 struct vm_area_struct *vma;209209- hva_t vm_start, vm_end;212212+ hva_t vm_end;210213211214 vma = find_vma_intersection(current->mm, hva, reg_end);212215 if (!vma)···222225 }223226224227 /* Take the intersection of this VMA with the memory region */225225- vm_start = max(hva, vma->vm_start);226228 vm_end = min(reg_end, vma->vm_end);227229228230 if (vma->vm_flags & VM_PFNMAP) {229229- gpa_t gpa = base_gpa + (vm_start - hva);230230- phys_addr_t pa;231231-232232- pa = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;233233- pa += vm_start - vma->vm_start;234234-235231 /* IO region dirty page logging not allowed */236232 if (new->flags & KVM_MEM_LOG_DIRTY_PAGES) {237233 ret = -EINVAL;238234 goto out;239235 }240240-241241- ret = kvm_riscv_mmu_ioremap(kvm, gpa, pa, vm_end - vm_start,242242- writable, false);243243- if (ret)244244- break;245236 }246237 hva = vm_end;247238 } while (hva < reg_end);248248-249249- if (change == KVM_MR_FLAGS_ONLY)250250- goto out;251251-252252- if (ret)253253- kvm_riscv_mmu_iounmap(kvm, base_gpa, size);254239255240out:256241 mmap_read_unlock(current->mm);
···11541154#define IPTE_NODAT 0x40011551155#define IPTE_GUEST_ASCE 0x8001156115611571157-static __always_inline void __ptep_rdp(unsigned long addr, pte_t *ptep,11581158- unsigned long opt, unsigned long asce,11591159- int local)11571157+static __always_inline void __ptep_rdp(unsigned long addr, pte_t *ptep, int local)11601158{11611159 unsigned long pto;1162116011631161 pto = __pa(ptep) & ~(PTRS_PER_PTE * sizeof(pte_t) - 1);11641164- asm volatile(".insn rrf,0xb98b0000,%[r1],%[r2],%[asce],%[m4]"11621162+ asm volatile(".insn rrf,0xb98b0000,%[r1],%[r2],%%r0,%[m4]"11651163 : "+m" (*ptep)11661166- : [r1] "a" (pto), [r2] "a" ((addr & PAGE_MASK) | opt),11671167- [asce] "a" (asce), [m4] "i" (local));11641164+ : [r1] "a" (pto), [r2] "a" (addr & PAGE_MASK),11651165+ [m4] "i" (local));11681166}1169116711701168static __always_inline void __ptep_ipte(unsigned long address, pte_t *ptep,···13461348 * A local RDP can be used to do the flush.13471349 */13481350 if (cpu_has_rdp() && !(pte_val(*ptep) & _PAGE_PROTECT))13491349- __ptep_rdp(address, ptep, 0, 0, 1);13511351+ __ptep_rdp(address, ptep, 1);13501352}13511353#define flush_tlb_fix_spurious_fault flush_tlb_fix_spurious_fault13521354
+2-2
arch/s390/mm/pgtable.c
···274274 preempt_disable();275275 atomic_inc(&mm->context.flush_count);276276 if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id())))277277- __ptep_rdp(addr, ptep, 0, 0, 1);277277+ __ptep_rdp(addr, ptep, 1);278278 else279279- __ptep_rdp(addr, ptep, 0, 0, 0);279279+ __ptep_rdp(addr, ptep, 0);280280 /*281281 * PTE is not invalidated by RDP, only _PAGE_PROTECT is cleared. That282282 * means it is still valid and active, and must not be changed according
···5656 return &arch_ftrace_regs(fregs)->regs;5757}58585959+#define arch_ftrace_partial_regs(regs) do { \6060+ regs->flags &= ~X86_EFLAGS_FIXED; \6161+ regs->cs = __KERNEL_CS; \6262+} while (0)6363+5964#define arch_ftrace_fill_perf_regs(fregs, _regs) do { \6065 (_regs)->ip = arch_ftrace_regs(fregs)->regs.ip; \6166 (_regs)->sp = arch_ftrace_regs(fregs)->regs.sp; \
+4
arch/x86/include/asm/runtime-const.h
···22#ifndef _ASM_RUNTIME_CONST_H33#define _ASM_RUNTIME_CONST_H4455+#ifdef MODULE66+ #error "Cannot use runtime-const infrastructure from modules"77+#endif88+59#ifdef __ASSEMBLY__610711.macro RUNTIME_CONST_PTR sym reg
+5-5
arch/x86/include/asm/uaccess_64.h
···1212#include <asm/cpufeatures.h>1313#include <asm/page.h>1414#include <asm/percpu.h>1515-#include <asm/runtime-const.h>16151717-/*1818- * Virtual variable: there's no actual backing store for this,1919- * it can purely be used as 'runtime_const_ptr(USER_PTR_MAX)'2020- */1616+#ifdef MODULE1717+ #define runtime_const_ptr(sym) (sym)1818+#else1919+ #include <asm/runtime-const.h>2020+#endif2121extern unsigned long USER_PTR_MAX;22222323#ifdef CONFIG_ADDRESS_MASKING
···7878DEFINE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);7979EXPORT_PER_CPU_SYMBOL(cpu_info);80808181+/* Used for modules: built-in code uses runtime constants */8282+unsigned long USER_PTR_MAX;8383+EXPORT_SYMBOL(USER_PTR_MAX);8484+8185u32 elf_hwcap2 __read_mostly;82868387/* Number of siblings per CPU package */···25832579 alternative_instructions();2584258025852581 if (IS_ENABLED(CONFIG_X86_64)) {25862586- unsigned long USER_PTR_MAX = TASK_SIZE_MAX;25822582+ USER_PTR_MAX = TASK_SIZE_MAX;2587258325882584 /*25892585 * Enable this when LAM is gated on LASS support
+3
arch/x86/kernel/cpu/microcode/amd.c
···220220 case 0xaa001: return cur_rev <= 0xaa00116; break;221221 case 0xaa002: return cur_rev <= 0xaa00218; break;222222 case 0xb0021: return cur_rev <= 0xb002146; break;223223+ case 0xb0081: return cur_rev <= 0xb008111; break;223224 case 0xb1010: return cur_rev <= 0xb101046; break;224225 case 0xb2040: return cur_rev <= 0xb204031; break;225226 case 0xb4040: return cur_rev <= 0xb404031; break;227227+ case 0xb4041: return cur_rev <= 0xb404101; break;226228 case 0xb6000: return cur_rev <= 0xb600031; break;229229+ case 0xb6080: return cur_rev <= 0xb608031; break;227230 case 0xb7000: return cur_rev <= 0xb700031; break;228231 default: break;229232 }
+7-1
arch/x86/kernel/ftrace_64.S
···354354 UNWIND_HINT_UNDEFINED355355 ANNOTATE_NOENDBR356356357357+ /* Restore return_to_handler value that got eaten by previous ret instruction. */358358+ subq $8, %rsp359359+ UNWIND_HINT_FUNC360360+357361 /* Save ftrace_regs for function exit context */358362 subq $(FRAME_SIZE), %rsp359363360364 movq %rax, RAX(%rsp)361365 movq %rdx, RDX(%rsp)362366 movq %rbp, RBP(%rsp)367367+ movq %rsp, RSP(%rsp)363368 movq %rsp, %rdi364369365370 call ftrace_return_to_handler···373368 movq RDX(%rsp), %rdx374369 movq RAX(%rsp), %rax375370376376- addq $(FRAME_SIZE), %rsp371371+ addq $(FRAME_SIZE) + 8, %rsp372372+377373 /*378374 * Jump back to the old return address. This cannot be JMP_NOSPEC rdi379375 * since IBT would demand that contain ENDBR, which simply isn't so for
+15-9
arch/x86/kvm/svm/avic.c
···216216 * This function is called from IOMMU driver to notify217217 * SVM to schedule in a particular vCPU of a particular VM.218218 */219219-int avic_ga_log_notifier(u32 ga_tag)219219+static int avic_ga_log_notifier(u32 ga_tag)220220{221221 unsigned long flags;222222 struct kvm_svm *kvm_svm;···788788 struct kvm_vcpu *vcpu = &svm->vcpu;789789790790 INIT_LIST_HEAD(&svm->ir_list);791791- spin_lock_init(&svm->ir_list_lock);791791+ raw_spin_lock_init(&svm->ir_list_lock);792792793793 if (!enable_apicv || !irqchip_in_kernel(vcpu->kvm))794794 return 0;···816816 if (!vcpu)817817 return;818818819819- spin_lock_irqsave(&to_svm(vcpu)->ir_list_lock, flags);819819+ raw_spin_lock_irqsave(&to_svm(vcpu)->ir_list_lock, flags);820820 list_del(&irqfd->vcpu_list);821821- spin_unlock_irqrestore(&to_svm(vcpu)->ir_list_lock, flags);821821+ raw_spin_unlock_irqrestore(&to_svm(vcpu)->ir_list_lock, flags);822822}823823824824int avic_pi_update_irte(struct kvm_kernel_irqfd *irqfd, struct kvm *kvm,···855855 * list of IRQs being posted to the vCPU, to ensure the IRTE856856 * isn't programmed with stale pCPU/IsRunning information.857857 */858858- guard(spinlock_irqsave)(&svm->ir_list_lock);858858+ guard(raw_spinlock_irqsave)(&svm->ir_list_lock);859859860860 /*861861 * Update the target pCPU for IOMMU doorbells if the vCPU is···972972 * up-to-date entry information, or that this task will wait until973973 * svm_ir_list_add() completes to set the new target pCPU.974974 */975975- spin_lock_irqsave(&svm->ir_list_lock, flags);975975+ raw_spin_lock_irqsave(&svm->ir_list_lock, flags);976976977977 entry = svm->avic_physical_id_entry;978978 WARN_ON_ONCE(entry & AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK);···997997998998 avic_update_iommu_vcpu_affinity(vcpu, h_physical_id, action);99999910001000- spin_unlock_irqrestore(&svm->ir_list_lock, flags);10001000+ raw_spin_unlock_irqrestore(&svm->ir_list_lock, flags);10011001}1002100210031003void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu)···10351035 * or that this task will wait until svm_ir_list_add() completes to10361036 * mark the vCPU as not running.10371037 */10381038- spin_lock_irqsave(&svm->ir_list_lock, flags);10381038+ raw_spin_lock_irqsave(&svm->ir_list_lock, flags);1039103910401040 avic_update_iommu_vcpu_affinity(vcpu, -1, action);10411041···1059105910601060 svm->avic_physical_id_entry = entry;1061106110621062- spin_unlock_irqrestore(&svm->ir_list_lock, flags);10621062+ raw_spin_unlock_irqrestore(&svm->ir_list_lock, flags);10631063}1064106410651065void avic_vcpu_put(struct kvm_vcpu *vcpu)···12421242 amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier);1243124312441244 return true;12451245+}12461246+12471247+void avic_hardware_unsetup(void)12481248+{12491249+ if (avic)12501250+ amd_iommu_register_ga_log_notifier(NULL);12451251}
···67286728 case EXIT_REASON_NOTIFY:67296729 /* Notify VM exit is not exposed to L1 */67306730 return false;67316731+ case EXIT_REASON_SEAMCALL:67326732+ case EXIT_REASON_TDCALL:67336733+ /*67346734+ * SEAMCALL and TDCALL unconditionally VM-Exit, but aren't67356735+ * virtualized by KVM for L1 hypervisors, i.e. L1 should67366736+ * never want or expect such an exit.67376737+ */67386738+ return false;67316739 default:67326740 return true;67336741 }
···3874387438753875/*38763876 * Returns true if the MSR in question is managed via XSTATE, i.e. is context38773877- * switched with the rest of guest FPU state. Note! S_CET is _not_ context38783878- * switched via XSTATE even though it _is_ saved/restored via XSAVES/XRSTORS.38793879- * Because S_CET is loaded on VM-Enter and VM-Exit via dedicated VMCS fields,38803880- * the value saved/restored via XSTATE is always the host's value. That detail38813881- * is _extremely_ important, as the guest's S_CET must _never_ be resident in38823882- * hardware while executing in the host. Loading guest values for U_CET and38833883- * PL[0-3]_SSP while executing in the kernel is safe, as U_CET is specific to38843884- * userspace, and PL[0-3]_SSP are only consumed when transitioning to lower38853885- * privilege levels, i.e. are effectively only consumed by userspace as well.38773877+ * switched with the rest of guest FPU state.38783878+ *38793879+ * Note, S_CET is _not_ saved/restored via XSAVES/XRSTORS.38863880 */38873881static bool is_xstate_managed_msr(struct kvm_vcpu *vcpu, u32 msr)38883882{···38993905 * MSR that is managed via XSTATE. Note, the caller is responsible for doing39003906 * the initial FPU load, this helper only ensures that guest state is resident39013907 * in hardware (the kernel can load its FPU state in IRQ context).39083908+ *39093909+ * Note, loading guest values for U_CET and PL[0-3]_SSP while executing in the39103910+ * kernel is safe, as U_CET is specific to userspace, and PL[0-3]_SSP are only39113911+ * consumed when transitioning to lower privilege levels, i.e. are effectively39123912+ * only consumed by userspace as well.39023913 */39033914static __always_inline void kvm_access_xstate_msr(struct kvm_vcpu *vcpu,39043915 struct msr_data *msr_info,···1180611807/* Swap (qemu) user FPU context for the guest FPU context. */1180711808static void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)1180811809{1181011810+ if (KVM_BUG_ON(vcpu->arch.guest_fpu.fpstate->in_use, vcpu->kvm))1181111811+ return;1181211812+1180911813 /* Exclude PKRU, it's restored separately immediately after VM-Exit. */1181011814 fpu_swap_kvm_fpstate(&vcpu->arch.guest_fpu, true);1181111815 trace_kvm_fpu(1);···1181711815/* When vcpu_run ends, restore user space FPU context. */1181811816static void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)1181911817{1181811818+ if (KVM_BUG_ON(!vcpu->arch.guest_fpu.fpstate->in_use, vcpu->kvm))1181911819+ return;1182011820+1182011821 fpu_swap_kvm_fpstate(&vcpu->arch.guest_fpu, false);1182111822 ++vcpu->stat.fpu_reload;1182211823 trace_kvm_fpu(0);···1214212137 int r;12143121381214412139 vcpu_load(vcpu);1214512145- if (kvm_mpx_supported())1214612146- kvm_load_guest_fpu(vcpu);1214712147-1214812140 kvm_vcpu_srcu_read_lock(vcpu);12149121411215012142 r = kvm_apic_accept_events(vcpu);···12158121561215912157out:1216012158 kvm_vcpu_srcu_read_unlock(vcpu);1216112161-1216212162- if (kvm_mpx_supported())1216312163- kvm_put_guest_fpu(vcpu);1216412159 vcpu_put(vcpu);1216512160 return r;1216612161}···1278712788{1278812789 struct fpstate *fpstate = vcpu->arch.guest_fpu.fpstate;1278912790 u64 xfeatures_mask;1279112791+ bool fpu_in_use;1279012792 int i;12791127931279212794 /*···1281112811 BUILD_BUG_ON(sizeof(xfeatures_mask) * BITS_PER_BYTE <= XFEATURE_MAX);12812128121281312813 /*1281412814- * All paths that lead to INIT are required to load the guest's FPU1281512815- * state (because most paths are buried in KVM_RUN).1281412814+ * Unload guest FPU state (if necessary) before zeroing XSTATE fields1281512815+ * as the kernel can only modify the state when its resident in memory,1281612816+ * i.e. when it's not loaded into hardware.1281712817+ *1281812818+ * WARN if the vCPU's desire to run, i.e. whether or not its in KVM_RUN,1281912819+ * doesn't match the loaded/in-use state of the FPU, as KVM_RUN is the1282012820+ * only path that can trigger INIT emulation _and_ loads FPU state, and1282112821+ * KVM_RUN should _always_ load FPU state.1281612822 */1281712817- kvm_put_guest_fpu(vcpu);1282312823+ WARN_ON_ONCE(vcpu->wants_to_run != fpstate->in_use);1282412824+ fpu_in_use = fpstate->in_use;1282512825+ if (fpu_in_use)1282612826+ kvm_put_guest_fpu(vcpu);1281812827 for_each_set_bit(i, (unsigned long *)&xfeatures_mask, XFEATURE_MAX)1281912828 fpstate_clear_xstate_component(fpstate, i);1282012820- kvm_load_guest_fpu(vcpu);1282912829+ if (fpu_in_use)1283012830+ kvm_load_guest_fpu(vcpu);1282112831}12822128321282312833void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
+37-14
drivers/acpi/acpi_mrrm.c
···152152153153static __init int add_boot_memory_ranges(void)154154{155155- struct kobject *pkobj, *kobj;155155+ struct kobject *pkobj, *kobj, **kobjs;156156 int ret = -EINVAL;157157- char *name;157157+ char name[16];158158+ int i;158159159160 pkobj = kobject_create_and_add("memory_ranges", acpi_kobj);161161+ if (!pkobj)162162+ return -ENOMEM;160163161161- for (int i = 0; i < mrrm_mem_entry_num; i++) {162162- name = kasprintf(GFP_KERNEL, "range%d", i);163163- if (!name) {164164- ret = -ENOMEM;165165- break;166166- }167167-168168- kobj = kobject_create_and_add(name, pkobj);169169-170170- ret = sysfs_create_groups(kobj, memory_range_groups);171171- if (ret)172172- return ret;164164+ kobjs = kcalloc(mrrm_mem_entry_num, sizeof(*kobjs), GFP_KERNEL);165165+ if (!kobjs) {166166+ kobject_put(pkobj);167167+ return -ENOMEM;173168 }174169170170+ for (i = 0; i < mrrm_mem_entry_num; i++) {171171+ scnprintf(name, sizeof(name), "range%d", i);172172+ kobj = kobject_create_and_add(name, pkobj);173173+ if (!kobj) {174174+ ret = -ENOMEM;175175+ goto cleanup;176176+ }177177+178178+ ret = sysfs_create_groups(kobj, memory_range_groups);179179+ if (ret) {180180+ kobject_put(kobj);181181+ goto cleanup;182182+ }183183+ kobjs[i] = kobj;184184+ }185185+186186+ kfree(kobjs);187187+ return 0;188188+189189+cleanup:190190+ for (int j = 0; j < i; j++) {191191+ if (kobjs[j]) {192192+ sysfs_remove_groups(kobjs[j], memory_range_groups);193193+ kobject_put(kobjs[j]);194194+ }195195+ }196196+ kfree(kobjs);197197+ kobject_put(pkobj);175198 return ret;176199}177200
+4-4
drivers/acpi/cppc_acpi.c
···460460 if (acpi_disabled)461461 return false;462462463463- for_each_present_cpu(cpu) {463463+ for_each_online_cpu(cpu) {464464 cpc_ptr = per_cpu(cpc_desc_ptr, cpu);465465 if (!cpc_ptr)466466 return false;···476476 struct cpc_desc *cpc_ptr;477477 int cpu;478478479479- for_each_present_cpu(cpu) {479479+ for_each_online_cpu(cpu) {480480 cpc_ptr = per_cpu(cpc_desc_ptr, cpu);481481 desired_reg = &cpc_ptr->cpc_regs[DESIRED_PERF];482482 if (!CPC_IN_SYSTEM_MEMORY(desired_reg) &&···750750 }751751752752 /*753753- * Disregard _CPC if the number of entries in the return pachage is not753753+ * Disregard _CPC if the number of entries in the return package is not754754 * as expected, but support future revisions being proper supersets of755755 * the v3 and only causing more entries to be returned by _CPC.756756 */···14351435{14361436 int cpu;1437143714381438- for_each_present_cpu(cpu) {14381438+ for_each_online_cpu(cpu) {14391439 struct cpc_register_resource *ref_perf_reg;14401440 struct cpc_desc *cpc_desc;14411441
+25-21
drivers/acpi/numa/hmat.c
···874874 }875875}876876877877-static void hmat_register_target(struct memory_target *target)877877+static void hmat_hotplug_target(struct memory_target *target)878878{879879 int nid = pxm_to_node(target->memory_pxm);880880881881+ /*882882+ * Skip offline nodes. This can happen when memory marked EFI_MEMORY_SP,883883+ * "specific purpose", is applied to all the memory in a proximity884884+ * domain leading to * the node being marked offline / unplugged, or if885885+ * memory-only "hotplug" node is offline.886886+ */887887+ if (nid == NUMA_NO_NODE || !node_online(nid))888888+ return;889889+890890+ guard(mutex)(&target_lock);891891+ if (target->registered)892892+ return;893893+894894+ hmat_register_target_initiators(target);895895+ hmat_register_target_cache(target);896896+ hmat_register_target_perf(target, ACCESS_COORDINATE_LOCAL);897897+ hmat_register_target_perf(target, ACCESS_COORDINATE_CPU);898898+ target->registered = true;899899+}900900+901901+static void hmat_register_target(struct memory_target *target)902902+{881903 /*882904 * Devices may belong to either an offline or online883905 * node, so unconditionally add them.···917895 }918896 mutex_unlock(&target_lock);919897920920- /*921921- * Skip offline nodes. This can happen when memory922922- * marked EFI_MEMORY_SP, "specific purpose", is applied923923- * to all the memory in a proximity domain leading to924924- * the node being marked offline / unplugged, or if925925- * memory-only "hotplug" node is offline.926926- */927927- if (nid == NUMA_NO_NODE || !node_online(nid))928928- return;929929-930930- mutex_lock(&target_lock);931931- if (!target->registered) {932932- hmat_register_target_initiators(target);933933- hmat_register_target_cache(target);934934- hmat_register_target_perf(target, ACCESS_COORDINATE_LOCAL);935935- hmat_register_target_perf(target, ACCESS_COORDINATE_CPU);936936- target->registered = true;937937- }938938- mutex_unlock(&target_lock);898898+ hmat_hotplug_target(target);939899}940900941901static void hmat_register_targets(void)···943939 if (!target)944940 return NOTIFY_OK;945941946946- hmat_register_target(target);942942+ hmat_hotplug_target(target);947943 return NOTIFY_OK;948944}949945
+1-1
drivers/acpi/numa/srat.c
···237237 struct acpi_srat_generic_affinity *p =238238 (struct acpi_srat_generic_affinity *)header;239239240240- if (p->device_handle_type == 0) {240240+ if (p->device_handle_type == 1) {241241 /*242242 * For pci devices this may be the only place they243243 * are assigned a proximity domain
+1-1
drivers/acpi/sbs.c
···487487 if (result)488488 return result;489489490490- battery->present = state & (1 << battery->id);490490+ battery->present = !!(state & (1 << battery->id));491491 if (!battery->present)492492 return 0;493493
···11841184 if (ret)11851185 return ret;1186118611871187- /* Verify OCRAM has been initialized */11871187+ /*11881188+ * Verify that OCRAM has been initialized.11891189+ * During a warm reset, OCRAM contents are retained, but the control11901190+ * and status registers are reset to their default values. Therefore,11911191+ * ECC must be explicitly re-enabled in the control register.11921192+ * Error condition: if INITCOMPLETEA is clear and ECC_EN is already set.11931193+ */11881194 if (!ecc_test_bits(ALTR_A10_ECC_INITCOMPLETEA,11891189- (base + ALTR_A10_ECC_INITSTAT_OFST)))11901190- return -ENODEV;11951195+ (base + ALTR_A10_ECC_INITSTAT_OFST))) {11961196+ if (!ecc_test_bits(ALTR_A10_ECC_EN,11971197+ (base + ALTR_A10_ECC_CTRL_OFST)))11981198+ ecc_set_bits(ALTR_A10_ECC_EN,11991199+ (base + ALTR_A10_ECC_CTRL_OFST));12001200+ else12011201+ return -ENODEV;12021202+ }1191120311921204 /* Enable IRQ on Single Bit Error */11931205 writel(ALTR_A10_ECC_SERRINTEN, (base + ALTR_A10_ECC_ERRINTENS_OFST));···13691357 .ue_set_mask = ALTR_A10_ECC_TDERRA,13701358 .set_err_ofst = ALTR_A10_ECC_INTTEST_OFST,13711359 .ecc_irq_handler = altr_edac_a10_ecc_irq,13721372- .inject_fops = &altr_edac_a10_device_inject2_fops,13601360+ .inject_fops = &altr_edac_a10_device_inject_fops,13731361};1374136213751363#endif /* CONFIG_EDAC_ALTERA_ETHERNET */···14591447 .ue_set_mask = ALTR_A10_ECC_TDERRA,14601448 .set_err_ofst = ALTR_A10_ECC_INTTEST_OFST,14611449 .ecc_irq_handler = altr_edac_a10_ecc_irq,14621462- .inject_fops = &altr_edac_a10_device_inject2_fops,14501450+ .inject_fops = &altr_edac_a10_device_inject_fops,14631451};1464145214651453#endif /* CONFIG_EDAC_ALTERA_USB */
+14-12
drivers/edac/versalnet_edac.c
···433433 phys_addr_t pfn;434434 int err;435435436436- if (WARN_ON_ONCE(ctl_num > NUM_CONTROLLERS))436436+ if (WARN_ON_ONCE(ctl_num >= NUM_CONTROLLERS))437437 return;438438439439 mci = priv->mci[ctl_num];···605605 length = result[MSG_ERR_LENGTH];606606 offset = result[MSG_ERR_OFFSET];607607608608+ /*609609+ * The data can come in two stretches. Construct the regs from two610610+ * messages. The offset indicates the offset from which the data is to611611+ * be taken.612612+ */613613+ for (i = 0 ; i < length; i++) {614614+ k = offset + i;615615+ j = ERROR_DATA + i;616616+ mc_priv->regs[k] = result[j];617617+ }618618+608619 if (result[TOTAL_ERR_LENGTH] > length) {609620 if (!mc_priv->part_len)610621 mc_priv->part_len = length;611622 else612623 mc_priv->part_len += length;613613- /*614614- * The data can come in 2 stretches. Construct the regs from 2615615- * messages the offset indicates the offset from which the data is to616616- * be taken617617- */618618- for (i = 0 ; i < length; i++) {619619- k = offset + i;620620- j = ERROR_DATA + i;621621- mc_priv->regs[k] = result[j];622622- }624624+623625 if (mc_priv->part_len < result[TOTAL_ERR_LENGTH])624626 return 0;625627 mc_priv->part_len = 0;···707705 /* Convert to bytes */708706 length = result[TOTAL_ERR_LENGTH] * 4;709707 log_non_standard_event(sec_type, &amd_versalnet_guid, mc_priv->message,710710- sec_sev, (void *)&result[ERROR_DATA], length);708708+ sec_sev, (void *)&mc_priv->regs, length);711709712710 return 0;713711}
···1267126712681268 (void)amdgpu_vm_bo_unmap(adev, bo_va, entry->va);1269126912701270+ /* VM entity stopped if process killed, don't clear freed pt bo */12711271+ if (!amdgpu_vm_ready(vm))12721272+ return 0;12731273+12701274 (void)amdgpu_vm_clear_freed(adev, vm, &bo_va->last_pt_update);1271127512721276 (void)amdgpu_sync_fence(sync, bo_va->last_pt_update, GFP_KERNEL);
+1-1
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
···236236 r = amdgpu_xcp_select_scheds(adev, hw_ip, hw_prio, fpriv,237237 &num_scheds, &scheds);238238 if (r)239239- goto cleanup_entity;239239+ goto error_free_entity;240240 }241241242242 /* disable load balance if the hw engine retains context among dependent jobs */
···8282 struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);8383 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);84848585+ /*8686+ * Disable peer-to-peer access for DCC-enabled VRAM surfaces on GFX12+.8787+ * Such buffers cannot be safely accessed over P2P due to device-local8888+ * compression metadata. Fallback to system-memory path instead.8989+ * Device supports GFX12 (GC 12.x or newer)9090+ * BO was created with the AMDGPU_GEM_CREATE_GFX12_DCC flag9191+ *9292+ */9393+ if (amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(12, 0, 0) &&9494+ bo->flags & AMDGPU_GEM_CREATE_GFX12_DCC)9595+ attach->peer2peer = false;9696+8597 if (!amdgpu_dmabuf_is_xgmi_accessible(attach_adev, bo) &&8698 pci_p2pdma_distance(adev->pdev, attach->dev, false) < 0)8799 attach->peer2peer = false;
+7-2
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
···26322632{26332633 struct drm_device *drm_dev = dev_get_drvdata(dev);26342634 struct amdgpu_device *adev = drm_to_adev(drm_dev);26352635+ int r;2635263626362636- if (amdgpu_acpi_should_gpu_reset(adev))26372637- return amdgpu_asic_reset(adev);26372637+ if (amdgpu_acpi_should_gpu_reset(adev)) {26382638+ amdgpu_device_lock_reset_domain(adev->reset_domain);26392639+ r = amdgpu_asic_reset(adev);26402640+ amdgpu_device_unlock_reset_domain(adev->reset_domain);26412641+ return r;26422642+ }2638264326392644 return 0;26402645}
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c
···280280 if (ret)281281 return ret;282282283283+ /* Ensure *bo is NULL so a new BO will be created */284284+ *bo = NULL;283285 ret = amdgpu_bo_create_kernel(adev,284286 size,285287 ISP_MC_ADDR_ALIGN,
···22922292 r = amdgpu_xcp_init(adev->xcp_mgr, num_xcp, mode);2293229322942294 } else {22952295- if (amdgpu_xcp_query_partition_mode(adev->xcp_mgr,22952295+ if (adev->in_suspend)22962296+ amdgpu_xcp_restore_partition_mode(adev->xcp_mgr);22972297+ else if (amdgpu_xcp_query_partition_mode(adev->xcp_mgr,22962298 AMDGPU_XCP_FL_NONE) ==22972299 AMDGPU_UNKNOWN_COMPUTE_PARTITION_MODE)22982300 r = amdgpu_xcp_switch_partition_mode(
···142142 return err;143143}144144145145+static int psp_v11_wait_for_tos_unload(struct psp_context *psp)146146+{147147+ struct amdgpu_device *adev = psp->adev;148148+ uint32_t sol_reg1, sol_reg2;149149+ int retry_loop;150150+151151+ /* Wait for the TOS to be unloaded */152152+ for (retry_loop = 0; retry_loop < 20; retry_loop++) {153153+ sol_reg1 = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);154154+ usleep_range(1000, 2000);155155+ sol_reg2 = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);156156+ if (sol_reg1 == sol_reg2)157157+ return 0;158158+ }159159+ dev_err(adev->dev, "TOS unload failed, C2PMSG_33: %x C2PMSG_81: %x",160160+ RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_33),161161+ RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81));162162+163163+ return -ETIME;164164+}165165+145166static int psp_v11_0_wait_for_bootloader(struct psp_context *psp)146167{147168 struct amdgpu_device *adev = psp->adev;148148-149169 int ret;150170 int retry_loop;171171+172172+ /* For a reset done at the end of S3, only wait for TOS to be unloaded */173173+ if (adev->in_s3 && !(adev->flags & AMD_IS_APU) && amdgpu_in_reset(adev))174174+ return psp_v11_wait_for_tos_unload(psp);151175152176 for (retry_loop = 0; retry_loop < 20; retry_loop++) {153177 /* Wait for bootloader to signify that is
···12601260 update_v_total_for_static_ramp(12611261 core_freesync, stream, in_out_vrr);12621262 }12631263+12641264+ /*12651265+ * If VRR is inactive, set vtotal min and max to nominal vtotal12661266+ */12671267+ if (in_out_vrr->state == VRR_STATE_INACTIVE) {12681268+ in_out_vrr->adjust.v_total_min =12691269+ mod_freesync_calc_v_total_from_refresh(stream,12701270+ in_out_vrr->max_refresh_in_uhz);12711271+ in_out_vrr->adjust.v_total_max = in_out_vrr->adjust.v_total_min;12721272+ return;12731273+ }12631274}1264127512651276unsigned long long mod_freesync_calc_nominal_field_rate(
···20402040 smu->is_apu && (amdgpu_in_reset(adev) || adev->in_s0ix))20412041 return 0;2042204220432043+ /* vangogh s0ix */20442044+ if ((amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(11, 5, 0) ||20452045+ amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(11, 5, 2)) &&20462046+ adev->in_s0ix)20472047+ return 0;20482048+20432049 /*20442050 * For gpu reset, runpm and hibernation through BACO,20452051 * BACO feature has to be kept enabled.
+3
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
···22172217 uint32_t total_cu = adev->gfx.config.max_cu_per_sh *22182218 adev->gfx.config.max_sh_per_se * adev->gfx.config.max_shader_engines;2219221922202220+ if (adev->in_s0ix)22212221+ return 0;22222222+22202223 /* allow message will be sent after enable message on Vangogh*/22212224 if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFXCLK_BIT) &&22222225 (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
+2-2
drivers/gpu/drm/clients/drm_client_setup.c
···1313static char drm_client_default[16] = CONFIG_DRM_CLIENT_DEFAULT;1414module_param_string(active, drm_client_default, sizeof(drm_client_default), 0444);1515MODULE_PARM_DESC(active,1616- "Choose which drm client to start, default is"1717- CONFIG_DRM_CLIENT_DEFAULT "]");1616+ "Choose which drm client to start, default is "1717+ CONFIG_DRM_CLIENT_DEFAULT);18181919/**2020 * drm_client_setup() - Setup in-kernel DRM clients
+1-1
drivers/gpu/drm/i915/Makefile
···413413#414414# Enable locally for CONFIG_DRM_I915_WERROR=y. See also scripts/Makefile.build415415ifdef CONFIG_DRM_I915_WERROR416416- cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none -Werror $<416416+ cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none -Werror $<417417endif418418419419# header test
···15951595err_vma_res:15961596 i915_vma_resource_free(vma_res);15971597err_fence:15981598- if (work)15991599- dma_fence_work_commit_imm(&work->base);15981598+ if (work) {15991599+ /*16001600+ * When pinning VMA to GGTT on CHV or BXT with VTD enabled,16011601+ * commit VMA binding asynchronously to avoid risk of lock16021602+ * inversion among reservation_ww locks held here and16031603+ * cpu_hotplug_lock acquired from stop_machine(), which we16041604+ * wrap around GGTT updates when running in those environments.16051605+ */16061606+ if (i915_vma_is_ggtt(vma) &&16071607+ intel_vm_no_concurrent_access_wa(vma->vm->i915))16081608+ dma_fence_work_commit(&work->base);16091609+ else16101610+ dma_fence_work_commit_imm(&work->base);16111611+ }16001612err_rpm:16011613 intel_runtime_pm_put(&vma->vm->i915->runtime_pm, wakeref);16021614
+1
drivers/gpu/drm/imagination/Kconfig
···77 depends on DRM88 depends on MMU99 depends on PM1010+ depends on POWER_SEQUENCING || !POWER_SEQUENCING1011 select DRM_EXEC1112 select DRM_GEM_SHMEM_HELPER1213 select DRM_SCHED
+7
drivers/gpu/drm/mediatek/mtk_crtc.c
···283283 unsigned int i;284284 unsigned long flags;285285286286+ /* release GCE HW usage and start autosuspend */287287+ pm_runtime_mark_last_busy(cmdq_cl->chan->mbox->dev);288288+ pm_runtime_put_autosuspend(cmdq_cl->chan->mbox->dev);289289+286290 if (data->sta < 0)287291 return;288292···621617 spin_lock_irqsave(&mtk_crtc->config_lock, flags);622618 mtk_crtc->config_updating = false;623619 spin_unlock_irqrestore(&mtk_crtc->config_lock, flags);620620+621621+ if (pm_runtime_resume_and_get(mtk_crtc->cmdq_client.chan->mbox->dev) < 0)622622+ goto update_config_out;624623625624 mbox_send_message(mtk_crtc->cmdq_client.chan, cmdq_handle);626625 mbox_client_txdone(mtk_crtc->cmdq_client.chan, 0);
+1-23
drivers/gpu/drm/mediatek/mtk_plane.c
···21212222static const u64 modifiers[] = {2323 DRM_FORMAT_MOD_LINEAR,2424- DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 |2525- AFBC_FORMAT_MOD_SPLIT |2626- AFBC_FORMAT_MOD_SPARSE),2724 DRM_FORMAT_MOD_INVALID,2825};2926···6871 uint32_t format,6972 uint64_t modifier)7073{7171- if (modifier == DRM_FORMAT_MOD_LINEAR)7272- return true;7373-7474- if (modifier != DRM_FORMAT_MOD_ARM_AFBC(7575- AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 |7676- AFBC_FORMAT_MOD_SPLIT |7777- AFBC_FORMAT_MOD_SPARSE))7878- return false;7979-8080- if (format != DRM_FORMAT_XRGB8888 &&8181- format != DRM_FORMAT_ARGB8888 &&8282- format != DRM_FORMAT_BGRX8888 &&8383- format != DRM_FORMAT_BGRA8888 &&8484- format != DRM_FORMAT_ABGR8888 &&8585- format != DRM_FORMAT_XBGR8888 &&8686- format != DRM_FORMAT_RGB888 &&8787- format != DRM_FORMAT_BGR888)8888- return false;8989-9090- return true;7474+ return modifier == DRM_FORMAT_MOD_LINEAR;9175}92769377static void mtk_plane_destroy_state(struct drm_plane *plane,
+3-1
drivers/gpu/drm/nouveau/dispnv50/disp.c
···28672867 }2868286828692869 /* Assign the correct format modifiers */28702870- if (disp->disp->object.oclass >= TU102_DISP)28702870+ if (disp->disp->object.oclass >= GB202_DISP)28712871+ nouveau_display(dev)->format_modifiers = wndwca7e_modifiers;28722872+ else if (disp->disp->object.oclass >= TU102_DISP)28712873 nouveau_display(dev)->format_modifiers = wndwc57e_modifiers;28722874 else28732875 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_FERMI)
···786786}787787788788/* This function assumes the format has already been validated against the plane789789- * and the modifier was validated against the device-wides modifier list at FB789789+ * and the modifier was validated against the device-wide modifier list at FB790790 * creation time.791791 */792792static bool nv50_plane_format_mod_supported(struct drm_plane *plane,793793 u32 format, u64 modifier)794794{795795 struct nouveau_drm *drm = nouveau_drm(plane->dev);796796+ const struct drm_format_info *info = drm_format_info(format);796797 uint8_t i;797798798799 /* All chipsets can display all formats in linear layout */···801800 return true;802801803802 if (drm->client.device.info.chipset < 0xc0) {804804- const struct drm_format_info *info = drm_format_info(format);805803 const uint8_t kind = (modifier >> 12) & 0xff;806804807805 if (!format) return false;808806809807 for (i = 0; i < info->num_planes; i++)810808 if ((info->cpp[i] != 4) && kind != 0x70) return false;809809+ } else if (drm->client.device.info.chipset >= 0x1b2) {810810+ const uint8_t slayout = ((modifier >> 22) & 0x1) |811811+ ((modifier >> 25) & 0x6);812812+813813+ if (!format)814814+ return false;815815+816816+ /*817817+ * Note in practice this implies only formats where cpp is equal818818+ * for each plane, or >= 4 for all planes, are supported.819819+ */820820+ for (i = 0; i < info->num_planes; i++) {821821+ if (((info->cpp[i] == 2) && slayout != 3) ||822822+ ((info->cpp[i] == 1) && slayout != 2) ||823823+ ((info->cpp[i] >= 4) && slayout != 1))824824+ return false;825825+826826+ /* 24-bit not supported. It has yet another layout */827827+ WARN_ON(info->cpp[i] == 3);828828+ }811829 }812830813831 return true;
···288288289289 panthor_gem_debugfs_set_usage_flags(bo, 0);290290291291+ /* If this is a write-combine mapping, we query the sgt to force a CPU292292+ * cache flush (dma_map_sgtable() is called when the sgt is created).293293+ * This ensures the zero-ing is visible to any uncached mapping created294294+ * by vmap/mmap.295295+ * FIXME: Ideally this should be done when pages are allocated, not at296296+ * BO creation time.297297+ */298298+ if (shmem->map_wc) {299299+ struct sg_table *sgt;300300+301301+ sgt = drm_gem_shmem_get_pages_sgt(shmem);302302+ if (IS_ERR(sgt)) {303303+ ret = PTR_ERR(sgt);304304+ goto out_put_gem;305305+ }306306+ }307307+291308 /*292309 * Allocate an id of idr table where the obj is registered293310 * and handle has the id what user can see.···313296 if (!ret)314297 *size = bo->base.base.size;315298299299+out_put_gem:316300 /* drop reference from allocate - handle holds it now. */317301 drm_gem_object_put(&shmem->base);318302
+19-15
drivers/gpu/drm/scheduler/sched_entity.c
···173173}174174EXPORT_SYMBOL(drm_sched_entity_error);175175176176+static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,177177+ struct dma_fence_cb *cb);178178+176179static void drm_sched_entity_kill_jobs_work(struct work_struct *wrk)177180{178181 struct drm_sched_job *job = container_of(wrk, typeof(*job), work);179179-180180- drm_sched_fence_scheduled(job->s_fence, NULL);181181- drm_sched_fence_finished(job->s_fence, -ESRCH);182182- WARN_ON(job->s_fence->parent);183183- job->sched->ops->free_job(job);184184-}185185-186186-/* Signal the scheduler finished fence when the entity in question is killed. */187187-static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,188188- struct dma_fence_cb *cb)189189-{190190- struct drm_sched_job *job = container_of(cb, struct drm_sched_job,191191- finish_cb);182182+ struct dma_fence *f;192183 unsigned long index;193193-194194- dma_fence_put(f);195184196185 /* Wait for all dependencies to avoid data corruptions */197186 xa_for_each(&job->dependencies, index, f) {···208219209220 dma_fence_put(f);210221 }222222+223223+ drm_sched_fence_scheduled(job->s_fence, NULL);224224+ drm_sched_fence_finished(job->s_fence, -ESRCH);225225+ WARN_ON(job->s_fence->parent);226226+ job->sched->ops->free_job(job);227227+}228228+229229+/* Signal the scheduler finished fence when the entity in question is killed. */230230+static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,231231+ struct dma_fence_cb *cb)232232+{233233+ struct drm_sched_job *job = container_of(cb, struct drm_sched_job,234234+ finish_cb);235235+236236+ dma_fence_put(f);211237212238 INIT_WORK(&job->work, drm_sched_entity_kill_jobs_work);213239 schedule_work(&job->work);
+1
drivers/gpu/drm/tiny/Kconfig
···8585config DRM_PIXPAPER8686 tristate "DRM support for PIXPAPER display panels"8787 depends on DRM && SPI8888+ depends on MMU8889 select DRM_CLIENT_SELECTION8990 select DRM_GEM_SHMEM_HELPER9091 select DRM_KMS_HELPER
+15-1
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
···100100 if (vmw->has_mob) {101101 if ((vmw->capabilities2 & SVGA_CAP2_CURSOR_MOB) != 0)102102 return VMW_CURSOR_UPDATE_MOB;103103+ else104104+ return VMW_CURSOR_UPDATE_GB_ONLY;103105 }104104-106106+ drm_warn_once(&vmw->drm, "Unknown Cursor Type!\n");105107 return VMW_CURSOR_UPDATE_NONE;106108}107109···141139{142140 switch (update_type) {143141 case VMW_CURSOR_UPDATE_LEGACY:142142+ case VMW_CURSOR_UPDATE_GB_ONLY:144143 case VMW_CURSOR_UPDATE_NONE:145144 return 0;146145 case VMW_CURSOR_UPDATE_MOB:···626623 if (!surface || vps->cursor.legacy.id == surface->snooper.id)627624 vps->cursor.update_type = VMW_CURSOR_UPDATE_NONE;628625 break;626626+ case VMW_CURSOR_UPDATE_GB_ONLY:629627 case VMW_CURSOR_UPDATE_MOB: {630628 bo = vmw_user_object_buffer(&vps->uo);631629 if (bo) {···741737vmw_cursor_plane_atomic_update(struct drm_plane *plane,742738 struct drm_atomic_state *state)743739{740740+ struct vmw_bo *bo;744741 struct drm_plane_state *new_state =745742 drm_atomic_get_new_plane_state(state, plane);746743 struct drm_plane_state *old_state =···766761 break;767762 case VMW_CURSOR_UPDATE_MOB:768763 vmw_cursor_update_mob(dev_priv, vps);764764+ break;765765+ case VMW_CURSOR_UPDATE_GB_ONLY:766766+ bo = vmw_user_object_buffer(&vps->uo);767767+ if (bo)768768+ vmw_send_define_cursor_cmd(dev_priv, bo->map.virtual,769769+ vps->base.crtc_w,770770+ vps->base.crtc_h,771771+ vps->base.hotspot_x,772772+ vps->base.hotspot_y);769773 break;770774 case VMW_CURSOR_UPDATE_NONE:771775 /* do nothing */
···366836683669366936703670 cmd_id = header->id;36713671+ if (header->size > SVGA_CMD_MAX_DATASIZE) {36723672+ VMW_DEBUG_USER("SVGA3D command: %d is too big.\n",36733673+ cmd_id + SVGA_3D_CMD_BASE);36743674+ return -E2BIG;36753675+ }36713676 *size = header->size + sizeof(SVGA3dCmdHeader);3672367736733678 cmd_id -= SVGA_3D_CMD_BASE;
+5-7
drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c
···32323333/**3434 * struct vmw_bo_dirty - Dirty information for buffer objects3535+ * @ref_count: Reference count for this structure. Must be first member!3536 * @start: First currently dirty bit3637 * @end: Last currently dirty bit + 13738 * @method: The currently used dirty method3839 * @change_count: Number of consecutive method change triggers3939- * @ref_count: Reference count for this structure4040 * @bitmap_size: The size of the bitmap in bits. Typically equal to the4141 * nuber of pages in the bo.4242 * @bitmap: A bitmap where each bit represents a page. A set bit means a4343 * dirty page.4444 */4545struct vmw_bo_dirty {4646+ struct kref ref_count;4647 unsigned long start;4748 unsigned long end;4849 enum vmw_bo_dirty_method method;4950 unsigned int change_count;5050- unsigned int ref_count;5151 unsigned long bitmap_size;5252 unsigned long bitmap[];5353};···221221 int ret;222222223223 if (dirty) {224224- dirty->ref_count++;224224+ kref_get(&dirty->ref_count);225225 return 0;226226 }227227···235235 dirty->bitmap_size = num_pages;236236 dirty->start = dirty->bitmap_size;237237 dirty->end = 0;238238- dirty->ref_count = 1;238238+ kref_init(&dirty->ref_count);239239 if (num_pages < PAGE_SIZE / sizeof(pte_t)) {240240 dirty->method = VMW_BO_DIRTY_PAGETABLE;241241 } else {···274274{275275 struct vmw_bo_dirty *dirty = vbo->dirty;276276277277- if (dirty && --dirty->ref_count == 0) {278278- kvfree(dirty);277277+ if (dirty && kref_put(&dirty->ref_count, (void *)kvfree))279278 vbo->dirty = NULL;280280- }281279}282280283281/**
···10101111#include <drm/drm_drv.h>1212#include <drm/drm_managed.h>1313+#include <drm/drm_syncobj.h>1314#include <uapi/drm/xe_drm.h>14151516#include <generated/xe_wa_oob.h>···13901389 return 0;13911390}1392139113931393-static int xe_oa_parse_syncs(struct xe_oa *oa, struct xe_oa_open_param *param)13921392+static int xe_oa_parse_syncs(struct xe_oa *oa,13931393+ struct xe_oa_stream *stream,13941394+ struct xe_oa_open_param *param)13941395{13951396 int ret, num_syncs, num_ufence = 0;13961397···1412140914131410 for (num_syncs = 0; num_syncs < param->num_syncs; num_syncs++) {14141411 ret = xe_sync_entry_parse(oa->xe, param->xef, ¶m->syncs[num_syncs],14151415- ¶m->syncs_user[num_syncs], 0);14121412+ ¶m->syncs_user[num_syncs],14131413+ stream->ufence_syncobj,14141414+ ++stream->ufence_timeline_value, 0);14161415 if (ret)14171416 goto err_syncs;14181417···15441539 return -ENODEV;1545154015461541 param.xef = stream->xef;15471547- err = xe_oa_parse_syncs(stream->oa, ¶m);15421542+ err = xe_oa_parse_syncs(stream->oa, stream, ¶m);15481543 if (err)15491544 goto err_config_put;15501545···16401635 if (stream->exec_q)16411636 xe_exec_queue_put(stream->exec_q);1642163716381638+ drm_syncobj_put(stream->ufence_syncobj);16431639 kfree(stream);16441640}16451641···18321826 struct xe_oa_open_param *param)18331827{18341828 struct xe_oa_stream *stream;18291829+ struct drm_syncobj *ufence_syncobj;18351830 int stream_fd;18361831 int ret;18371832···18431836 goto exit;18441837 }1845183818391839+ ret = drm_syncobj_create(&ufence_syncobj, DRM_SYNCOBJ_CREATE_SIGNALED,18401840+ NULL);18411841+ if (ret)18421842+ goto exit;18431843+18461844 stream = kzalloc(sizeof(*stream), GFP_KERNEL);18471845 if (!stream) {18481846 ret = -ENOMEM;18491849- goto exit;18471847+ goto err_syncobj;18501848 }18511851-18491849+ stream->ufence_syncobj = ufence_syncobj;18521850 stream->oa = oa;18531853- ret = xe_oa_stream_init(stream, param);18511851+18521852+ ret = xe_oa_parse_syncs(oa, stream, param);18541853 if (ret)18551854 goto err_free;18551855+18561856+ ret = xe_oa_stream_init(stream, param);18571857+ if (ret) {18581858+ while (param->num_syncs--)18591859+ xe_sync_entry_cleanup(¶m->syncs[param->num_syncs]);18601860+ kfree(param->syncs);18611861+ goto err_free;18621862+ }1856186318571864 if (!param->disabled) {18581865 ret = xe_oa_enable_locked(stream);···18911870 xe_oa_stream_destroy(stream);18921871err_free:18931872 kfree(stream);18731873+err_syncobj:18741874+ drm_syncobj_put(ufence_syncobj);18941875exit:18951876 return ret;18961877}···21062083 goto err_exec_q;21072084 }2108208521092109- ret = xe_oa_parse_syncs(oa, ¶m);21102110- if (ret)21112111- goto err_exec_q;21122112-21132086 mutex_lock(¶m.hwe->gt->oa.gt_lock);21142087 ret = xe_oa_stream_open_ioctl_locked(oa, ¶m);21152088 mutex_unlock(¶m.hwe->gt->oa.gt_lock);21162089 if (ret < 0)21172117- goto err_sync_cleanup;20902090+ goto err_exec_q;2118209121192092 return ret;2120209321212121-err_sync_cleanup:21222122- while (param.num_syncs--)21232123- xe_sync_entry_cleanup(¶m.syncs[param.num_syncs]);21242124- kfree(param.syncs);21252094err_exec_q:21262095 if (param.exec_q)21272096 xe_exec_queue_put(param.exec_q);
+8
drivers/gpu/drm/xe/xe_oa_types.h
···1515#include "regs/xe_reg_defs.h"1616#include "xe_hw_engine_types.h"17171818+struct drm_syncobj;1919+1820#define DEFAULT_XE_OA_BUFFER_SIZE SZ_16M19212022enum xe_oa_report_header {···249247250248 /** @xef: xe_file with which the stream was opened */251249 struct xe_file *xef;250250+251251+ /** @ufence_syncobj: User fence syncobj */252252+ struct drm_syncobj *ufence_syncobj;253253+254254+ /** @ufence_timeline_value: User fence timeline value */255255+ u64 ufence_timeline_value;252256253257 /** @last_fence: fence to use in stream destroy when needed */254258 struct dma_fence *last_fence;
···707707 struct iopt_area *area;708708 unsigned long unmapped_bytes = 0;709709 unsigned int tries = 0;710710- int rc = -ENOENT;710710+ /* If there are no mapped entries then success */711711+ int rc = 0;711712712713 /*713714 * The domains_rwsem must be held in read mode any time any area->pages···778777779778 down_write(&iopt->iova_rwsem);780779 }781781- if (unmapped_bytes)782782- rc = 0;783780784781out_unlock_iova:785782 up_write(&iopt->iova_rwsem);···814815815816int iopt_unmap_all(struct io_pagetable *iopt, unsigned long *unmapped)816817{817817- int rc;818818-819819- rc = iopt_unmap_iova_range(iopt, 0, ULONG_MAX, unmapped);820818 /* If the IOVAs are empty then unmap all succeeds */821821- if (rc == -ENOENT)822822- return 0;823823- return rc;819819+ return iopt_unmap_iova_range(iopt, 0, ULONG_MAX, unmapped);824820}825821826822/* The caller must always free all the nodes in the allowed_iova rb_root. */
···1247124712481248int ivtv_init_on_first_open(struct ivtv *itv)12491249{12501250- struct v4l2_frequency vf;12511250 /* Needed to call ioctls later */12521252- struct ivtv_open_id fh;12511251+ struct ivtv_stream *s = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG];12521252+ struct v4l2_frequency vf;12531253 int fw_retry_count = 3;12541254 int video_input;12551255-12561256- fh.itv = itv;12571257- fh.type = IVTV_ENC_STREAM_TYPE_MPG;1258125512591256 if (test_bit(IVTV_F_I_FAILED, &itv->i_flags))12601257 return -ENXIO;···1294129712951298 video_input = itv->active_input;12961299 itv->active_input++; /* Force update of input */12971297- ivtv_s_input(NULL, &fh, video_input);13001300+ ivtv_do_s_input(itv, video_input);1298130112991302 /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code13001303 in one place. */13011304 itv->std++; /* Force full standard initialization */13021305 itv->std_out = itv->std;13031303- ivtv_s_frequency(NULL, &fh, &vf);13061306+ ivtv_do_s_frequency(s, &vf);1304130713051308 if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) {13061309 /* Turn on the TV-out: ivtv_init_mpeg_decoder() initializes
···167167168168static struct uvc_streaming *uvc_stream_by_id(struct uvc_device *dev, int id)169169{170170- struct uvc_streaming *stream;170170+ struct uvc_streaming *stream, *last_stream;171171+ unsigned int count = 0;171172172173 list_for_each_entry(stream, &dev->streams, list) {174174+ count += 1;175175+ last_stream = stream;173176 if (stream->header.bTerminalLink == id)174177 return stream;178178+ }179179+180180+ /*181181+ * If the streaming entity is referenced by an invalid ID, notify the182182+ * user and use heuristics to guess the correct entity.183183+ */184184+ if (count == 1 && id == UVC_INVALID_ENTITY_ID) {185185+ dev_warn(&dev->intf->dev,186186+ "UVC non compliance: Invalid USB header. The streaming entity has an invalid ID, guessing the correct one.");187187+ return last_stream;175188 }176189177190 return NULL;
···371371 * frames should be flooded or not.372372 */373373 b53_read8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, &mgmt);374374- mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN | B53_IPMC_FWD_EN;374374+ mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN | B53_IP_MC;375375 b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt);376376 } else {377377 b53_read8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, &mgmt);378378- mgmt |= B53_IP_MCAST_25;378378+ mgmt |= B53_IP_MC;379379 b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt);380380 }381381}···13721372 else13731373 reg &= ~PORT_OVERRIDE_FULL_DUPLEX;1374137413751375+ reg &= ~(0x3 << GMII_PO_SPEED_S);13761376+ if (is5301x(dev) || is58xx(dev))13771377+ reg &= ~PORT_OVERRIDE_SPEED_2000M;13781378+13751379 switch (speed) {13761380 case 2000:13771381 reg |= PORT_OVERRIDE_SPEED_2000M;···13931389 dev_err(dev->dev, "unknown speed: %d\n", speed);13941390 return;13951391 }13921392+13931393+ if (is5325(dev))13941394+ reg &= ~PORT_OVERRIDE_LP_FLOW_25;13951395+ else13961396+ reg &= ~(PORT_OVERRIDE_RX_FLOW | PORT_OVERRIDE_TX_FLOW);1396139713971398 if (rx_pause) {13981399 if (is5325(dev))···16021593 struct b53_device *dev = dp->ds->priv;16031594 int port = dp->index;1604159516051605- if (mode == MLO_AN_PHY)15961596+ if (mode == MLO_AN_PHY) {15971597+ if (is63xx(dev) && in_range(port, B53_63XX_RGMII0, 4))15981598+ b53_force_link(dev, port, false);16061599 return;16001600+ }1607160116081602 if (mode == MLO_AN_FIXED) {16091603 b53_force_link(dev, port, false);···16341622 if (mode == MLO_AN_PHY) {16351623 /* Re-negotiate EEE if it was enabled already */16361624 p->eee_enabled = b53_eee_init(ds, port, phydev);16251625+16261626+ if (is63xx(dev) && in_range(port, B53_63XX_RGMII0, 4)) {16271627+ b53_force_port_config(dev, port, speed, duplex,16281628+ tx_pause, rx_pause);16291629+ b53_force_link(dev, port, true);16301630+ }16311631+16371632 return;16381633 }16391634···20372018 do {20382019 b53_read8(dev, B53_ARLIO_PAGE, offset, ®);20392020 if (!(reg & ARL_SRCH_STDN))20402040- return 0;20212021+ return -ENOENT;2041202220422023 if (reg & ARL_SRCH_VLID)20432024 return 0;···20872068int b53_fdb_dump(struct dsa_switch *ds, int port,20882069 dsa_fdb_dump_cb_t *cb, void *data)20892070{20712071+ unsigned int count = 0, results_per_hit = 1;20902072 struct b53_device *priv = ds->priv;20912073 struct b53_arl_entry results[2];20922092- unsigned int count = 0;20932074 u8 offset;20942075 int ret;20952076 u8 reg;20772077+20782078+ if (priv->num_arl_bins > 2)20792079+ results_per_hit = 2;2096208020972081 mutex_lock(&priv->arl_mutex);20982082···21182096 if (ret)21192097 break;2120209821212121- if (priv->num_arl_bins > 2) {20992099+ if (results_per_hit == 2) {21222100 b53_arl_search_rd(priv, 1, &results[1]);21232101 ret = b53_fdb_copy(port, &results[1], cb, data);21242102 if (ret)···21282106 break;21292107 }2130210821312131- } while (count++ < b53_max_arl_entries(priv) / 2);21092109+ } while (count++ < b53_max_arl_entries(priv) / results_per_hit);2132211021332111 mutex_unlock(&priv->arl_mutex);21342112
+1-2
drivers/net/dsa/b53/b53_regs.h
···111111112112/* IP Multicast control (8 bit) */113113#define B53_IP_MULTICAST_CTRL 0x21114114-#define B53_IP_MCAST_25 BIT(0)115115-#define B53_IPMC_FWD_EN BIT(1)114114+#define B53_IP_MC BIT(0)116115#define B53_UC_FWD_EN BIT(6)117116#define B53_MC_FWD_EN BIT(7)118117
+84-14
drivers/net/dsa/microchip/ksz9477.c
···13551355 }13561356}1357135713581358+#define RESV_MCAST_CNT 813591359+13601360+static u8 reserved_mcast_map[RESV_MCAST_CNT] = { 0, 1, 3, 16, 32, 33, 2, 17 };13611361+13581362int ksz9477_enable_stp_addr(struct ksz_device *dev)13591363{13641364+ u8 i, ports, update;13601365 const u32 *masks;13661366+ bool override;13611367 u32 data;13621368 int ret;13631369···13721366 /* Enable Reserved multicast table */13731367 ksz_cfg(dev, REG_SW_LUE_CTRL_0, SW_RESV_MCAST_ENABLE, true);1374136813751375- /* Set the Override bit for forwarding BPDU packet to CPU */13761376- ret = ksz_write32(dev, REG_SW_ALU_VAL_B,13771377- ALU_V_OVERRIDE | BIT(dev->cpu_port));13781378- if (ret < 0)13791379- return ret;13691369+ /* The reserved multicast address table has 8 entries. Each entry has13701370+ * a default value of which port to forward. It is assumed the host13711371+ * port is the last port in most of the switches, but that is not the13721372+ * case for KSZ9477 or maybe KSZ9897. For LAN937X family the default13731373+ * port is port 5, the first RGMII port. It is okay for LAN9370, a13741374+ * 5-port switch, but may not be correct for the other 8-port13751375+ * versions. It is necessary to update the whole table to forward to13761376+ * the right ports.13771377+ * Furthermore PTP messages can use a reserved multicast address and13781378+ * the host will not receive them if this table is not correct.13791379+ */13801380+ for (i = 0; i < RESV_MCAST_CNT; i++) {13811381+ data = reserved_mcast_map[i] <<13821382+ dev->info->shifts[ALU_STAT_INDEX];13831383+ data |= ALU_STAT_START |13841384+ masks[ALU_STAT_DIRECT] |13851385+ masks[ALU_RESV_MCAST_ADDR] |13861386+ masks[ALU_STAT_READ];13871387+ ret = ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);13881388+ if (ret < 0)13891389+ return ret;1380139013811381- data = ALU_STAT_START | ALU_RESV_MCAST_ADDR | masks[ALU_STAT_WRITE];13911391+ /* wait to be finished */13921392+ ret = ksz9477_wait_alu_sta_ready(dev);13931393+ if (ret < 0)13941394+ return ret;1382139513831383- ret = ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);13841384- if (ret < 0)13851385- return ret;13961396+ ret = ksz_read32(dev, REG_SW_ALU_VAL_B, &data);13971397+ if (ret < 0)13981398+ return ret;1386139913871387- /* wait to be finished */13881388- ret = ksz9477_wait_alu_sta_ready(dev);13891389- if (ret < 0) {13901390- dev_err(dev->dev, "Failed to update Reserved Multicast table\n");13911391- return ret;14001400+ override = false;14011401+ ports = data & dev->port_mask;14021402+ switch (i) {14031403+ case 0:14041404+ case 6:14051405+ /* Change the host port. */14061406+ update = BIT(dev->cpu_port);14071407+ override = true;14081408+ break;14091409+ case 2:14101410+ /* Change the host port. */14111411+ update = BIT(dev->cpu_port);14121412+ break;14131413+ case 4:14141414+ case 5:14151415+ case 7:14161416+ /* Skip the host port. */14171417+ update = dev->port_mask & ~BIT(dev->cpu_port);14181418+ break;14191419+ default:14201420+ update = ports;14211421+ break;14221422+ }14231423+ if (update != ports || override) {14241424+ data &= ~dev->port_mask;14251425+ data |= update;14261426+ /* Set Override bit to receive frame even when port is14271427+ * closed.14281428+ */14291429+ if (override)14301430+ data |= ALU_V_OVERRIDE;14311431+ ret = ksz_write32(dev, REG_SW_ALU_VAL_B, data);14321432+ if (ret < 0)14331433+ return ret;14341434+14351435+ data = reserved_mcast_map[i] <<14361436+ dev->info->shifts[ALU_STAT_INDEX];14371437+ data |= ALU_STAT_START |14381438+ masks[ALU_STAT_DIRECT] |14391439+ masks[ALU_RESV_MCAST_ADDR] |14401440+ masks[ALU_STAT_WRITE];14411441+ ret = ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);14421442+ if (ret < 0)14431443+ return ret;14441444+14451445+ /* wait to be finished */14461446+ ret = ksz9477_wait_alu_sta_ready(dev);14471447+ if (ret < 0)14481448+ return ret;14491449+ }13921450 }1393145113941452 return 0;
···15161516 pool->xdp_cnt = numptrs;15171517 pool->xdp = devm_kcalloc(pfvf->dev,15181518 numptrs, sizeof(struct xdp_buff *), GFP_KERNEL);15191519- if (IS_ERR(pool->xdp)) {15201520- netdev_err(pfvf->netdev, "Creation of xsk pool failed\n");15211521- return PTR_ERR(pool->xdp);15221522- }15191519+ if (!pool->xdp)15201520+ return -ENOMEM;15231521 }1524152215251523 return 0;
+20-3
drivers/net/ethernet/mellanox/mlx5/core/cq.c
···6666 tasklet_schedule(&ctx->task);6767}68686969-static void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq,7070- struct mlx5_eqe *eqe)6969+void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq,7070+ struct mlx5_eqe *eqe)7171{7272 unsigned long flags;7373 struct mlx5_eq_tasklet *tasklet_ctx = cq->tasklet_ctx.priv;···9595 if (schedule_tasklet)9696 tasklet_schedule(&tasklet_ctx->task);9797}9898+EXPORT_SYMBOL(mlx5_add_cq_to_tasklet);9899100100+static void mlx5_core_cq_dummy_cb(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe)101101+{102102+ mlx5_core_err(cq->eq->core.dev,103103+ "CQ default completion callback, CQ #%u\n", cq->cqn);104104+}105105+106106+#define MLX5_CQ_INIT_CMD_SN cpu_to_be32(2 << 28)99107/* Callers must verify outbox status in case of err */100108int mlx5_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,101109 u32 *in, int inlen, u32 *out, int outlen)···129121 cq->arm_sn = 0;130122 cq->eq = eq;131123 cq->uid = MLX5_GET(create_cq_in, in, uid);124124+125125+ /* Kernel CQs must set the arm_db address prior to calling126126+ * this function, allowing for the proper value to be127127+ * initialized. User CQs are responsible for their own128128+ * initialization since they do not use the arm_db field.129129+ */130130+ if (cq->arm_db)131131+ *cq->arm_db = MLX5_CQ_INIT_CMD_SN;132132+132133 refcount_set(&cq->refcount, 1);133134 init_completion(&cq->free);134135 if (!cq->comp)135135- cq->comp = mlx5_add_cq_to_tasklet;136136+ cq->comp = mlx5_core_cq_dummy_cb;136137 /* assuming CQ will be deleted before the EQ */137138 cq->tasklet_ctx.priv = &eq->tasklet_ctx;138139 INIT_LIST_HEAD(&cq->tasklet_ctx.list);
+1-1
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
···541541 max_num_channels = mlx5e_get_max_num_channels(mdev);542542 if (val32 > max_num_channels) {543543 NL_SET_ERR_MSG_FMT_MOD(extack,544544- "Requested num_doorbells (%u) exceeds maximum number of channels (%u)",544544+ "Requested num_doorbells (%u) exceeds max number of channels (%u)",545545 val32, max_num_channels);546546 return -EINVAL;547547 }
···29293030static inline void ionic_txq_post(struct ionic_queue *q, bool ring_dbell)3131{3232+ /* Ensure TX descriptor writes reach memory before NIC reads them.3333+ * Prevents device from fetching stale descriptors.3434+ */3535+ dma_wmb();3236 ionic_q_post(q, ring_dbell);3337}3438···14481444 bool encap;14491445 int err;1450144614511451- desc_info = &q->tx_info[q->head_idx];14521452-14531453- if (unlikely(ionic_tx_map_skb(q, skb, desc_info)))14541454- return -EIO;14551455-14561456- len = skb->len;14571457- mss = skb_shinfo(skb)->gso_size;14581458- outer_csum = (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |14591459- SKB_GSO_GRE_CSUM |14601460- SKB_GSO_IPXIP4 |14611461- SKB_GSO_IPXIP6 |14621462- SKB_GSO_UDP_TUNNEL |14631463- SKB_GSO_UDP_TUNNEL_CSUM));14641447 has_vlan = !!skb_vlan_tag_present(skb);14651448 vlan_tci = skb_vlan_tag_get(skb);14661449 encap = skb->encapsulation;···14611470 err = ionic_tx_tcp_inner_pseudo_csum(skb);14621471 else14631472 err = ionic_tx_tcp_pseudo_csum(skb);14641464- if (unlikely(err)) {14651465- /* clean up mapping from ionic_tx_map_skb */14661466- ionic_tx_desc_unmap_bufs(q, desc_info);14731473+ if (unlikely(err))14671474 return err;14681468- }1469147514761476+ desc_info = &q->tx_info[q->head_idx];14771477+ if (unlikely(ionic_tx_map_skb(q, skb, desc_info)))14781478+ return -EIO;14791479+14801480+ len = skb->len;14811481+ mss = skb_shinfo(skb)->gso_size;14821482+ outer_csum = (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |14831483+ SKB_GSO_GRE_CSUM |14841484+ SKB_GSO_IPXIP4 |14851485+ SKB_GSO_IPXIP6 |14861486+ SKB_GSO_UDP_TUNNEL |14871487+ SKB_GSO_UDP_TUNNEL_CSUM));14701488 if (encap)14711489 hdrlen = skb_inner_tcp_all_headers(skb);14721490 else
+3
drivers/net/ethernet/spacemit/k1_emac.c
···14411441 struct emac_priv *priv = netdev_priv(dev);14421442 u8 fc = 0;1443144314441444+ if (!netif_running(dev))14451445+ return -ENETDOWN;14461446+14441447 priv->flow_control_autoneg = pause->autoneg;1445144814461449 if (pause->autoneg) {
+38-15
drivers/net/ethernet/ti/am65-cpsw-qos.c
···276276 /* The number of wireside clocks contained in the verify277277 * timeout counter. The default is 0x1312d0278278 * (10ms at 125Mhz in 1G mode).279279+ * The frequency of the clock depends on the link speed280280+ * and the PHY interface.279281 */280280- val = 125 * HZ_PER_MHZ; /* assuming 125MHz wireside clock */282282+ switch (port->slave.phy_if) {283283+ case PHY_INTERFACE_MODE_RGMII:284284+ case PHY_INTERFACE_MODE_RGMII_ID:285285+ case PHY_INTERFACE_MODE_RGMII_RXID:286286+ case PHY_INTERFACE_MODE_RGMII_TXID:287287+ if (port->qos.link_speed == SPEED_1000)288288+ val = 125 * HZ_PER_MHZ; /* 125 MHz at 1000Mbps*/289289+ else if (port->qos.link_speed == SPEED_100)290290+ val = 25 * HZ_PER_MHZ; /* 25 MHz at 100Mbps*/291291+ else292292+ val = (25 * HZ_PER_MHZ) / 10; /* 2.5 MHz at 10Mbps*/293293+ break;281294295295+ case PHY_INTERFACE_MODE_QSGMII:296296+ case PHY_INTERFACE_MODE_SGMII:297297+ val = 125 * HZ_PER_MHZ; /* 125 MHz */298298+ break;299299+300300+ default:301301+ netdev_err(port->ndev, "selected mode does not supported IET\n");302302+ return -EOPNOTSUPP;303303+ }282304 val /= MILLIHZ_PER_HZ; /* count per ms timeout */283305 val *= verify_time_ms; /* count for timeout ms */284306···317295 u32 ctrl, status;318296 int try;319297320320- try = 20;298298+ try = 3;299299+300300+ /* Reset the verify state machine by writing 1301301+ * to LINKFAIL302302+ */303303+ ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);304304+ ctrl |= AM65_CPSW_PN_IET_MAC_LINKFAIL;305305+ writel(ctrl, port->port_base + AM65_CPSW_PN_REG_IET_CTRL);306306+307307+ /* Clear MAC_LINKFAIL bit to start Verify. */308308+ ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);309309+ ctrl &= ~AM65_CPSW_PN_IET_MAC_LINKFAIL;310310+ writel(ctrl, port->port_base + AM65_CPSW_PN_REG_IET_CTRL);311311+321312 do {322322- /* Reset the verify state machine by writing 1323323- * to LINKFAIL324324- */325325- ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);326326- ctrl |= AM65_CPSW_PN_IET_MAC_LINKFAIL;327327- writel(ctrl, port->port_base + AM65_CPSW_PN_REG_IET_CTRL);328328-329329- /* Clear MAC_LINKFAIL bit to start Verify. */330330- ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);331331- ctrl &= ~AM65_CPSW_PN_IET_MAC_LINKFAIL;332332- writel(ctrl, port->port_base + AM65_CPSW_PN_REG_IET_CTRL);333333-334313 msleep(port->qos.iet.verify_time_ms);335314336315 status = readl(port->port_base + AM65_CPSW_PN_REG_IET_STATUS);···353330 netdev_dbg(port->ndev, "MAC Merge verify error\n");354331 return -ENODEV;355332 }356356- } while (try-- > 0);333333+ } while (--try > 0);357334358335 netdev_dbg(port->ndev, "MAC Merge verify timeout\n");359336 return -ETIMEDOUT;
+7
drivers/net/ethernet/ti/icssg/icssg_config.c
···6666#define FDB_GEN_CFG1 0x606767#define SMEM_VLAN_OFFSET 86868#define SMEM_VLAN_OFFSET_MASK GENMASK(25, 8)6969+#define FDB_HASH_SIZE_MASK GENMASK(6, 3)7070+#define FDB_HASH_SIZE_SHIFT 37171+#define FDB_HASH_SIZE 369727073#define FDB_GEN_CFG2 0x647174#define FDB_VLAN_EN BIT(6)···466463 /* Set VLAN TABLE address base */467464 regmap_update_bits(prueth->miig_rt, FDB_GEN_CFG1, SMEM_VLAN_OFFSET_MASK,468465 addr << SMEM_VLAN_OFFSET);466466+ regmap_update_bits(prueth->miig_rt, FDB_GEN_CFG1, FDB_HASH_SIZE_MASK,467467+ FDB_HASH_SIZE << FDB_HASH_SIZE_SHIFT);469468 /* Set enable VLAN aware mode, and FDBs for all PRUs */470469 regmap_write(prueth->miig_rt, FDB_GEN_CFG2, (FDB_PRU0_EN | FDB_PRU1_EN | FDB_HOST_EN));471470 prueth->vlan_tbl = (struct prueth_vlan_tbl __force *)(prueth->shram.va +···489484 /* Set VLAN TABLE address base */490485 regmap_update_bits(prueth->miig_rt, FDB_GEN_CFG1, SMEM_VLAN_OFFSET_MASK,491486 addr << SMEM_VLAN_OFFSET);487487+ regmap_update_bits(prueth->miig_rt, FDB_GEN_CFG1, FDB_HASH_SIZE_MASK,488488+ FDB_HASH_SIZE << FDB_HASH_SIZE_SHIFT);492489 /* Set enable VLAN aware mode, and FDBs for all PRUs */493490 regmap_write(prueth->miig_rt, FDB_GEN_CFG2, FDB_EN_ALL);494491 prueth->vlan_tbl = (struct prueth_vlan_tbl __force *)(prueth->shram.va +
+5-5
drivers/net/ethernet/ti/netcp_core.c
···1338133813391339 tx_pipe->dma_channel = knav_dma_open_channel(dev,13401340 tx_pipe->dma_chan_name, &config);13411341- if (IS_ERR(tx_pipe->dma_channel)) {13411341+ if (!tx_pipe->dma_channel) {13421342 dev_err(dev, "failed opening tx chan(%s)\n",13431343 tx_pipe->dma_chan_name);13441344- ret = PTR_ERR(tx_pipe->dma_channel);13441344+ ret = -EINVAL;13451345 goto err;13461346 }13471347···13591359 return 0;1360136013611361err:13621362- if (!IS_ERR_OR_NULL(tx_pipe->dma_channel))13621362+ if (tx_pipe->dma_channel)13631363 knav_dma_close_channel(tx_pipe->dma_channel);13641364 tx_pipe->dma_channel = NULL;13651365 return ret;···1678167816791679 netcp->rx_channel = knav_dma_open_channel(netcp->netcp_device->device,16801680 netcp->dma_chan_name, &config);16811681- if (IS_ERR(netcp->rx_channel)) {16811681+ if (!netcp->rx_channel) {16821682 dev_err(netcp->ndev_dev, "failed opening rx chan(%s\n",16831683 netcp->dma_chan_name);16841684- ret = PTR_ERR(netcp->rx_channel);16841684+ ret = -EINVAL;16851685 goto fail;16861686 }16871687
···192192 if (!skbn)193193 return 0;194194195195+ /* Raw IP packets don't have a MAC header, but other subsystems196196+ * (like xfrm) may still access MAC header offsets, so they must197197+ * be initialized.198198+ */199199+ skb_reset_mac_header(skbn);200200+195201 switch (skb->data[offset + qmimux_hdr_sz] & 0xf0) {196202 case 0x40:197203 skbn->protocol = htons(ETH_P_IP);
+36-20
drivers/net/virtio_net.c
···910910 goto ok;911911 }912912913913- /*914914- * Verify that we can indeed put this data into a skb.915915- * This is here to handle cases when the device erroneously916916- * tries to receive more than is possible. This is usually917917- * the case of a broken device.918918- */919919- if (unlikely(len > MAX_SKB_FRAGS * PAGE_SIZE)) {920920- net_dbg_ratelimited("%s: too much data\n", skb->dev->name);921921- dev_kfree_skb(skb);922922- return NULL;923923- }924913 BUG_ON(offset >= PAGE_SIZE);925914 while (len) {926915 unsigned int frag_size = min((unsigned)PAGE_SIZE - offset, len);···21012112 struct virtnet_rq_stats *stats)21022113{21032114 struct page *page = buf;21042104- struct sk_buff *skb =21052105- page_to_skb(vi, rq, page, 0, len, PAGE_SIZE, 0);21152115+ struct sk_buff *skb;2106211621172117+ /* Make sure that len does not exceed the size allocated in21182118+ * add_recvbuf_big.21192119+ */21202120+ if (unlikely(len > (vi->big_packets_num_skbfrags + 1) * PAGE_SIZE)) {21212121+ pr_debug("%s: rx error: len %u exceeds allocated size %lu\n",21222122+ dev->name, len,21232123+ (vi->big_packets_num_skbfrags + 1) * PAGE_SIZE);21242124+ goto err;21252125+ }21262126+21272127+ skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE, 0);21072128 u64_stats_add(&stats->bytes, len - vi->hdr_len);21082129 if (unlikely(!skb))21092130 goto err;···25382539 return NULL;25392540}2540254125422542+static inline u3225432543+virtio_net_hash_value(const struct virtio_net_hdr_v1_hash *hdr_hash)25442544+{25452545+ return __le16_to_cpu(hdr_hash->hash_value_lo) |25462546+ (__le16_to_cpu(hdr_hash->hash_value_hi) << 16);25472547+}25482548+25412549static void virtio_skb_set_hash(const struct virtio_net_hdr_v1_hash *hdr_hash,25422550 struct sk_buff *skb)25432551{···25712565 default:25722566 rss_hash_type = PKT_HASH_TYPE_NONE;25732567 }25742574- skb_set_hash(skb, __le32_to_cpu(hdr_hash->hash_value), rss_hash_type);25682568+ skb_set_hash(skb, virtio_net_hash_value(hdr_hash), rss_hash_type);25752569}2576257025772571static void virtnet_receive_done(struct virtnet_info *vi, struct receive_queue *rq,···26312625 return;26322626 }2633262726342634- /* 1. Save the flags early, as the XDP program might overwrite them.26282628+ /* About the flags below:26292629+ * 1. Save the flags early, as the XDP program might overwrite them.26352630 * These flags ensure packets marked as VIRTIO_NET_HDR_F_DATA_VALID26362631 * stay valid after XDP processing.26372632 * 2. XDP doesn't work with partially checksummed packets (refer to26382633 * virtnet_xdp_set()), so packets marked as26392634 * VIRTIO_NET_HDR_F_NEEDS_CSUM get dropped during XDP processing.26402635 */26412641- flags = ((struct virtio_net_common_hdr *)buf)->hdr.flags;2642263626432643- if (vi->mergeable_rx_bufs)26372637+ if (vi->mergeable_rx_bufs) {26382638+ flags = ((struct virtio_net_common_hdr *)buf)->hdr.flags;26442639 skb = receive_mergeable(dev, vi, rq, buf, ctx, len, xdp_xmit,26452640 stats);26462646- else if (vi->big_packets)26412641+ } else if (vi->big_packets) {26422642+ void *p = page_address((struct page *)buf);26432643+26442644+ flags = ((struct virtio_net_common_hdr *)p)->hdr.flags;26472645 skb = receive_big(dev, vi, rq, buf, len, stats);26482648- else26462646+ } else {26472647+ flags = ((struct virtio_net_common_hdr *)buf)->hdr.flags;26492648 skb = receive_small(dev, vi, rq, buf, ctx, len, xdp_xmit, stats);26492649+ }2650265026512651 if (unlikely(!skb))26522652 return;···33223310 bool can_push;3323331133243312 pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest);33133313+33143314+ /* Make sure it's safe to cast between formats */33153315+ BUILD_BUG_ON(__alignof__(*hdr) != __alignof__(hdr->hash_hdr));33163316+ BUILD_BUG_ON(__alignof__(*hdr) != __alignof__(hdr->hash_hdr.hdr));3325331733263318 can_push = vi->any_header_sg &&33273319 !((unsigned long)skb->data & (__alignof__(*hdr) - 1)) &&···67666750 hash_report = VIRTIO_NET_HASH_REPORT_NONE;6767675167686752 *rss_type = virtnet_xdp_rss_type[hash_report];67696769- *hash = __le32_to_cpu(hdr_hash->hash_value);67536753+ *hash = virtio_net_hash_value(hdr_hash);67706754 return 0;67716755}67726756
···1764176417651765int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)17661766{17671767- unsigned long timeout = jiffies + WMI_SERVICE_READY_TIMEOUT_HZ;17681767 unsigned long time_left, i;1769176817701770- /* Sometimes the PCI HIF doesn't receive interrupt17711771- * for the service ready message even if the buffer17721772- * was completed. PCIe sniffer shows that it's17731773- * because the corresponding CE ring doesn't fires17741774- * it. Workaround here by polling CE rings. Since17751775- * the message could arrive at any time, continue17761776- * polling until timeout.17771777- */17781778- do {17691769+ time_left = wait_for_completion_timeout(&ar->wmi.service_ready,17701770+ WMI_SERVICE_READY_TIMEOUT_HZ);17711771+ if (!time_left) {17721772+ /* Sometimes the PCI HIF doesn't receive interrupt17731773+ * for the service ready message even if the buffer17741774+ * was completed. PCIe sniffer shows that it's17751775+ * because the corresponding CE ring doesn't fires17761776+ * it. Workaround here by polling CE rings once.17771777+ */17781778+ ath10k_warn(ar, "failed to receive service ready completion, polling..\n");17791779+17791780 for (i = 0; i < CE_COUNT; i++)17801781 ath10k_hif_send_complete_check(ar, i, 1);1781178217821782- /* The 100 ms granularity is a tradeoff considering scheduler17831783- * overhead and response latency17841784- */17851783 time_left = wait_for_completion_timeout(&ar->wmi.service_ready,17861786- msecs_to_jiffies(100));17871787- if (time_left)17881788- return 0;17891789- } while (time_before(jiffies, timeout));17841784+ WMI_SERVICE_READY_TIMEOUT_HZ);17851785+ if (!time_left) {17861786+ ath10k_warn(ar, "polling timed out\n");17871787+ return -ETIMEDOUT;17881788+ }1790178917911791- ath10k_warn(ar, "failed to receive service ready completion\n");17921792- return -ETIMEDOUT;17901790+ ath10k_warn(ar, "service ready completion received, continuing normally\n");17911791+ }17921792+17931793+ return 0;17931794}1794179517951796int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)
···814814static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)815815{816816 struct pci_dev *child = link->downstream, *parent = link->pdev;817817- u32 parent_lnkcap, child_lnkcap;818817 u16 parent_lnkctl, child_lnkctl;819818 struct pci_bus *linkbus = parent->subordinate;820819···828829 * If ASPM not supported, don't mess with the clocks and link,829830 * bail out now.830831 */831831- pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, &parent_lnkcap);832832- pcie_capability_read_dword(child, PCI_EXP_LNKCAP, &child_lnkcap);833833- if (!(parent_lnkcap & child_lnkcap & PCI_EXP_LNKCAP_ASPMS))832832+ if (!(parent->aspm_l0s_support && child->aspm_l0s_support) &&833833+ !(parent->aspm_l1_support && child->aspm_l1_support))834834 return;835835836836 /* Configure common clock before checking latencies */···841843 * read-only Link Capabilities may change depending on common clock842844 * configuration (PCIe r5.0, sec 7.5.3.6).843845 */844844- pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, &parent_lnkcap);845845- pcie_capability_read_dword(child, PCI_EXP_LNKCAP, &child_lnkcap);846846 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &parent_lnkctl);847847 pcie_capability_read_word(child, PCI_EXP_LNKCTL, &child_lnkctl);848848···860864 * given link unless components on both sides of the link each861865 * support L0s.862866 */863863- if (parent_lnkcap & child_lnkcap & PCI_EXP_LNKCAP_ASPM_L0S)867867+ if (parent->aspm_l0s_support && child->aspm_l0s_support)864868 link->aspm_support |= PCIE_LINK_STATE_L0S;865869866870 if (child_lnkctl & PCI_EXP_LNKCTL_ASPM_L0S)···869873 link->aspm_enabled |= PCIE_LINK_STATE_L0S_DW;870874871875 /* Setup L1 state */872872- if (parent_lnkcap & child_lnkcap & PCI_EXP_LNKCAP_ASPM_L1)876876+ if (parent->aspm_l1_support && child->aspm_l1_support)873877 link->aspm_support |= PCIE_LINK_STATE_L1;874878875879 if (parent_lnkctl & child_lnkctl & PCI_EXP_LNKCTL_ASPM_L1)···15251529 return __pci_enable_link_state(pdev, state, true);15261530}15271531EXPORT_SYMBOL(pci_enable_link_state_locked);15321532+15331533+void pcie_aspm_remove_cap(struct pci_dev *pdev, u32 lnkcap)15341534+{15351535+ if (lnkcap & PCI_EXP_LNKCAP_ASPM_L0S)15361536+ pdev->aspm_l0s_support = 0;15371537+ if (lnkcap & PCI_EXP_LNKCAP_ASPM_L1)15381538+ pdev->aspm_l1_support = 0;15391539+15401540+ pci_info(pdev, "ASPM: Link Capabilities%s%s treated as unsupported to avoid device defect\n",15411541+ lnkcap & PCI_EXP_LNKCAP_ASPM_L0S ? " L0s" : "",15421542+ lnkcap & PCI_EXP_LNKCAP_ASPM_L1 ? " L1" : "");15431543+15441544+}1528154515291546static int pcie_aspm_set_policy(const char *val,15301547 const struct kernel_param *kp)
+7
drivers/pci/probe.c
···16561656 if (reg32 & PCI_EXP_LNKCAP_DLLLARC)16571657 pdev->link_active_reporting = 1;1658165816591659+#ifdef CONFIG_PCIEASPM16601660+ if (reg32 & PCI_EXP_LNKCAP_ASPM_L0S)16611661+ pdev->aspm_l0s_support = 1;16621662+ if (reg32 & PCI_EXP_LNKCAP_ASPM_L1)16631663+ pdev->aspm_l1_support = 1;16641664+#endif16651665+16591666 parent = pci_upstream_bridge(pdev);16601667 if (!parent)16611668 return;
+21-19
drivers/pci/quirks.c
···24942494 */24952495static void quirk_disable_aspm_l0s(struct pci_dev *dev)24962496{24972497- pci_info(dev, "Disabling L0s\n");24982498- pci_disable_link_state(dev, PCIE_LINK_STATE_L0S);24972497+ pcie_aspm_remove_cap(dev, PCI_EXP_LNKCAP_ASPM_L0S);24992498}25002500-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a7, quirk_disable_aspm_l0s);25012501-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a9, quirk_disable_aspm_l0s);25022502-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10b6, quirk_disable_aspm_l0s);25032503-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c6, quirk_disable_aspm_l0s);25042504-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c7, quirk_disable_aspm_l0s);25052505-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c8, quirk_disable_aspm_l0s);25062506-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10d6, quirk_disable_aspm_l0s);25072507-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10db, quirk_disable_aspm_l0s);25082508-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10dd, quirk_disable_aspm_l0s);25092509-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10e1, quirk_disable_aspm_l0s);25102510-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10ec, quirk_disable_aspm_l0s);25112511-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);25122512-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);25132513-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);24992499+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10a7, quirk_disable_aspm_l0s);25002500+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10a9, quirk_disable_aspm_l0s);25012501+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10b6, quirk_disable_aspm_l0s);25022502+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10c6, quirk_disable_aspm_l0s);25032503+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10c7, quirk_disable_aspm_l0s);25042504+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10c8, quirk_disable_aspm_l0s);25052505+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10d6, quirk_disable_aspm_l0s);25062506+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10db, quirk_disable_aspm_l0s);25072507+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10dd, quirk_disable_aspm_l0s);25082508+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e1, quirk_disable_aspm_l0s);25092509+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10ec, quirk_disable_aspm_l0s);25102510+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);25112511+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);25122512+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);2514251325152514static void quirk_disable_aspm_l0s_l1(struct pci_dev *dev)25162515{25172517- pci_info(dev, "Disabling ASPM L0s/L1\n");25182518- pci_disable_link_state(dev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);25162516+ pcie_aspm_remove_cap(dev,25172517+ PCI_EXP_LNKCAP_ASPM_L0S | PCI_EXP_LNKCAP_ASPM_L1);25192518}2520251925212520/*···25222523 * upstream PCIe root port when ASPM is enabled. At least L0s mode is affected;25232524 * disable both L0s and L1 for now to be safe.25242525 */25252525-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x1080, quirk_disable_aspm_l0s_l1);25262526+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ASMEDIA, 0x1080, quirk_disable_aspm_l0s_l1);25272527+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, 0x0451, quirk_disable_aspm_l0s_l1);25282528+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_PASEMI, 0xa002, quirk_disable_aspm_l0s_l1);25292529+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HUAWEI, 0x1105, quirk_disable_aspm_l0s_l1);2526253025272531/*25282532 * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
+1-1
drivers/platform/x86/Kconfig
···432432 depends on INPUT433433 help434434 This driver provides supports for the wireless buttons found on some AMD,435435- HP, & Xioami laptops.435435+ HP, & Xiaomi laptops.436436 On such systems the driver should load automatically (via ACPI alias).437437438438 To compile this driver as a module, choose M here: the module will
+12
drivers/platform/x86/dell/dell-wmi-base.c
···365365 /* Backlight brightness change event */366366 { KE_IGNORE, 0x0003, { KEY_RESERVED } },367367368368+ /*369369+ * Electronic privacy screen toggled, extended data gives state,370370+ * separate entries for on/off see handling in dell_wmi_process_key().371371+ */372372+ { KE_KEY, 0x000c, { KEY_EPRIVACY_SCREEN_OFF } },373373+ { KE_KEY, 0x000c, { KEY_EPRIVACY_SCREEN_ON } },374374+368375 /* Ultra-performance mode switch request */369376 { KE_IGNORE, 0x000d, { KEY_RESERVED } },370377···442435 "Dell tablet mode switch",443436 SW_TABLET_MODE, !buffer[0]);444437 return 1;438438+ } else if (type == 0x0012 && code == 0x000c && remaining > 0) {439439+ /* Eprivacy toggle, switch to "on" key entry for on events */440440+ if (buffer[0] == 2)441441+ key++;442442+ used = 1;445443 } else if (type == 0x0012 && code == 0x000d && remaining > 0) {446444 value = (buffer[2] == 2);447445 used = 1;
···9292 { },9393};94949595-static const char *exynos_get_domain_name(struct device_node *node)9595+static const char *exynos_get_domain_name(struct device *dev,9696+ struct device_node *node)9697{9798 const char *name;989999100 if (of_property_read_string(node, "label", &name) < 0)100101 name = kbasename(node->full_name);101101- return kstrdup_const(name, GFP_KERNEL);102102+ return devm_kstrdup_const(dev, name, GFP_KERNEL);102103}103104104105static int exynos_pd_probe(struct platform_device *pdev)···116115 if (!pd)117116 return -ENOMEM;118117119119- pd->pd.name = exynos_get_domain_name(np);118118+ pd->pd.name = exynos_get_domain_name(dev, np);120119 if (!pd->pd.name)121120 return -ENOMEM;122121123122 pd->base = of_iomap(np, 0);124124- if (!pd->base) {125125- kfree_const(pd->pd.name);123123+ if (!pd->base)126124 return -ENODEV;127127- }128125129126 pd->pd.power_off = exynos_pd_power_off;130127 pd->pd.power_on = exynos_pd_power_on;131128 pd->local_pwr_cfg = pm_domain_cfg->local_pwr_cfg;129129+130130+ /*131131+ * Some Samsung platforms with bootloaders turning on the splash-screen132132+ * and handing it over to the kernel, requires the power-domains to be133133+ * reset during boot.134134+ */135135+ if (IS_ENABLED(CONFIG_ARM) &&136136+ of_device_is_compatible(np, "samsung,exynos4210-pd"))137137+ exynos_pd_power_off(&pd->pd);132138133139 on = readl_relaxed(pd->base + 0x4) & pd->local_pwr_cfg;134140···154146 pr_info("%pOF has as child subdomain: %pOF.\n",155147 parent.np, child.np);156148 }157157-158158- /*159159- * Some Samsung platforms with bootloaders turning on the splash-screen160160- * and handing it over to the kernel, requires the power-domains to be161161- * reset during boot. As a temporary hack to manage this, let's enforce162162- * a sync_state.163163- */164164- if (!ret)165165- of_genpd_sync_state(np);166149167150 pm_runtime_enable(dev);168151 return ret;
+4
drivers/ptp/ptp_chardev.c
···561561 return ptp_mask_en_single(pccontext->private_clkdata, argptr);562562563563 case PTP_SYS_OFFSET_PRECISE_CYCLES:564564+ if (!ptp->has_cycles)565565+ return -EOPNOTSUPP;564566 return ptp_sys_offset_precise(ptp, argptr,565567 ptp->info->getcrosscycles);566568567569 case PTP_SYS_OFFSET_EXTENDED_CYCLES:570570+ if (!ptp->has_cycles)571571+ return -EOPNOTSUPP;568572 return ptp_sys_offset_extended(ptp, argptr,569573 ptp->info->getcyclesx64);570574 default:
+1
drivers/regulator/fixed.c
···334334 ret = dev_err_probe(&pdev->dev, PTR_ERR(drvdata->dev),335335 "Failed to register regulator: %ld\n",336336 PTR_ERR(drvdata->dev));337337+ gpiod_put(cfg.ena_gpiod);337338 return ret;338339 }339340
···300300301301 /* Read out all the data from the Rx FIFO */302302 rx_words = n_words;303303- stalled = 10;303303+ stalled = 32;304304 while (rx_words) {305305 if (rx_words == n_words && !(stalled--) &&306306 !(sr & XSPI_SR_TX_EMPTY_MASK) &&
+12
drivers/spi/spi.c
···28512851 acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias,28522852 sizeof(spi->modalias));2853285328542854+ /*28552855+ * This gets re-tried in spi_probe() for -EPROBE_DEFER handling in case28562856+ * the GPIO controller does not have a driver yet. This needs to be done28572857+ * here too, because this call sets the GPIO direction and/or bias.28582858+ * Setting these needs to be done even if there is no driver, in which28592859+ * case spi_probe() will never get called.28602860+ * TODO: ideally the setup of the GPIO should be handled in a generic28612861+ * manner in the ACPI/gpiolib core code.28622862+ */28632863+ if (spi->irq < 0)28642864+ spi->irq = acpi_dev_gpio_irq_get(adev, 0);28652865+28542866 acpi_device_set_enumerated(adev);2855286728562868 adev->power.flags.ignore_parent = true;
···50665066 * If UFS device isn't active then we will have to issue link startup50675067 * 2 times to make sure the device state move to active.50685068 */50695069- if (!ufshcd_is_ufs_dev_active(hba))50695069+ if (!(hba->quirks & UFSHCD_QUIRK_PERFORM_LINK_STARTUP_ONCE) &&50705070+ !ufshcd_is_ufs_dev_active(hba))50705071 link_startup_again = true;5071507250725073link_startup:···51325131 ufshcd_readl(hba, REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER);51335132 ret = ufshcd_make_hba_operational(hba);51345133out:51355135- if (ret) {51345134+ if (ret)51365135 dev_err(hba->dev, "link startup failed %d\n", ret);51375137- ufshcd_print_host_state(hba);51385138- ufshcd_print_pwr_info(hba);51395139- ufshcd_print_evt_hist(hba);51405140- }51415136 return ret;51425137}51435138···85008503 DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP) &85018504 UFS_DEV_HID_SUPPORT;8502850585038503- sysfs_update_group(&hba->dev->kobj, &ufs_sysfs_hid_group);85048504-85058506 model_index = desc_buf[DEVICE_DESC_PARAM_PRDCT_NAME];8506850785078508 err = ufshcd_read_string_desc(hba, model_index,···1065610661 * @mmio_base: base register address1065710662 * @irq: Interrupt line of device1065810663 *1065910659- * Return: 0 on success, non-zero value on failure.1066410664+ * Return: 0 on success; < 0 on failure.1066010665 */1066110666int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)1066210667{···1088610891 if (err)1088710892 goto out_disable;10888108931088910889- async_schedule(ufshcd_async_scan, hba);1089010894 ufs_sysfs_add_nodes(hba->dev);1089510895+ async_schedule(ufshcd_async_scan, hba);10891108961089210897 device_enable_async_suspend(dev);1089310898 ufshcd_pm_qos_init(hba);···1089710902 hba->is_irq_enabled = false;1089810903 ufshcd_hba_exit(hba);1089910904out_error:1090010900- return err;1090510905+ return err > 0 ? -EIO : err;1090110906}1090210907EXPORT_SYMBOL_GPL(ufshcd_init);1090310908
+14-1
drivers/ufs/host/ufs-qcom.c
···740740741741742742 /* reset the connected UFS device during power down */743743- if (ufs_qcom_is_link_off(hba) && host->device_reset)743743+ if (ufs_qcom_is_link_off(hba) && host->device_reset) {744744 ufs_qcom_device_reset_ctrl(hba, true);745745+ /*746746+ * After sending the SSU command, asserting the rst_n747747+ * line causes the device firmware to wake up and748748+ * execute its reset routine.749749+ *750750+ * During this process, the device may draw current751751+ * beyond the permissible limit for low-power mode (LPM).752752+ * A 10ms delay, based on experimental observations,753753+ * allows the UFS device to complete its hardware reset754754+ * before transitioning the power rail to LPM.755755+ */756756+ usleep_range(10000, 11000);757757+ }745758746759 return ufs_qcom_ice_suspend(host);747760}
···22282228 wbc_account_cgroup_owner(wbc, folio, range_len);22292229 folio_unlock(folio);22302230 }22312231+ /*22322232+ * If the fs is already in error status, do not submit any writeback22332233+ * but immediately finish it.22342234+ */22352235+ if (unlikely(BTRFS_FS_ERROR(fs_info))) {22362236+ btrfs_bio_end_io(bbio, errno_to_blk_status(BTRFS_FS_ERROR(fs_info)));22372237+ return;22382238+ }22312239 btrfs_submit_bbio(bbio, 0);22322240}22332241
+10
fs/btrfs/file.c
···28542854{28552855 struct btrfs_trans_handle *trans;28562856 struct btrfs_root *root = BTRFS_I(inode)->root;28572857+ u64 range_start;28582858+ u64 range_end;28572859 int ret;28582860 int ret2;2859286128602862 if (mode & FALLOC_FL_KEEP_SIZE || end <= i_size_read(inode))28612863 return 0;28642864+28652865+ range_start = round_down(i_size_read(inode), root->fs_info->sectorsize);28662866+ range_end = round_up(end, root->fs_info->sectorsize);28672867+28682868+ ret = btrfs_inode_set_file_extent_range(BTRFS_I(inode), range_start,28692869+ range_end - range_start);28702870+ if (ret)28712871+ return ret;2862287228632873 trans = btrfs_start_transaction(root, 1);28642874 if (IS_ERR(trans))
+3-2
fs/btrfs/inode.c
···177177 return ret;178178 }179179 ret = paths_from_inode(inum, ipath);180180- if (ret < 0)180180+ if (ret < 0) {181181+ btrfs_put_root(local_root);181182 goto err;183183+ }182184183185 /*184186 * We deliberately ignore the bit ipath might have been too small to···68756873 BTRFS_I(inode)->dir_index = 0ULL;68766874 inode_inc_iversion(inode);68776875 inode_set_ctime_current(inode);68786878- set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);6879687668806877 ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),68816878 &fname.disk_name, 1, index);
+3-1
fs/btrfs/qgroup.c
···15391539 ASSERT(prealloc);1540154015411541 /* Check the level of src and dst first */15421542- if (btrfs_qgroup_level(src) >= btrfs_qgroup_level(dst))15421542+ if (btrfs_qgroup_level(src) >= btrfs_qgroup_level(dst)) {15431543+ kfree(prealloc);15431544 return -EINVAL;15451545+ }1544154615451547 mutex_lock(&fs_info->qgroup_ioctl_lock);15461548 if (!fs_info->quota_root) {
+2
fs/btrfs/scrub.c
···22032203 ret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, full_stripe_start,22042204 &length, &bioc, NULL, NULL);22052205 if (ret < 0) {22062206+ bio_put(bio);22062207 btrfs_put_bioc(bioc);22072208 btrfs_bio_counter_dec(fs_info);22082209 goto out;···22132212 btrfs_put_bioc(bioc);22142213 if (!rbio) {22152214 ret = -ENOMEM;22152215+ bio_put(bio);22162216 btrfs_bio_counter_dec(fs_info);22172217 goto out;22182218 }
+4-1
fs/btrfs/tree-log.c
···71227122 * a power failure unless the log was synced as part of an fsync71237123 * against any other unrelated inode.71247124 */71257125- if (inode_only != LOG_INODE_EXISTS)71257125+ if (!ctx->logging_new_name && inode_only != LOG_INODE_EXISTS)71267126 inode->last_log_commit = inode->last_sub_trans;71277127 spin_unlock(&inode->lock);71287128···79097909 struct btrfs_log_ctx ctx;79107910 bool log_pinned = false;79117911 int ret;79127912+79137913+ /* The inode has a new name (ref/extref), so make sure we log it. */79147914+ set_bit(BTRFS_INODE_COPY_EVERYTHING, &inode->runtime_flags);7912791579137916 btrfs_init_log_ctx(&ctx, inode);79147917 ctx.logging_new_name = true;
···15421542 release_all_access(stp);15431543 if (stp->st_stateowner)15441544 nfs4_put_stateowner(stp->st_stateowner);15451545- WARN_ON(!list_empty(&stid->sc_cp_list));15451545+ if (!list_empty(&stid->sc_cp_list))15461546+ nfs4_free_cpntf_statelist(stid->sc_client->net, stid);15461547 kmem_cache_free(stateid_slab, stid);15471548}15481549···34873486 struct nfsd4_slot *slot = resp->cstate.slot;34883487 unsigned int base;3489348834903490- dprintk("--> %s slot %p\n", __func__, slot);34893489+ /*34903490+ * RFC 5661 Section 2.10.6.1.2:34913491+ *34923492+ * Any time SEQUENCE ... returns an error ... [t]he replier MUST NOT34933493+ * modify the reply cache entry for the slot whenever an error is34943494+ * returned from SEQUENCE ...34953495+ *34963496+ * Because nfsd4_store_cache_entry is called only by34973497+ * nfsd4_sequence_done(), nfsd4_store_cache_entry() is called only34983498+ * when a SEQUENCE operation was part of the COMPOUND.34993499+ * nfs41_check_op_ordering() ensures SEQUENCE is the first op.35003500+ */35013501+ if (resp->opcnt == 1 && resp->cstate.status != nfs_ok)35023502+ return;3491350334923504 slot->sl_flags |= NFSD4_SLOT_INITIALIZED;34933505 slot->sl_opcnt = resp->opcnt;···43634349 return true;43644350}4365435143524352+/*43534353+ * Note that the response is constructed here both for the case43544354+ * of a new SEQUENCE request and for a replayed SEQUENCE request.43554355+ * We do not cache SEQUENCE responses as SEQUENCE is idempotent.43564356+ */43574357+static void nfsd4_construct_sequence_response(struct nfsd4_session *session,43584358+ struct nfsd4_sequence *seq)43594359+{43604360+ struct nfs4_client *clp = session->se_client;43614361+43624362+ seq->maxslots_response = max(session->se_target_maxslots,43634363+ seq->maxslots);43644364+ seq->target_maxslots = session->se_target_maxslots;43654365+43664366+ switch (clp->cl_cb_state) {43674367+ case NFSD4_CB_DOWN:43684368+ seq->status_flags = SEQ4_STATUS_CB_PATH_DOWN;43694369+ break;43704370+ case NFSD4_CB_FAULT:43714371+ seq->status_flags = SEQ4_STATUS_BACKCHANNEL_FAULT;43724372+ break;43734373+ default:43744374+ seq->status_flags = 0;43754375+ }43764376+ if (!list_empty(&clp->cl_revoked))43774377+ seq->status_flags |= SEQ4_STATUS_RECALLABLE_STATE_REVOKED;43784378+ if (atomic_read(&clp->cl_admin_revoked))43794379+ seq->status_flags |= SEQ4_STATUS_ADMIN_STATE_REVOKED;43804380+}43814381+43664382__be3243674383nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,43684384 union nfsd4_op_u *u)···44424398 dprintk("%s: slotid %d\n", __func__, seq->slotid);4443439944444400 trace_nfsd_slot_seqid_sequence(clp, seq, slot);44014401+44024402+ nfsd4_construct_sequence_response(session, seq);44034403+44454404 status = check_slot_seqid(seq->seqid, slot->sl_seqid, slot->sl_flags);44464405 if (status == nfserr_replay_cache) {44474406 status = nfserr_seq_misordered;···45424495 }4543449645444497out:45454545- seq->maxslots = max(session->se_target_maxslots, seq->maxslots);45464546- seq->target_maxslots = session->se_target_maxslots;45474547-45484548- switch (clp->cl_cb_state) {45494549- case NFSD4_CB_DOWN:45504550- seq->status_flags = SEQ4_STATUS_CB_PATH_DOWN;45514551- break;45524552- case NFSD4_CB_FAULT:45534553- seq->status_flags = SEQ4_STATUS_BACKCHANNEL_FAULT;45544554- break;45554555- default:45564556- seq->status_flags = 0;45574557- }45584558- if (!list_empty(&clp->cl_revoked))45594559- seq->status_flags |= SEQ4_STATUS_RECALLABLE_STATE_REVOKED;45604560- if (atomic_read(&clp->cl_admin_revoked))45614561- seq->status_flags |= SEQ4_STATUS_ADMIN_STATE_REVOKED;45624498 trace_nfsd_seq4_status(rqstp, seq);45634499out_no_session:45644500 if (conn)
+2-3
fs/nfsd/nfs4xdr.c
···50735073 return nfserr;50745074 /* Note slotid's are numbered from zero: */50755075 /* sr_highest_slotid */50765076- nfserr = nfsd4_encode_slotid4(xdr, seq->maxslots - 1);50765076+ nfserr = nfsd4_encode_slotid4(xdr, seq->maxslots_response - 1);50775077 if (nfserr != nfs_ok)50785078 return nfserr;50795079 /* sr_target_highest_slotid */···59255925 */59265926 warn_on_nonidempotent_op(op);59275927 xdr_truncate_encode(xdr, op_status_offset + XDR_UNIT);59285928- }59295929- if (so) {59285928+ } else if (so) {59305929 int len = xdr->buf->len - (op_status_offset + XDR_UNIT);5931593059325931 so->so_replay.rp_status = op->status;
···290290 break;291291292292 case SMBDIRECT_SOCKET_CREATED:293293+ sc->status = SMBDIRECT_SOCKET_DISCONNECTED;294294+ break;295295+293296 case SMBDIRECT_SOCKET_CONNECTED:294297 sc->status = SMBDIRECT_SOCKET_ERROR;295298 break;
+1-1
fs/smb/client/transport.c
···830830 if (!server || server->terminate)831831 continue;832832833833- if (CIFS_CHAN_NEEDS_RECONNECT(ses, i))833833+ if (CIFS_CHAN_NEEDS_RECONNECT(ses, cur))834834 continue;835835836836 /*
+36-2
fs/smb/server/transport_rdma.c
···334334 break;335335336336 case SMBDIRECT_SOCKET_CREATED:337337+ sc->status = SMBDIRECT_SOCKET_DISCONNECTED;338338+ break;339339+337340 case SMBDIRECT_SOCKET_CONNECTED:338341 sc->status = SMBDIRECT_SOCKET_ERROR;339342 break;···18861883static int smb_direct_prepare_negotiation(struct smbdirect_socket *sc)18871884{18881885 struct smbdirect_recv_io *recvmsg;18861886+ bool recv_posted = false;18891887 int ret;1890188818911889 WARN_ON_ONCE(sc->status != SMBDIRECT_SOCKET_CREATED);···19031899 pr_err("Can't post recv: %d\n", ret);19041900 goto out_err;19051901 }19021902+ recv_posted = true;1906190319071904 ret = smb_direct_accept_client(sc);19081905 if (ret) {···1913190819141909 return 0;19151910out_err:19161916- put_recvmsg(sc, recvmsg);19111911+ /*19121912+ * If the recv was never posted, return it to the free list.19131913+ * If it was posted, leave it alone so disconnect teardown can19141914+ * drain the QP and complete it (flush) and the completion path19151915+ * will unmap it exactly once.19161916+ */19171917+ if (!recv_posted)19181918+ put_recvmsg(sc, recvmsg);19171919 return ret;19181920}19191921···26182606 }26192607}2620260826212621-bool ksmbd_rdma_capable_netdev(struct net_device *netdev)26092609+static bool ksmbd_find_rdma_capable_netdev(struct net_device *netdev)26222610{26232611 struct smb_direct_device *smb_dev;26242612 int i;···26582646 netdev->name, str_true_false(rdma_capable));2659264726602648 return rdma_capable;26492649+}26502650+26512651+bool ksmbd_rdma_capable_netdev(struct net_device *netdev)26522652+{26532653+ struct net_device *lower_dev;26542654+ struct list_head *iter;26552655+26562656+ if (ksmbd_find_rdma_capable_netdev(netdev))26572657+ return true;26582658+26592659+ /* check if netdev is bridge or VLAN */26602660+ if (netif_is_bridge_master(netdev) ||26612661+ netdev->priv_flags & IFF_802_1Q_VLAN)26622662+ netdev_for_each_lower_dev(netdev, lower_dev, iter)26632663+ if (ksmbd_find_rdma_capable_netdev(lower_dev))26642664+ return true;26652665+26662666+ /* check if netdev is IPoIB safely without layer violation */26672667+ if (netdev->type == ARPHRD_INFINIBAND)26682668+ return true;26692669+26702670+ return false;26612671}2662267226632673static const struct ksmbd_transport_ops ksmbd_smb_direct_transport_ops = {
+4-1
fs/smb/server/transport_tcp.c
···290290 }291291 }292292 up_read(&conn_list_lock);293293- if (ret == -EAGAIN)293293+ if (ret == -EAGAIN) {294294+ /* Per-IP limit hit: release the just-accepted socket. */295295+ sock_release(client_sk);294296 continue;297297+ }295298296299skip_max_ip_conns_limit:297300 if (server_conf.max_connections &&
···250250/*251251 * GCC does not warn about unused static inline functions for -Wunused-function.252252 * Suppress the warning in clang as well by using __maybe_unused, but enable it253253- * for W=1 build. This will allow clang to find unused functions. Remove the254254- * __inline_maybe_unused entirely after fixing most of -Wunused-function warnings.253253+ * for W=2 build. This will allow clang to find unused functions.255254 */256256-#ifdef KBUILD_EXTRA_WARN1255255+#ifdef KBUILD_EXTRA_WARN2257256#define __inline_maybe_unused258257#else259258#define __inline_maybe_unused __maybe_unused···458459# define __nocfi __attribute__((__no_sanitize__("kcfi")))459460#else460461# define __nocfi462462+#endif463463+464464+#if defined(CONFIG_ARCH_USES_CFI_GENERIC_LLVM_PASS)465465+# define __nocfi_generic __nocfi466466+#else467467+# define __nocfi_generic461468#endif462469463470/*
···3232 */3333static inline int arch_xfer_to_guest_mode_handle_work(unsigned long ti_work);34343535-#ifndef arch_xfer_to_guest_mode_work3535+#ifndef arch_xfer_to_guest_mode_handle_work3636static inline int arch_xfer_to_guest_mode_handle_work(unsigned long ti_work)3737{3838 return 0;
+1-1
include/linux/ethtool.h
···492492};493493494494#define ETHTOOL_MAX_LANES 8495495-/**495495+/*496496 * IEEE 802.3ck/df defines 16 bins for FEC histogram plus one more for497497 * the end-of-list marker, total 17 items498498 */
+20
include/linux/filter.h
···901901 cb->data_end = skb->data + skb_headlen(skb);902902}903903904904+static inline int bpf_prog_run_data_pointers(905905+ const struct bpf_prog *prog,906906+ struct sk_buff *skb)907907+{908908+ struct bpf_skb_data_end *cb = (struct bpf_skb_data_end *)skb->cb;909909+ void *save_data_meta, *save_data_end;910910+ int res;911911+912912+ save_data_meta = cb->data_meta;913913+ save_data_end = cb->data_end;914914+915915+ bpf_compute_data_pointers(skb);916916+ res = bpf_prog_run(prog, skb);917917+918918+ cb->data_meta = save_data_meta;919919+ cb->data_end = save_data_end;920920+921921+ return res;922922+}923923+904924/* Similar to bpf_compute_data_pointers(), except that save orginal905925 * data in cb->data and cb->meta_data for restore.906926 */
+9-1
include/linux/ftrace.h
···193193#if !defined(CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS) || \194194 defined(CONFIG_HAVE_FTRACE_REGS_HAVING_PT_REGS)195195196196+#ifndef arch_ftrace_partial_regs197197+#define arch_ftrace_partial_regs(regs) do {} while (0)198198+#endif199199+196200static __always_inline struct pt_regs *197201ftrace_partial_regs(struct ftrace_regs *fregs, struct pt_regs *regs)198202{···206202 * Since arch_ftrace_get_regs() will check some members and may return207203 * NULL, we can not use it.208204 */209209- return &arch_ftrace_regs(fregs)->regs;205205+ regs = &arch_ftrace_regs(fregs)->regs;206206+207207+ /* Allow arch specific updates to regs. */208208+ arch_ftrace_partial_regs(regs);209209+ return regs;210210}211211212212#endif /* !CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS || CONFIG_HAVE_FTRACE_REGS_HAVING_PT_REGS */
+3
include/linux/gfp.h
···77#include <linux/mmzone.h>88#include <linux/topology.h>99#include <linux/alloc_tag.h>1010+#include <linux/cleanup.h>1011#include <linux/sched.h>11121213struct vm_area_struct;···463462#endif464463/* This should be paired with folio_put() rather than free_contig_range(). */465464#define folio_alloc_gigantic(...) alloc_hooks(folio_alloc_gigantic_noprof(__VA_ARGS__))465465+466466+DEFINE_FREE(free_page, void *, free_page((unsigned long)_T))466467467468#endif /* __LINUX_GFP_H */
+23-32
include/linux/huge_mm.h
···376376int folio_split(struct folio *folio, unsigned int new_order, struct page *page,377377 struct list_head *list);378378/*379379- * try_folio_split - try to split a @folio at @page using non uniform split.379379+ * try_folio_split_to_order - try to split a @folio at @page to @new_order using380380+ * non uniform split.380381 * @folio: folio to be split381381- * @page: split to order-0 at the given page382382- * @list: store the after-split folios382382+ * @page: split to @new_order at the given page383383+ * @new_order: the target split order383384 *384384- * Try to split a @folio at @page using non uniform split to order-0, if385385- * non uniform split is not supported, fall back to uniform split.385385+ * Try to split a @folio at @page using non uniform split to @new_order, if386386+ * non uniform split is not supported, fall back to uniform split. After-split387387+ * folios are put back to LRU list. Use min_order_for_split() to get the lower388388+ * bound of @new_order.386389 *387390 * Return: 0: split is successful, otherwise split failed.388391 */389389-static inline int try_folio_split(struct folio *folio, struct page *page,390390- struct list_head *list)392392+static inline int try_folio_split_to_order(struct folio *folio,393393+ struct page *page, unsigned int new_order)391394{392392- int ret = min_order_for_split(folio);393393-394394- if (ret < 0)395395- return ret;396396-397397- if (!non_uniform_split_supported(folio, 0, false))398398- return split_huge_page_to_list_to_order(&folio->page, list,399399- ret);400400- return folio_split(folio, ret, page, list);395395+ if (!non_uniform_split_supported(folio, new_order, /* warns= */ false))396396+ return split_huge_page_to_list_to_order(&folio->page, NULL,397397+ new_order);398398+ return folio_split(folio, new_order, page, NULL);401399}402400static inline int split_huge_page(struct page *page)403401{404404- struct folio *folio = page_folio(page);405405- int ret = min_order_for_split(folio);406406-407407- if (ret < 0)408408- return ret;409409-410410- /*411411- * split_huge_page() locks the page before splitting and412412- * expects the same page that has been split to be locked when413413- * returned. split_folio(page_folio(page)) cannot be used here414414- * because it converts the page to folio and passes the head415415- * page to be split.416416- */417417- return split_huge_page_to_list_to_order(page, NULL, ret);402402+ return split_huge_page_to_list_to_order(page, NULL, 0);418403}419404void deferred_split_folio(struct folio *folio, bool partially_mapped);420405···582597 return -EINVAL;583598}584599600600+static inline int min_order_for_split(struct folio *folio)601601+{602602+ VM_WARN_ON_ONCE_FOLIO(1, folio);603603+ return -EINVAL;604604+}605605+585606static inline int split_folio_to_list(struct folio *folio, struct list_head *list)586607{587608 VM_WARN_ON_ONCE_FOLIO(1, folio);588609 return -EINVAL;589610}590611591591-static inline int try_folio_split(struct folio *folio, struct page *page,592592- struct list_head *list)612612+static inline int try_folio_split_to_order(struct folio *folio,613613+ struct page *page, unsigned int new_order)593614{594615 VM_WARN_ON_ONCE_FOLIO(1, folio);595616 return -EINVAL;
+1
include/linux/map_benchmark.h
···2727 __u32 dma_dir; /* DMA data direction */2828 __u32 dma_trans_ns; /* time for DMA transmission in ns */2929 __u32 granule; /* how many PAGE_SIZE will do map/unmap once a time */3030+ __u8 expansion[76]; /* For future use */3031};3132#endif /* _KERNEL_DMA_BENCHMARK_H */
···20742074 return folio_large_nr_pages(folio);20752075}2076207620772077-#if !defined(CONFIG_ARCH_HAS_GIGANTIC_PAGE)20772077+#if !defined(CONFIG_HAVE_GIGANTIC_FOLIOS)20782078/*20792079 * We don't expect any folios that exceed buddy sizes (and consequently20802080 * memory sections).···20872087 * pages are guaranteed to be contiguous.20882088 */20892089#define MAX_FOLIO_ORDER PFN_SECTION_SHIFT20902090-#else20902090+#elif defined(CONFIG_HUGETLB_PAGE)20912091/*20922092 * There is no real limit on the folio size. We limit them to the maximum we20932093- * currently expect (e.g., hugetlb, dax).20932093+ * currently expect (see CONFIG_HAVE_GIGANTIC_FOLIOS): with hugetlb, we expect20942094+ * no folios larger than 16 GiB on 64bit and 1 GiB on 32bit.20952095+ */20962096+#define MAX_FOLIO_ORDER get_order(IS_ENABLED(CONFIG_64BIT) ? SZ_16G : SZ_1G)20972097+#else20982098+/*20992099+ * Without hugetlb, gigantic folios that are bigger than a single PUD are21002100+ * currently impossible.20942101 */20952102#define MAX_FOLIO_ORDER PUD_ORDER20962103#endif
···412412 u16 l1ss; /* L1SS Capability pointer */413413#ifdef CONFIG_PCIEASPM414414 struct pcie_link_state *link_state; /* ASPM link state */415415+ unsigned int aspm_l0s_support:1; /* ASPM L0s support */416416+ unsigned int aspm_l1_support:1; /* ASPM L1 support */415417 unsigned int ltr_path:1; /* Latency Tolerance Reporting416418 supported from root to here */417419#endif
···64356435 * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can64366436 * use just cancel_work() instead of cancel_work_sync(), it requires64376437 * being in a section protected by wiphy_lock().64386438+ *64396439+ * Note that these are scheduled with a timer where the accuracy64406440+ * becomes less the longer in the future the scheduled timer is. Use64416441+ * wiphy_hrtimer_work_queue() if the timer must be not be late by more64426442+ * than approximately 10 percent.64386443 */64396444void wiphy_delayed_work_queue(struct wiphy *wiphy,64406445 struct wiphy_delayed_work *dwork,···65106505 */65116506bool wiphy_delayed_work_pending(struct wiphy *wiphy,65126507 struct wiphy_delayed_work *dwork);65086508+65096509+struct wiphy_hrtimer_work {65106510+ struct wiphy_work work;65116511+ struct wiphy *wiphy;65126512+ struct hrtimer timer;65136513+};65146514+65156515+enum hrtimer_restart wiphy_hrtimer_work_timer(struct hrtimer *t);65166516+65176517+static inline void wiphy_hrtimer_work_init(struct wiphy_hrtimer_work *hrwork,65186518+ wiphy_work_func_t func)65196519+{65206520+ hrtimer_setup(&hrwork->timer, wiphy_hrtimer_work_timer,65216521+ CLOCK_BOOTTIME, HRTIMER_MODE_REL);65226522+ wiphy_work_init(&hrwork->work, func);65236523+}65246524+65256525+/**65266526+ * wiphy_hrtimer_work_queue - queue hrtimer work for the wiphy65276527+ * @wiphy: the wiphy to queue for65286528+ * @hrwork: the high resolution timer worker65296529+ * @delay: the delay given as a ktime_t65306530+ *65316531+ * Please refer to wiphy_delayed_work_queue(). The difference is that65326532+ * the hrtimer work uses a high resolution timer for scheduling. This65336533+ * may be needed if timeouts might be scheduled further in the future65346534+ * and the accuracy of the normal timer is not sufficient.65356535+ *65366536+ * Expect a delay of a few milliseconds as the timer is scheduled65376537+ * with some slack and some more time may pass between queueing the65386538+ * work and its start.65396539+ */65406540+void wiphy_hrtimer_work_queue(struct wiphy *wiphy,65416541+ struct wiphy_hrtimer_work *hrwork,65426542+ ktime_t delay);65436543+65446544+/**65456545+ * wiphy_hrtimer_work_cancel - cancel previously queued hrtimer work65466546+ * @wiphy: the wiphy, for debug purposes65476547+ * @hrtimer: the hrtimer work to cancel65486548+ *65496549+ * Cancel the work *without* waiting for it, this assumes being65506550+ * called under the wiphy mutex acquired by wiphy_lock().65516551+ */65526552+void wiphy_hrtimer_work_cancel(struct wiphy *wiphy,65536553+ struct wiphy_hrtimer_work *hrtimer);65546554+65556555+/**65566556+ * wiphy_hrtimer_work_flush - flush previously queued hrtimer work65576557+ * @wiphy: the wiphy, for debug purposes65586558+ * @hrwork: the hrtimer work to flush65596559+ *65606560+ * Flush the work (i.e. run it if pending). This must be called65616561+ * under the wiphy mutex acquired by wiphy_lock().65626562+ */65636563+void wiphy_hrtimer_work_flush(struct wiphy *wiphy,65646564+ struct wiphy_hrtimer_work *hrwork);65656565+65666566+/**65676567+ * wiphy_hrtimer_work_pending - Find out whether a wiphy hrtimer65686568+ * work item is currently pending.65696569+ *65706570+ * @wiphy: the wiphy, for debug purposes65716571+ * @hrwork: the hrtimer work in question65726572+ *65736573+ * Return: true if timer is pending, false otherwise65746574+ *65756575+ * Please refer to the wiphy_delayed_work_pending() documentation as65766576+ * this is the equivalent function for hrtimer based delayed work65776577+ * items.65786578+ */65796579+bool wiphy_hrtimer_work_pending(struct wiphy *wiphy,65806580+ struct wiphy_hrtimer_work *hrwork);6513658165146582/**65156583 * enum ieee80211_ap_reg_power - regulatory power for an Access Point
+1-1
include/net/libeth/xdp.h
···513513 * can't fail, but can send less frames if there's no enough free descriptors514514 * available. The actual free space is returned by @prep from the driver.515515 */516516-static __always_inline u32516516+static __always_inline __nocfi_generic u32517517libeth_xdp_tx_xmit_bulk(const struct libeth_xdp_tx_frame *bulk, void *xdpsq,518518 u32 n, bool unroll, u64 priv,519519 u32 (*prep)(void *xdpsq, struct libeth_xdpsq *sq),
+15-8
include/uapi/drm/drm_fourcc.h
···979979 * 2 = Gob Height 8, Turing+ Page Kind mapping980980 * 3 = Reserved for future use.981981 *982982- * 22:22 s Sector layout. On Tegra GPUs prior to Xavier, there is a further983983- * bit remapping step that occurs at an even lower level than the984984- * page kind and block linear swizzles. This causes the layout of985985- * surfaces mapped in those SOC's GPUs to be incompatible with the986986- * equivalent mapping on other GPUs in the same system.982982+ * 22:22 s Sector layout. There is a further bit remapping step that occurs983983+ * 26:27 at an even lower level than the page kind and block linear984984+ * swizzles. This causes the bit arrangement of surfaces in memory985985+ * to differ subtly, and prevents direct sharing of surfaces between986986+ * GPUs with different layouts.987987 *988988- * 0 = Tegra K1 - Tegra Parker/TX2 Layout.989989- * 1 = Desktop GPU and Tegra Xavier+ Layout988988+ * 0 = Tegra K1 - Tegra Parker/TX2 Layout989989+ * 1 = Pre-GB20x, GB20x 32+ bpp, GB10, Tegra Xavier-Orin Layout990990+ * 2 = GB20x(Blackwell 2)+ 8 bpp surface layout991991+ * 3 = GB20x(Blackwell 2)+ 16 bpp surface layout992992+ * 4 = Reserved for future use.993993+ * 5 = Reserved for future use.994994+ * 6 = Reserved for future use.995995+ * 7 = Reserved for future use.990996 *991997 * 25:23 c Lossless Framebuffer Compression type.992998 *···10071001 * 6 = Reserved for future use10081002 * 7 = Reserved for future use10091003 *10101010- * 55:25 - Reserved for future use. Must be zero.10041004+ * 55:28 - Reserved for future use. Must be zero.10111005 */10121006#define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \10131007 fourcc_mod_code(NVIDIA, (0x10 | \···10151009 (((k) & 0xff) << 12) | \10161010 (((g) & 0x3) << 20) | \10171011 (((s) & 0x1) << 22) | \10121012+ (((s) & 0x6) << 25) | \10181013 (((c) & 0x7) << 23)))1019101410201015/* To grandfather in prior block linear format modifiers to the above layout,
+12
include/uapi/linux/input-event-codes.h
···631631#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */632632#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */633633634634+/*635635+ * Keycodes for hotkeys toggling the electronic privacy screen found on some636636+ * laptops on/off. Note when the embedded-controller turns on/off the eprivacy637637+ * screen itself then the state should be reported through drm connecter props:638638+ * https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties639639+ * Except when implementing the drm connecter properties API is not possible640640+ * because e.g. the firmware does not allow querying the presence and/or status641641+ * of the eprivacy screen at boot.642642+ */643643+#define KEY_EPRIVACY_SCREEN_ON 0x252644644+#define KEY_EPRIVACY_SCREEN_OFF 0x253645645+634646#define KEY_KBDINPUTASSIST_PREV 0x260635647#define KEY_KBDINPUTASSIST_NEXT 0x261636648#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
-12
include/uapi/linux/io_uring.h
···689689 /* query various aspects of io_uring, see linux/io_uring/query.h */690690 IORING_REGISTER_QUERY = 35,691691692692- /* return zcrx buffers back into circulation */693693- IORING_REGISTER_ZCRX_REFILL = 36,694694-695692 /* this goes last */696693 IORING_REGISTER_LAST,697694···10681071 __u32 zcrx_id;10691072 __u32 __resv2;10701073 __u64 __resv[3];10711071-};10721072-10731073-struct io_uring_zcrx_sync_refill {10741074- __u32 zcrx_id;10751075- /* the number of entries to return */10761076- __u32 nr_entries;10771077- /* pointer to an array of struct io_uring_zcrx_rqe */10781078- __u64 rqes;10791079- __u64 __resv[2];10801074};1081107510821076#ifdef __cplusplus
+3
include/uapi/linux/io_uring/query.h
···3636 __u64 enter_flags;3737 /* Bitmask of all supported IOSQE_* flags */3838 __u64 sqe_flags;3939+ /* The number of available query opcodes */4040+ __u32 nr_query_opcodes;4141+ __u32 __pad;3942};40434144#endif
···688688 * single doorbell mode.689689 */690690 UFSHCD_QUIRK_BROKEN_LSDBS_CAP = 1 << 25,691691+692692+ /*693693+ * This quirk indicates that DME_LINKSTARTUP should not be issued a 2nd694694+ * time (refer link_startup_again) after the 1st time was successful,695695+ * because it causes link startup to become unreliable.696696+ */697697+ UFSHCD_QUIRK_PERFORM_LINK_STARTUP_ONCE = 1 << 26,691698};692699693700enum ufshcd_caps {
+1-1
io_uring/memmap.c
···135135 struct io_mapped_region *mr,136136 struct io_uring_region_desc *reg)137137{138138- unsigned long size = mr->nr_pages << PAGE_SHIFT;138138+ unsigned long size = (size_t) mr->nr_pages << PAGE_SHIFT;139139 struct page **pages;140140 int nr_pages;141141
···827827 case IORING_REGISTER_QUERY:828828 ret = io_query(ctx, arg, nr_args);829829 break;830830- case IORING_REGISTER_ZCRX_REFILL:831831- ret = io_zcrx_return_bufs(ctx, arg, nr_args);832832- break;833830 default:834831 ret = -EINVAL;835832 break;
+18-9
io_uring/rsrc.c
···943943 struct req_iterator rq_iter;944944 struct io_mapped_ubuf *imu;945945 struct io_rsrc_node *node;946946- struct bio_vec bv, *bvec;947947- u16 nr_bvecs;946946+ struct bio_vec bv;947947+ unsigned int nr_bvecs = 0;948948 int ret = 0;949949950950 io_ring_submit_lock(ctx, issue_flags);···965965 goto unlock;966966 }967967968968- nr_bvecs = blk_rq_nr_phys_segments(rq);969969- imu = io_alloc_imu(ctx, nr_bvecs);968968+ /*969969+ * blk_rq_nr_phys_segments() may overestimate the number of bvecs970970+ * but avoids needing to iterate over the bvecs971971+ */972972+ imu = io_alloc_imu(ctx, blk_rq_nr_phys_segments(rq));970973 if (!imu) {971974 kfree(node);972975 ret = -ENOMEM;···980977 imu->len = blk_rq_bytes(rq);981978 imu->acct_pages = 0;982979 imu->folio_shift = PAGE_SHIFT;983983- imu->nr_bvecs = nr_bvecs;984980 refcount_set(&imu->refs, 1);985981 imu->release = release;986982 imu->priv = rq;987983 imu->is_kbuf = true;988984 imu->dir = 1 << rq_data_dir(rq);989985990990- bvec = imu->bvec;991986 rq_for_each_bvec(bv, rq, rq_iter)992992- *bvec++ = bv;987987+ imu->bvec[nr_bvecs++] = bv;988988+ imu->nr_bvecs = nr_bvecs;993989994990 node->buf = imu;995991 data->nodes[index] = node;···14051403 size_t max_segs = 0;14061404 unsigned i;1407140514081408- for (i = 0; i < nr_iovs; i++)14061406+ for (i = 0; i < nr_iovs; i++) {14091407 max_segs += (iov[i].iov_len >> shift) + 2;14081408+ if (max_segs > INT_MAX)14091409+ return -EOVERFLOW;14101410+ }14101411 return max_segs;14111412}14121413···15151510 if (unlikely(ret))15161511 return ret;15171512 } else {15181518- nr_segs = io_estimate_bvec_size(iov, nr_iovs, imu);15131513+ int ret = io_estimate_bvec_size(iov, nr_iovs, imu);15141514+15151515+ if (ret < 0)15161516+ return ret;15171517+ nr_segs = ret;15191518 }1520151915211520 if (sizeof(struct bio_vec) > sizeof(struct iovec)) {
···109109 to keep data or state alive across the kexec. For this to work,110110 both source and target kernels need to have this option enabled.111111112112+config KEXEC_HANDOVER_DEBUG113113+ bool "Enable Kexec Handover debug checks"114114+ depends on KEXEC_HANDOVER115115+ help116116+ This option enables extra sanity checks for the Kexec Handover117117+ subsystem. Since, KHO performance is crucial in live update118118+ scenarios and the extra code might be adding overhead it is119119+ only optionally enabled.120120+112121config CRASH_DUMP113122 bool "kernel crash dumps"114123 default ARCH_DEFAULT_CRASH_DUMP
···41694169}4170417041714171/**41724172- * bpf_task_work_schedule_signal - Schedule BPF callback using task_work_add with TWA_SIGNAL mode41724172+ * bpf_task_work_schedule_signal_impl - Schedule BPF callback using task_work_add with TWA_SIGNAL41734173+ * mode41734174 * @task: Task struct for which callback should be scheduled41744175 * @tw: Pointer to struct bpf_task_work in BPF map value for internal bookkeeping41754176 * @map__map: bpf_map that embeds struct bpf_task_work in the values···41794178 *41804179 * Return: 0 if task work has been scheduled successfully, negative error code otherwise41814180 */41824182-__bpf_kfunc int bpf_task_work_schedule_signal(struct task_struct *task, struct bpf_task_work *tw,41834183- void *map__map, bpf_task_work_callback_t callback,41844184- void *aux__prog)41814181+__bpf_kfunc int bpf_task_work_schedule_signal_impl(struct task_struct *task,41824182+ struct bpf_task_work *tw, void *map__map,41834183+ bpf_task_work_callback_t callback,41844184+ void *aux__prog)41854185{41864186 return bpf_task_work_schedule(task, tw, map__map, callback, aux__prog, TWA_SIGNAL);41874187}4188418841894189/**41904190- * bpf_task_work_schedule_resume - Schedule BPF callback using task_work_add with TWA_RESUME mode41904190+ * bpf_task_work_schedule_resume_impl - Schedule BPF callback using task_work_add with TWA_RESUME41914191+ * mode41914192 * @task: Task struct for which callback should be scheduled41924193 * @tw: Pointer to struct bpf_task_work in BPF map value for internal bookkeeping41934194 * @map__map: bpf_map that embeds struct bpf_task_work in the values···41984195 *41994196 * Return: 0 if task work has been scheduled successfully, negative error code otherwise42004197 */42014201-__bpf_kfunc int bpf_task_work_schedule_resume(struct task_struct *task, struct bpf_task_work *tw,42024202- void *map__map, bpf_task_work_callback_t callback,42034203- void *aux__prog)41984198+__bpf_kfunc int bpf_task_work_schedule_resume_impl(struct task_struct *task,41994199+ struct bpf_task_work *tw, void *map__map,42004200+ bpf_task_work_callback_t callback,42014201+ void *aux__prog)42044202{42054203 return bpf_task_work_schedule(task, tw, map__map, callback, aux__prog, TWA_RESUME);42064204}···43804376#if defined(CONFIG_BPF_LSM) && defined(CONFIG_CGROUPS)43814377BTF_ID_FLAGS(func, bpf_cgroup_read_xattr, KF_RCU)43824378#endif43834383-BTF_ID_FLAGS(func, bpf_stream_vprintk, KF_TRUSTED_ARGS)43844384-BTF_ID_FLAGS(func, bpf_task_work_schedule_signal, KF_TRUSTED_ARGS)43854385-BTF_ID_FLAGS(func, bpf_task_work_schedule_resume, KF_TRUSTED_ARGS)43794379+BTF_ID_FLAGS(func, bpf_stream_vprintk_impl, KF_TRUSTED_ARGS)43804380+BTF_ID_FLAGS(func, bpf_task_work_schedule_signal_impl, KF_TRUSTED_ARGS)43814381+BTF_ID_FLAGS(func, bpf_task_work_schedule_resume_impl, KF_TRUSTED_ARGS)43864382BTF_KFUNCS_END(common_btf_ids)4387438343884384static const struct btf_kfunc_id_set common_kfunc_set = {
+2-1
kernel/bpf/stream.c
···355355 * Avoid using enum bpf_stream_id so that kfunc users don't have to pull in the356356 * enum in headers.357357 */358358-__bpf_kfunc int bpf_stream_vprintk(int stream_id, const char *fmt__str, const void *args, u32 len__sz, void *aux__prog)358358+__bpf_kfunc int bpf_stream_vprintk_impl(int stream_id, const char *fmt__str, const void *args,359359+ u32 len__sz, void *aux__prog)359360{360361 struct bpf_bprintf_data data = {361362 .get_bin_args = true,
-5
kernel/bpf/trampoline.c
···479479 * BPF_TRAMP_F_SHARE_IPMODIFY is set, we can generate the480480 * trampoline again, and retry register.481481 */482482- /* reset fops->func and fops->trampoline for re-register */483483- tr->fops->func = NULL;484484- tr->fops->trampoline = 0;485485-486486- /* free im memory and reallocate later */487482 bpf_tramp_image_free(im);488483 goto again;489484 }
+10-8
kernel/bpf/verifier.c
···88668866 struct bpf_verifier_state *cur)88678867{88688868 struct bpf_func_state *fold, *fcur;88698869- int i, fr;88698869+ int i, fr, num_slots;8870887088718871 reset_idmap_scratch(env);88728872 for (fr = old->curframe; fr >= 0; fr--) {···88798879 &fcur->regs[i],88808880 &env->idmap_scratch);8881888188828882- for (i = 0; i < fold->allocated_stack / BPF_REG_SIZE; i++) {88828882+ num_slots = min(fold->allocated_stack / BPF_REG_SIZE,88838883+ fcur->allocated_stack / BPF_REG_SIZE);88848884+ for (i = 0; i < num_slots; i++) {88838885 if (!is_spilled_reg(&fold->stack[i]) ||88848886 !is_spilled_reg(&fcur->stack[i]))88858887 continue;···1226112259 KF_bpf_res_spin_lock_irqsave,1226212260 KF_bpf_res_spin_unlock_irqrestore,1226312261 KF___bpf_trap,1226412264- KF_bpf_task_work_schedule_signal,1226512265- KF_bpf_task_work_schedule_resume,1226212262+ KF_bpf_task_work_schedule_signal_impl,1226312263+ KF_bpf_task_work_schedule_resume_impl,1226612264};12267122651226812266BTF_ID_LIST(special_kfunc_list)···1233312331BTF_ID(func, bpf_res_spin_lock_irqsave)1233412332BTF_ID(func, bpf_res_spin_unlock_irqrestore)1233512333BTF_ID(func, __bpf_trap)1233612336-BTF_ID(func, bpf_task_work_schedule_signal)1233712337-BTF_ID(func, bpf_task_work_schedule_resume)1233412334+BTF_ID(func, bpf_task_work_schedule_signal_impl)1233512335+BTF_ID(func, bpf_task_work_schedule_resume_impl)12338123361233912337static bool is_task_work_add_kfunc(u32 func_id)1234012338{1234112341- return func_id == special_kfunc_list[KF_bpf_task_work_schedule_signal] ||1234212342- func_id == special_kfunc_list[KF_bpf_task_work_schedule_resume];1233912339+ return func_id == special_kfunc_list[KF_bpf_task_work_schedule_signal_impl] ||1234012340+ func_id == special_kfunc_list[KF_bpf_task_work_schedule_resume_impl];1234312341}12344123421234512343static bool is_kfunc_ret_null(struct bpf_kfunc_call_arg_meta *meta)
···11773117731177411774 event = container_of(hrtimer, struct perf_event, hw.hrtimer);11775117751177611776- if (event->state != PERF_EVENT_STATE_ACTIVE)1177611776+ if (event->state != PERF_EVENT_STATE_ACTIVE ||1177711777+ event->hw.state & PERF_HES_STOPPED)1177711778 return HRTIMER_NORESTART;11778117791177911780 event->pmu->read(event);···1182011819 struct hw_perf_event *hwc = &event->hw;11821118201182211821 /*1182311823- * The throttle can be triggered in the hrtimer handler.1182411824- * The HRTIMER_NORESTART should be used to stop the timer,1182511825- * rather than hrtimer_cancel(). See perf_swevent_hrtimer()1182211822+ * Careful: this function can be triggered in the hrtimer handler,1182311823+ * for cpu-clock events, so hrtimer_cancel() would cause a1182411824+ * deadlock.1182511825+ *1182611826+ * So use hrtimer_try_to_cancel() to try to stop the hrtimer,1182711827+ * and the cpu-clock handler also sets the PERF_HES_STOPPED flag,1182811828+ * which guarantees that perf_swevent_hrtimer() will stop the1182911829+ * hrtimer once it sees the PERF_HES_STOPPED flag.1182611830 */1182711831 if (is_sampling_event(event) && (hwc->interrupts != MAX_INTERRUPTS)) {1182811832 ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);1182911833 local64_set(&hwc->period_left, ktime_to_ns(remaining));11830118341183111831- hrtimer_cancel(&hwc->hrtimer);1183511835+ hrtimer_try_to_cancel(&hwc->hrtimer);1183211836 }1183311837}1183411838···11877118711187811872static void cpu_clock_event_start(struct perf_event *event, int flags)1187911873{1187411874+ event->hw.state = 0;1188011875 local64_set(&event->hw.prev_count, local_clock());1188111876 perf_swevent_start_hrtimer(event);1188211877}11883118781188411879static void cpu_clock_event_stop(struct perf_event *event, int flags)1188511880{1188111881+ event->hw.state = PERF_HES_STOPPED;1188611882 perf_swevent_cancel_hrtimer(event);1188711883 if (flags & PERF_EF_UPDATE)1188811884 cpu_clock_event_update(event);···11958119501195911951static void task_clock_event_start(struct perf_event *event, int flags)1196011952{1195311953+ event->hw.state = 0;1196111954 local64_set(&event->hw.prev_count, event->ctx->time);1196211955 perf_swevent_start_hrtimer(event);1196311956}11964119571196511958static void task_clock_event_stop(struct perf_event *event, int flags)1196611959{1196011960+ event->hw.state = PERF_HES_STOPPED;1196711961 perf_swevent_cancel_hrtimer(event);1196811962 if (flags & PERF_EF_UPDATE)1196911963 task_clock_event_update(event, event->ctx->time);
···8899#define pr_fmt(fmt) "KHO: " fmt10101111+#include <linux/cleanup.h>1112#include <linux/cma.h>1213#include <linux/count_zeros.h>1314#include <linux/debugfs.h>···23222423#include <asm/early_ioremap.h>25242525+#include "kexec_handover_internal.h"2626/*2727 * KHO is tightly coupled with mm init and needs access to some of mm2828 * internal APIs.···6967 * Keep track of memory that is to be preserved across KHO.7068 *7169 * The serializing side uses two levels of xarrays to manage chunks of per-order7272- * 512 byte bitmaps. For instance if PAGE_SIZE = 4096, the entire 1G order of a7373- * 1TB system would fit inside a single 512 byte bitmap. For order 0 allocations7474- * each bitmap will cover 16M of address space. Thus, for 16G of memory at most7575- * 512K of bitmap memory will be needed for order 0.7070+ * PAGE_SIZE byte bitmaps. For instance if PAGE_SIZE = 4096, the entire 1G order7171+ * of a 8TB system would fit inside a single 4096 byte bitmap. For order 07272+ * allocations each bitmap will cover 128M of address space. Thus, for 16G of7373+ * memory at most 512K of bitmap memory will be needed for order 0.7674 *7775 * This approach is fully incremental, as the serialization progresses folios7876 * can continue be aggregated to the tracker. The final step, immediately prior···8078 * successor kernel to parse.8179 */82808383-#define PRESERVE_BITS (512 * 8)8181+#define PRESERVE_BITS (PAGE_SIZE * 8)84828583struct kho_mem_phys_bits {8684 DECLARE_BITMAP(preserve, PRESERVE_BITS);8785};8686+8787+static_assert(sizeof(struct kho_mem_phys_bits) == PAGE_SIZE);88888989struct kho_mem_phys {9090 /*···135131 .finalized = false,136132};137133138138-static void *xa_load_or_alloc(struct xarray *xa, unsigned long index, size_t sz)134134+static void *xa_load_or_alloc(struct xarray *xa, unsigned long index)139135{140140- void *elm, *res;136136+ void *res = xa_load(xa, index);141137142142- elm = xa_load(xa, index);143143- if (elm)144144- return elm;138138+ if (res)139139+ return res;145140146146- elm = kzalloc(sz, GFP_KERNEL);141141+ void *elm __free(free_page) = (void *)get_zeroed_page(GFP_KERNEL);142142+147143 if (!elm)148144 return ERR_PTR(-ENOMEM);149145146146+ if (WARN_ON(kho_scratch_overlap(virt_to_phys(elm), PAGE_SIZE)))147147+ return ERR_PTR(-EINVAL);148148+150149 res = xa_cmpxchg(xa, index, NULL, elm, GFP_KERNEL);151150 if (xa_is_err(res))152152- res = ERR_PTR(xa_err(res));153153-154154- if (res) {155155- kfree(elm);151151+ return ERR_PTR(xa_err(res));152152+ else if (res)156153 return res;157157- }158154159159- return elm;155155+ return no_free_ptr(elm);160156}161157162158static void __kho_unpreserve(struct kho_mem_track *track, unsigned long pfn,···171167 const unsigned long pfn_high = pfn >> order;172168173169 physxa = xa_load(&track->orders, order);174174- if (!physxa)175175- continue;170170+ if (WARN_ON_ONCE(!physxa))171171+ return;176172177173 bits = xa_load(&physxa->phys_bits, pfn_high / PRESERVE_BITS);178178- if (!bits)179179- continue;174174+ if (WARN_ON_ONCE(!bits))175175+ return;180176181177 clear_bit(pfn_high % PRESERVE_BITS, bits->preserve);182178···220216 }221217 }222218223223- bits = xa_load_or_alloc(&physxa->phys_bits, pfn_high / PRESERVE_BITS,224224- sizeof(*bits));219219+ bits = xa_load_or_alloc(&physxa->phys_bits, pfn_high / PRESERVE_BITS);225220 if (IS_ERR(bits))226221 return PTR_ERR(bits);227222···348345static struct khoser_mem_chunk *new_chunk(struct khoser_mem_chunk *cur_chunk,349346 unsigned long order)350347{351351- struct khoser_mem_chunk *chunk;348348+ struct khoser_mem_chunk *chunk __free(free_page) = NULL;352349353353- chunk = kzalloc(PAGE_SIZE, GFP_KERNEL);350350+ chunk = (void *)get_zeroed_page(GFP_KERNEL);354351 if (!chunk)355355- return NULL;352352+ return ERR_PTR(-ENOMEM);353353+354354+ if (WARN_ON(kho_scratch_overlap(virt_to_phys(chunk), PAGE_SIZE)))355355+ return ERR_PTR(-EINVAL);356356+356357 chunk->hdr.order = order;357358 if (cur_chunk)358359 KHOSER_STORE_PTR(cur_chunk->hdr.next, chunk);359359- return chunk;360360+ return no_free_ptr(chunk);360361}361362362363static void kho_mem_ser_free(struct khoser_mem_chunk *first_chunk)···381374 struct khoser_mem_chunk *chunk = NULL;382375 struct kho_mem_phys *physxa;383376 unsigned long order;377377+ int err = -ENOMEM;384378385379 xa_for_each(&ser->track.orders, order, physxa) {386380 struct kho_mem_phys_bits *bits;387381 unsigned long phys;388382389383 chunk = new_chunk(chunk, order);390390- if (!chunk)384384+ if (IS_ERR(chunk)) {385385+ err = PTR_ERR(chunk);391386 goto err_free;387387+ }392388393389 if (!first_chunk)394390 first_chunk = chunk;···401391402392 if (chunk->hdr.num_elms == ARRAY_SIZE(chunk->bitmaps)) {403393 chunk = new_chunk(chunk, order);404404- if (!chunk)394394+ if (IS_ERR(chunk)) {395395+ err = PTR_ERR(chunk);405396 goto err_free;397397+ }406398 }407399408400 elm = &chunk->bitmaps[chunk->hdr.num_elms];···421409422410err_free:423411 kho_mem_ser_free(first_chunk);424424- return -ENOMEM;412412+ return err;425413}426414427415static void __init deserialize_bitmap(unsigned int order,···477465 * area for early allocations that happen before page allocator is478466 * initialized.479467 */480480-static struct kho_scratch *kho_scratch;481481-static unsigned int kho_scratch_cnt;468468+struct kho_scratch *kho_scratch;469469+unsigned int kho_scratch_cnt;482470483471/*484472 * The scratch areas are scaled by default as percent of memory allocated from···764752 const unsigned int order = folio_order(folio);765753 struct kho_mem_track *track = &kho_out.ser.track;766754755755+ if (WARN_ON(kho_scratch_overlap(pfn << PAGE_SHIFT, PAGE_SIZE << order)))756756+ return -EINVAL;757757+767758 return __kho_preserve_order(track, pfn, order);768759}769760EXPORT_SYMBOL_GPL(kho_preserve_folio);···789774 unsigned long pfn = start_pfn;790775 unsigned long failed_pfn = 0;791776 int err = 0;777777+778778+ if (WARN_ON(kho_scratch_overlap(start_pfn << PAGE_SHIFT,779779+ nr_pages << PAGE_SHIFT))) {780780+ return -EINVAL;781781+ }792782793783 while (pfn < end_pfn) {794784 const unsigned int order =···882862 return NULL;883863}884864885885-static void kho_vmalloc_unpreserve_chunk(struct kho_vmalloc_chunk *chunk)865865+static void kho_vmalloc_unpreserve_chunk(struct kho_vmalloc_chunk *chunk,866866+ unsigned short order)886867{887868 struct kho_mem_track *track = &kho_out.ser.track;888869 unsigned long pfn = PHYS_PFN(virt_to_phys(chunk));889870890871 __kho_unpreserve(track, pfn, pfn + 1);891872892892- for (int i = 0; chunk->phys[i]; i++) {873873+ for (int i = 0; i < ARRAY_SIZE(chunk->phys) && chunk->phys[i]; i++) {893874 pfn = PHYS_PFN(chunk->phys[i]);894894- __kho_unpreserve(track, pfn, pfn + 1);875875+ __kho_unpreserve(track, pfn, pfn + (1 << order));895876 }896877}897878···903882 while (chunk) {904883 struct kho_vmalloc_chunk *tmp = chunk;905884906906- kho_vmalloc_unpreserve_chunk(chunk);885885+ kho_vmalloc_unpreserve_chunk(chunk, kho_vmalloc->order);907886908887 chunk = KHOSER_LOAD_PTR(chunk->hdr.next);909888 free_page((unsigned long)tmp);···1013992 while (chunk) {1014993 struct page *page;101599410161016- for (int i = 0; chunk->phys[i]; i++) {995995+ for (int i = 0; i < ARRAY_SIZE(chunk->phys) && chunk->phys[i]; i++) {1017996 phys_addr_t phys = chunk->phys[i];10189971019998 if (idx + contig_pages > total_pages)
···60246024 struct sched_entity *se = cfs_rq->tg->se[cpu_of(rq)];6025602560266026 /*60276027- * It's possible we are called with !runtime_remaining due to things60286028- * like user changed quota setting(see tg_set_cfs_bandwidth()) or async60296029- * unthrottled us with a positive runtime_remaining but other still60306030- * running entities consumed those runtime before we reached here.60276027+ * It's possible we are called with runtime_remaining < 0 due to things60286028+ * like async unthrottled us with a positive runtime_remaining but other60296029+ * still running entities consumed those runtime before we reached here.60316030 *60326032- * Anyway, we can't unthrottle this cfs_rq without any runtime remaining60336033- * because any enqueue in tg_unthrottle_up() will immediately trigger a60346034- * throttle, which is not supposed to happen on unthrottle path.60316031+ * We can't unthrottle this cfs_rq without any runtime remaining because60326032+ * any enqueue in tg_unthrottle_up() will immediately trigger a throttle,60336033+ * which is not supposed to happen on unthrottle path.60356034 */60366035 if (cfs_rq->runtime_enabled && cfs_rq->runtime_remaining <= 0)60376036 return;60386038-60396039- se = cfs_rq->tg->se[cpu_of(rq)];6040603760416038 cfs_rq->throttled = 0;60426039
+6-6
kernel/time/posix-timers.c
···475475 if (!kc->timer_create)476476 return -EOPNOTSUPP;477477478478- new_timer = alloc_posix_timer();479479- if (unlikely(!new_timer))480480- return -EAGAIN;481481-482482- spin_lock_init(&new_timer->it_lock);483483-484478 /* Special case for CRIU to restore timers with a given timer ID. */485479 if (unlikely(current->signal->timer_create_restore_ids)) {486480 if (copy_from_user(&req_id, created_timer_id, sizeof(req_id)))···483489 if ((unsigned int)req_id > INT_MAX)484490 return -EINVAL;485491 }492492+493493+ new_timer = alloc_posix_timer();494494+ if (unlikely(!new_timer))495495+ return -EAGAIN;496496+497497+ spin_lock_init(&new_timer->it_lock);486498487499 /*488500 * Add the timer to the hash table. The timer is not yet valid
+45-15
kernel/trace/ftrace.c
···19711971 */19721972static int __ftrace_hash_update_ipmodify(struct ftrace_ops *ops,19731973 struct ftrace_hash *old_hash,19741974- struct ftrace_hash *new_hash)19741974+ struct ftrace_hash *new_hash,19751975+ bool update_target)19751976{19761977 struct ftrace_page *pg;19771978 struct dyn_ftrace *rec, *end = NULL;···20072006 if (rec->flags & FTRACE_FL_DISABLED)20082007 continue;2009200820102010- /* We need to update only differences of filter_hash */20092009+ /*20102010+ * Unless we are updating the target of a direct function,20112011+ * we only need to update differences of filter_hash20122012+ */20112013 in_old = !!ftrace_lookup_ip(old_hash, rec->ip);20122014 in_new = !!ftrace_lookup_ip(new_hash, rec->ip);20132013- if (in_old == in_new)20152015+ if (!update_target && (in_old == in_new))20142016 continue;2015201720162018 if (in_new) {···20242020 if (is_ipmodify)20252021 goto rollback;2026202220272027- FTRACE_WARN_ON(rec->flags & FTRACE_FL_DIRECT);20232023+ /*20242024+ * If this is called by __modify_ftrace_direct()20252025+ * then it is only changing where the direct20262026+ * pointer is jumping to, and the record already20272027+ * points to a direct trampoline. If it isn't,20282028+ * then it is a bug to update ipmodify on a direct20292029+ * caller.20302030+ */20312031+ FTRACE_WARN_ON(!update_target &&20322032+ (rec->flags & FTRACE_FL_DIRECT));2028203320292034 /*20302035 * Another ops with IPMODIFY is already···20892076 if (ftrace_hash_empty(hash))20902077 hash = NULL;2091207820922092- return __ftrace_hash_update_ipmodify(ops, EMPTY_HASH, hash);20792079+ return __ftrace_hash_update_ipmodify(ops, EMPTY_HASH, hash, false);20932080}2094208120952082/* Disabling always succeeds */···21002087 if (ftrace_hash_empty(hash))21012088 hash = NULL;2102208921032103- __ftrace_hash_update_ipmodify(ops, hash, EMPTY_HASH);20902090+ __ftrace_hash_update_ipmodify(ops, hash, EMPTY_HASH, false);21042091}2105209221062093static int ftrace_hash_ipmodify_update(struct ftrace_ops *ops,···21142101 if (ftrace_hash_empty(new_hash))21152102 new_hash = NULL;2116210321172117- return __ftrace_hash_update_ipmodify(ops, old_hash, new_hash);21042104+ return __ftrace_hash_update_ipmodify(ops, old_hash, new_hash, false);21182105}2119210621202107static void print_ip_ins(const char *fmt, const unsigned char *p)···59665953 free_ftrace_hash(fhp);59675954}5968595559565956+static void reset_direct(struct ftrace_ops *ops, unsigned long addr)59575957+{59585958+ struct ftrace_hash *hash = ops->func_hash->filter_hash;59595959+59605960+ remove_direct_functions_hash(hash, addr);59615961+59625962+ /* cleanup for possible another register call */59635963+ ops->func = NULL;59645964+ ops->trampoline = 0;59655965+}59665966+59695967/**59705968 * register_ftrace_direct - Call a custom trampoline directly59715969 * for multiple functions registered in @ops···60726048 ops->direct_call = addr;6073604960746050 err = register_ftrace_function_nolock(ops);60516051+ if (err)60526052+ reset_direct(ops, addr);6075605360766054 out_unlock:60776055 mutex_unlock(&direct_mutex);···61066080int unregister_ftrace_direct(struct ftrace_ops *ops, unsigned long addr,61076081 bool free_filters)61086082{61096109- struct ftrace_hash *hash = ops->func_hash->filter_hash;61106083 int err;6111608461126085 if (check_direct_multi(ops))···6115609061166091 mutex_lock(&direct_mutex);61176092 err = unregister_ftrace_function(ops);61186118- remove_direct_functions_hash(hash, addr);60936093+ reset_direct(ops, addr);61196094 mutex_unlock(&direct_mutex);61206120-61216121- /* cleanup for possible another register call */61226122- ops->func = NULL;61236123- ops->trampoline = 0;6124609561256096 if (free_filters)61266097 ftrace_free_filter(ops);···61276106static int61286107__modify_ftrace_direct(struct ftrace_ops *ops, unsigned long addr)61296108{61306130- struct ftrace_hash *hash;61096109+ struct ftrace_hash *hash = ops->func_hash->filter_hash;61316110 struct ftrace_func_entry *entry, *iter;61326111 static struct ftrace_ops tmp_ops = {61336112 .func = ftrace_stub,···61486127 return err;6149612861506129 /*61306130+ * Call __ftrace_hash_update_ipmodify() here, so that we can call61316131+ * ops->ops_func for the ops. This is needed because the above61326132+ * register_ftrace_function_nolock() worked on tmp_ops.61336133+ */61346134+ err = __ftrace_hash_update_ipmodify(ops, hash, hash, true);61356135+ if (err)61366136+ goto out;61376137+61386138+ /*61516139 * Now the ftrace_ops_list_func() is called to do the direct callers.61526140 * We can safely change the direct functions attached to each entry.61536141 */61546142 mutex_lock(&ftrace_lock);6155614361566156- hash = ops->func_hash->filter_hash;61576144 size = 1 << hash->size_bits;61586145 for (i = 0; i < size; i++) {61596146 hlist_for_each_entry(iter, &hash->buckets[i], hlist) {···6176614761776148 mutex_unlock(&ftrace_lock);6178614961506150+out:61796151 /* Removing the tmp_ops will add the updated direct callers to the functions */61806152 unregister_ftrace_function(&tmp_ops);61816153
+4
kernel/trace/ring_buffer.c
···73447344 goto out;73457345 }7346734673477347+ /* Did the reader catch up with the writer? */73487348+ if (cpu_buffer->reader_page == cpu_buffer->commit_page)73497349+ goto out;73507350+73477351 reader = rb_get_reader_page(cpu_buffer);73487352 if (WARN_ON(!reader))73497353 goto out;
+4-2
kernel/trace/trace_events_hist.c
···32723272 var = create_var(hist_data, file, field_name, val->size, val->type);32733273 if (IS_ERR(var)) {32743274 hist_err(tr, HIST_ERR_VAR_CREATE_FIND_FAIL, errpos(field_name));32753275- kfree(val);32753275+ destroy_hist_field(val, 0);32763276 ret = PTR_ERR(var);32773277 goto err;32783278 }3279327932803280 field_var = kzalloc(sizeof(struct field_var), GFP_KERNEL);32813281 if (!field_var) {32823282- kfree(val);32823282+ destroy_hist_field(val, 0);32833283+ kfree_const(var->type);32843284+ kfree(var->var.name);32833285 kfree(var);32843286 ret = -ENOMEM;32853287 goto err;
+6-1
kernel/trace/trace_fprobe.c
···106106 if (!tuser->name)107107 return NULL;108108109109+ /* Register tracepoint if it is loaded. */109110 if (tpoint) {111111+ tuser->tpoint = tpoint;110112 ret = tracepoint_user_register(tuser);111113 if (ret)112114 return ERR_PTR(ret);113115 }114116115115- tuser->tpoint = tpoint;116117 tuser->refcount = 1;117118 INIT_LIST_HEAD(&tuser->list);118119 list_add(&tuser->list, &tracepoint_user_list);···15141513 if (!trace_probe_is_enabled(tp)) {15151514 list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) {15161515 unregister_fprobe(&tf->fp);15161516+ if (tf->tuser) {15171517+ tracepoint_user_put(tf->tuser);15181518+ tf->tuser = NULL;15191519+ }15171520 }15181521 }15191522
+1-1
lib/crypto/Kconfig
···6464config CRYPTO_LIB_CURVE25519_ARCH6565 bool6666 depends on CRYPTO_LIB_CURVE25519 && !UML && !KMSAN6767- default y if ARM && KERNEL_MODE_NEON6767+ default y if ARM && KERNEL_MODE_NEON && !CPU_BIG_ENDIAN6868 default y if PPC64 && CPU_LITTLE_ENDIAN6969 default y if X86_647070
+1-1
lib/crypto/Makefile
···9090libcurve25519-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += curve25519-fiat32.o9191endif9292# clang versions prior to 18 may blow out the stack with KASAN9393-ifeq ($(call clang-min-version, 180000),)9393+ifeq ($(CONFIG_CC_IS_CLANG)_$(call clang-min-version, 180000),y_)9494KASAN_SANITIZE_curve25519-hacl64.o := n9595endif9696
+16-14
lib/maple_tree.c
···6464#define CREATE_TRACE_POINTS6565#include <trace/events/maple_tree.h>66666767+#define TP_FCT tracepoint_string(__func__)6868+6769/*6870 * Kernel pointer hashing renders much of the maple tree dump useless as tagged6971 * pointers get hashed to arbitrary values.···27582756 MA_STATE(l_mas, mas->tree, mas->index, mas->last);27592757 MA_STATE(r_mas, mas->tree, mas->index, mas->last);2760275827612761- trace_ma_op(__func__, mas);27592759+ trace_ma_op(TP_FCT, mas);2762276027632761 /*27642762 * Rebalancing occurs if a node is insufficient. Data is rebalanced···29992997 MA_STATE(prev_l_mas, mas->tree, mas->index, mas->last);30002998 MA_STATE(prev_r_mas, mas->tree, mas->index, mas->last);3001299930023002- trace_ma_op(__func__, mas);30003000+ trace_ma_op(TP_FCT, mas);3003300130043002 mast.l = &l_mas;30053003 mast.r = &r_mas;···31743172 return false;31753173 }3176317431773177- trace_ma_write(__func__, wr_mas->mas, wr_mas->r_max, entry);31753175+ trace_ma_write(TP_FCT, wr_mas->mas, wr_mas->r_max, entry);31783176 return true;31793177}31803178···34183416 * of data may happen.34193417 */34203418 mas = wr_mas->mas;34213421- trace_ma_op(__func__, mas);34193419+ trace_ma_op(TP_FCT, mas);3422342034233421 if (unlikely(!mas->index && mas->last == ULONG_MAX))34243422 return mas_new_root(mas, wr_mas->entry);···35543552 } else {35553553 memcpy(wr_mas->node, newnode, sizeof(struct maple_node));35563554 }35573557- trace_ma_write(__func__, mas, 0, wr_mas->entry);35553555+ trace_ma_write(TP_FCT, mas, 0, wr_mas->entry);35583556 mas_update_gap(mas);35593557 mas->end = new_end;35603558 return;···35983596 mas->offset++; /* Keep mas accurate. */35993597 }3600359836013601- trace_ma_write(__func__, mas, 0, wr_mas->entry);35993599+ trace_ma_write(TP_FCT, mas, 0, wr_mas->entry);36023600 /*36033601 * Only update gap when the new entry is empty or there is an empty36043602 * entry in the original two ranges.···37193717 mas_update_gap(mas);3720371837213719 mas->end = new_end;37223722- trace_ma_write(__func__, mas, new_end, wr_mas->entry);37203720+ trace_ma_write(TP_FCT, mas, new_end, wr_mas->entry);37233721 return;37243722}37253723···37333731{37343732 struct maple_big_node b_node;3735373337363736- trace_ma_write(__func__, wr_mas->mas, 0, wr_mas->entry);37343734+ trace_ma_write(TP_FCT, wr_mas->mas, 0, wr_mas->entry);37373735 memset(&b_node, 0, sizeof(struct maple_big_node));37383736 mas_store_b_node(wr_mas, &b_node, wr_mas->offset_end);37393737 mas_commit_b_node(wr_mas, &b_node);···50645062{50655063 MA_WR_STATE(wr_mas, mas, entry);5066506450675067- trace_ma_write(__func__, mas, 0, entry);50655065+ trace_ma_write(TP_FCT, mas, 0, entry);50685066#ifdef CONFIG_DEBUG_MAPLE_TREE50695067 if (MAS_WARN_ON(mas, mas->index > mas->last))50705068 pr_err("Error %lX > %lX " PTR_FMT "\n", mas->index, mas->last,···51655163 }5166516451675165store:51685168- trace_ma_write(__func__, mas, 0, entry);51665166+ trace_ma_write(TP_FCT, mas, 0, entry);51695167 mas_wr_store_entry(&wr_mas);51705168 MAS_WR_BUG_ON(&wr_mas, mas_is_err(mas));51715169 mas_destroy(mas);···58845882 MA_STATE(mas, mt, index, index);58855883 void *entry;5886588458875887- trace_ma_read(__func__, &mas);58855885+ trace_ma_read(TP_FCT, &mas);58885886 rcu_read_lock();58895887retry:58905888 entry = mas_start(&mas);···59275925 MA_STATE(mas, mt, index, last);59285926 int ret = 0;5929592759305930- trace_ma_write(__func__, &mas, 0, entry);59285928+ trace_ma_write(TP_FCT, &mas, 0, entry);59315929 if (WARN_ON_ONCE(xa_is_advanced(entry)))59325930 return -EINVAL;59335931···61506148 void *entry = NULL;6151614961526150 MA_STATE(mas, mt, index, index);61536153- trace_ma_op(__func__, &mas);61516151+ trace_ma_op(TP_FCT, &mas);6154615261556153 mtree_lock(mt);61566154 entry = mas_erase(&mas);···64876485 unsigned long copy = *index;64886486#endif6489648764906490- trace_ma_read(__func__, &mas);64886488+ trace_ma_read(TP_FCT, &mas);6491648964926490 if ((*index) > max)64936491 return NULL;
+3
lib/test_kho.c
···301301 phys_addr_t fdt_phys;302302 int err;303303304304+ if (!kho_is_enabled())305305+ return 0;306306+304307 err = kho_retrieve_subtree(KHO_TEST_FDT, &fdt_phys);305308 if (!err)306309 return kho_test_restore(fdt_phys);
+7
mm/Kconfig
···908908config PGTABLE_HAS_HUGE_LEAVES909909 def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE910910911911+#912912+# We can end up creating gigantic folio.913913+#914914+config HAVE_GIGANTIC_FOLIOS915915+ def_bool (HUGETLB_PAGE && ARCH_HAS_GIGANTIC_PAGE) || \916916+ (ZONE_DEVICE && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)917917+911918# TODO: Allow to be enabled without THP912919config ARCH_SUPPORTS_HUGE_PFNMAP913920 def_bool n
···15521552 return ctx;15531553}1554155415551555+static unsigned long damon_sysfs_next_update_jiffies;15561556+15551557static int damon_sysfs_repeat_call_fn(void *data)15561558{15571559 struct damon_sysfs_kdamond *sysfs_kdamond = data;15581558- static unsigned long next_update_jiffies;1559156015601561 if (!sysfs_kdamond->refresh_ms)15611562 return 0;15621562- if (time_before(jiffies, next_update_jiffies))15631563+ if (time_before(jiffies, damon_sysfs_next_update_jiffies))15631564 return 0;15641564- next_update_jiffies = jiffies +15651565+ damon_sysfs_next_update_jiffies = jiffies +15651566 msecs_to_jiffies(sysfs_kdamond->refresh_ms);1566156715671568 if (!mutex_trylock(&damon_sysfs_lock))···16071606 return err;16081607 }16091608 kdamond->damon_ctx = ctx;16091609+16101610+ damon_sysfs_next_update_jiffies =16111611+ jiffies + msecs_to_jiffies(kdamond->refresh_ms);1610161216111613 repeat_call_control->fn = damon_sysfs_repeat_call_fn;16121614 repeat_call_control->data = kdamond;
+20-8
mm/filemap.c
···36813681static vm_fault_t filemap_map_folio_range(struct vm_fault *vmf,36823682 struct folio *folio, unsigned long start,36833683 unsigned long addr, unsigned int nr_pages,36843684- unsigned long *rss, unsigned short *mmap_miss)36843684+ unsigned long *rss, unsigned short *mmap_miss,36853685+ bool can_map_large)36853686{36863687 unsigned int ref_from_caller = 1;36873688 vm_fault_t ret = 0;···36973696 * The folio must not cross VMA or page table boundary.36983697 */36993698 addr0 = addr - start * PAGE_SIZE;37003700- if (folio_within_vma(folio, vmf->vma) &&36993699+ if (can_map_large && folio_within_vma(folio, vmf->vma) &&37013700 (addr0 & PMD_MASK) == ((addr0 + folio_size(folio) - 1) & PMD_MASK)) {37023701 vmf->pte -= start;37033702 page -= start;···38123811 unsigned long rss = 0;38133812 unsigned int nr_pages = 0, folio_type;38143813 unsigned short mmap_miss = 0, mmap_miss_saved;38143814+ bool can_map_large;3815381538163816 rcu_read_lock();38173817 folio = next_uptodate_folio(&xas, mapping, end_pgoff);38183818 if (!folio)38193819 goto out;3820382038213821- if (filemap_map_pmd(vmf, folio, start_pgoff)) {38213821+ file_end = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE) - 1;38223822+ end_pgoff = min(end_pgoff, file_end);38233823+38243824+ /*38253825+ * Do not allow to map with PTEs beyond i_size and with PMD38263826+ * across i_size to preserve SIGBUS semantics.38273827+ *38283828+ * Make an exception for shmem/tmpfs that for long time38293829+ * intentionally mapped with PMDs across i_size.38303830+ */38313831+ can_map_large = shmem_mapping(mapping) ||38323832+ file_end >= folio_next_index(folio);38333833+38343834+ if (can_map_large && filemap_map_pmd(vmf, folio, start_pgoff)) {38223835 ret = VM_FAULT_NOPAGE;38233836 goto out;38243837 }···38443829 folio_put(folio);38453830 goto out;38463831 }38473847-38483848- file_end = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE) - 1;38493849- if (end_pgoff > file_end)38503850- end_pgoff = file_end;3851383238523833 folio_type = mm_counter_file(folio);38533834 do {···38613850 else38623851 ret |= filemap_map_folio_range(vmf, folio,38633852 xas.xa_index - folio->index, addr,38643864- nr_pages, &rss, &mmap_miss);38533853+ nr_pages, &rss, &mmap_miss,38543854+ can_map_large);3865385538663856 folio_unlock(folio);38673857 } while ((folio = next_uptodate_folio(&xas, mapping, end_pgoff)) != NULL);
+27-14
mm/huge_memory.c
···214214 if (likely(atomic_inc_not_zero(&huge_zero_refcount)))215215 return true;216216217217- zero_folio = folio_alloc((GFP_TRANSHUGE | __GFP_ZERO) & ~__GFP_MOVABLE,217217+ zero_folio = folio_alloc((GFP_TRANSHUGE | __GFP_ZERO | __GFP_ZEROTAGS) &218218+ ~__GFP_MOVABLE,218219 HPAGE_PMD_ORDER);219220 if (!zero_folio) {220221 count_vm_event(THP_ZERO_PAGE_ALLOC_FAILED);···32643263 caller_pins;32653264}3266326532663266+static bool page_range_has_hwpoisoned(struct page *page, long nr_pages)32673267+{32683268+ for (; nr_pages; page++, nr_pages--)32693269+ if (PageHWPoison(page))32703270+ return true;32713271+ return false;32723272+}32733273+32673274/*32683275 * It splits @folio into @new_order folios and copies the @folio metadata to32693276 * all the resulting folios.···32793270static void __split_folio_to_order(struct folio *folio, int old_order,32803271 int new_order)32813272{32733273+ /* Scan poisoned pages when split a poisoned folio to large folios */32743274+ const bool handle_hwpoison = folio_test_has_hwpoisoned(folio) && new_order;32823275 long new_nr_pages = 1 << new_order;32833276 long nr_pages = 1 << old_order;32843277 long i;3285327832793279+ folio_clear_has_hwpoisoned(folio);32803280+32813281+ /* Check first new_nr_pages since the loop below skips them */32823282+ if (handle_hwpoison &&32833283+ page_range_has_hwpoisoned(folio_page(folio, 0), new_nr_pages))32843284+ folio_set_has_hwpoisoned(folio);32863285 /*32873286 * Skip the first new_nr_pages, since the new folio from them have all32883287 * the flags from the original folio.32893288 */32903289 for (i = new_nr_pages; i < nr_pages; i += new_nr_pages) {32913290 struct page *new_head = &folio->page + i;32923292-32933291 /*32943292 * Careful: new_folio is not a "real" folio before we cleared PageTail.32953293 * Don't pass it around before clear_compound_head().···33373321#endif33383322 (1L << PG_dirty) |33393323 LRU_GEN_MASK | LRU_REFS_MASK));33243324+33253325+ if (handle_hwpoison &&33263326+ page_range_has_hwpoisoned(new_head, new_nr_pages))33273327+ folio_set_has_hwpoisoned(new_folio);3340332833413329 new_folio->mapping = folio->mapping;33423330 new_folio->index = folio->index + i;···34423422 if (folio_test_anon(folio))34433423 mod_mthp_stat(order, MTHP_STAT_NR_ANON, -1);3444342434453445- folio_clear_has_hwpoisoned(folio);34463446-34473425 /*34483426 * split to new_order one order at a time. For uniform split,34493427 * folio is split to new_order directly.···35223504 /* order-1 is not supported for anonymous THP. */35233505 VM_WARN_ONCE(warns && new_order == 1,35243506 "Cannot split to order-1 folio");35253525- return new_order != 1;35073507+ if (new_order == 1)35083508+ return false;35263509 } else if (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS) &&35273510 !mapping_large_folio_support(folio->mapping)) {35283511 /*···35543535 if (folio_test_anon(folio)) {35553536 VM_WARN_ONCE(warns && new_order == 1,35563537 "Cannot split to order-1 folio");35573557- return new_order != 1;35383538+ if (new_order == 1)35393539+ return false;35583540 } else if (new_order) {35593541 if (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS) &&35603542 !mapping_large_folio_support(folio->mapping)) {···3673365336743654 min_order = mapping_min_folio_order(folio->mapping);36753655 if (new_order < min_order) {36763676- VM_WARN_ONCE(1, "Cannot split mapped folio below min-order: %u",36773677- min_order);36783656 ret = -EINVAL;36793657 goto out;36803658 }···4004398640053987int split_folio_to_list(struct folio *folio, struct list_head *list)40063988{40074007- int ret = min_order_for_split(folio);40084008-40094009- if (ret < 0)40104010- return ret;40114011-40124012- return split_huge_page_to_list_to_order(&folio->page, list, ret);39893989+ return split_huge_page_to_list_to_order(&folio->page, list, 0);40133990}4014399140153992/*
···6565#include <linux/gfp.h>6666#include <linux/migrate.h>6767#include <linux/string.h>6868+#include <linux/shmem_fs.h>6869#include <linux/memory-tiers.h>6970#include <linux/debugfs.h>7071#include <linux/userfaultfd_k.h>···55025501 return ret;55035502 }5504550355045504+ if (!needs_fallback && vma->vm_file) {55055505+ struct address_space *mapping = vma->vm_file->f_mapping;55065506+ pgoff_t file_end;55075507+55085508+ file_end = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE);55095509+55105510+ /*55115511+ * Do not allow to map with PTEs beyond i_size and with PMD55125512+ * across i_size to preserve SIGBUS semantics.55135513+ *55145514+ * Make an exception for shmem/tmpfs that for long time55155515+ * intentionally mapped with PMDs across i_size.55165516+ */55175517+ needs_fallback = !shmem_mapping(mapping) &&55185518+ file_end < folio_next_index(folio);55195519+ }55205520+55055521 if (pmd_none(*vmf->pmd)) {55065506- if (folio_test_pmd_mappable(folio)) {55225522+ if (!needs_fallback && folio_test_pmd_mappable(folio)) {55075523 ret = do_set_pmd(vmf, folio, page);55085524 if (ret != VM_FAULT_FALLBACK)55095525 return ret;
···8282 __folio_mark_uptodate(folio);8383 err = filemap_add_folio(mapping, folio, offset, gfp);8484 if (unlikely(err)) {8585- folio_put(folio);8685 /*8786 * If a split of large page was required, it8887 * already happened when we marked the page invalid8988 * which guarantees that this call won't fail9089 */9190 set_direct_map_default_noflush(folio_page(folio, 0));9191+ folio_put(folio);9292 if (err == -EEXIST)9393 goto retry;9494
+6-3
mm/shmem.c
···18821882 struct shmem_inode_info *info = SHMEM_I(inode);18831883 unsigned long suitable_orders = 0;18841884 struct folio *folio = NULL;18851885+ pgoff_t aligned_index;18851886 long pages;18861887 int error, order;18871888···18961895 order = highest_order(suitable_orders);18971896 while (suitable_orders) {18981897 pages = 1UL << order;18991899- index = round_down(index, pages);19001900- folio = shmem_alloc_folio(gfp, order, info, index);19011901- if (folio)18981898+ aligned_index = round_down(index, pages);18991899+ folio = shmem_alloc_folio(gfp, order, info, aligned_index);19001900+ if (folio) {19011901+ index = aligned_index;19021902 goto allocated;19031903+ }1903190419041905 if (pages == HPAGE_PMD_NR)19051906 count_vm_event(THP_FILE_FALLBACK);
+16-4
mm/slub.c
···20462046 if (slab_exts) {20472047 unsigned int offs = obj_to_index(obj_exts_slab->slab_cache,20482048 obj_exts_slab, obj_exts);20492049- /* codetag should be NULL */20492049+20502050+ if (unlikely(is_codetag_empty(&slab_exts[offs].ref)))20512051+ return;20522052+20532053+ /* codetag should be NULL here */20502054 WARN_ON(slab_exts[offs].ref.ct);20512055 set_codetag_empty(&slab_exts[offs].ref);20522056 }···46704666 if (kmem_cache_debug(s)) {46714667 freelist = alloc_single_from_new_slab(s, slab, orig_size, gfpflags);4672466846734673- if (unlikely(!freelist))46694669+ if (unlikely(!freelist)) {46704670+ /* This could cause an endless loop. Fail instead. */46714671+ if (!allow_spin)46724672+ return NULL;46744673 goto new_objects;46744674+ }4675467546764676 if (s->flags & SLAB_STORE_USER)46774677 set_track(s, freelist, TRACK_ALLOC, addr,···6336632863376329 if (unlikely(!slab_free_hook(s, p[i], init, false))) {63386330 p[i] = p[--size];63396339- if (!size)63406340- goto flush_remote;63416331 continue;63426332 }63436333···6349634363506344 i++;63516345 }63466346+63476347+ if (!size)63486348+ goto flush_remote;6352634963536350next_batch:63546351 if (!local_trylock(&s->cpu_sheaves->lock))···64066397 size -= batch;64076398 goto next_batch;64086399 }64006400+64016401+ if (remote_nr)64026402+ goto flush_remote;6409640364106404 return;64116405
+13
mm/swap_state.c
···748748749749 blk_start_plug(&plug);750750 for (addr = start; addr < end; ilx++, addr += PAGE_SIZE) {751751+ struct swap_info_struct *si = NULL;752752+751753 if (!pte++) {752754 pte = pte_offset_map(vmf->pmd, addr);753755 if (!pte)···763761 continue;764762 pte_unmap(pte);765763 pte = NULL;764764+ /*765765+ * Readahead entry may come from a device that we are not766766+ * holding a reference to, try to grab a reference, or skip.767767+ */768768+ if (swp_type(entry) != swp_type(targ_entry)) {769769+ si = get_swap_device(entry);770770+ if (!si)771771+ continue;772772+ }766773 folio = __read_swap_cache_async(entry, gfp_mask, mpol, ilx,767774 &page_allocated, false);775775+ if (si)776776+ put_swap_device(si);768777 if (!folio)769778 continue;770779 if (page_allocated) {
+31-6
mm/truncate.c
···177177 return 0;178178}179179180180+static int try_folio_split_or_unmap(struct folio *folio, struct page *split_at,181181+ unsigned long min_order)182182+{183183+ enum ttu_flags ttu_flags =184184+ TTU_SYNC |185185+ TTU_SPLIT_HUGE_PMD |186186+ TTU_IGNORE_MLOCK;187187+ int ret;188188+189189+ ret = try_folio_split_to_order(folio, split_at, min_order);190190+191191+ /*192192+ * If the split fails, unmap the folio, so it will be refaulted193193+ * with PTEs to respect SIGBUS semantics.194194+ *195195+ * Make an exception for shmem/tmpfs that for long time196196+ * intentionally mapped with PMDs across i_size.197197+ */198198+ if (ret && !shmem_mapping(folio->mapping)) {199199+ try_to_unmap(folio, ttu_flags);200200+ WARN_ON(folio_mapped(folio));201201+ }202202+203203+ return ret;204204+}205205+180206/*181207 * Handle partial folios. The folio may be entirely within the182208 * range if a split has raced with us. If not, we zero the part of the···220194 size_t size = folio_size(folio);221195 unsigned int offset, length;222196 struct page *split_at, *split_at2;197197+ unsigned int min_order;223198224199 if (pos < start)225200 offset = start - pos;···250223 if (!folio_test_large(folio))251224 return true;252225226226+ min_order = mapping_min_folio_order(folio->mapping);253227 split_at = folio_page(folio, PAGE_ALIGN_DOWN(offset) / PAGE_SIZE);254254- if (!try_folio_split(folio, split_at, NULL)) {228228+ if (!try_folio_split_or_unmap(folio, split_at, min_order)) {255229 /*256230 * try to split at offset + length to make sure folios within257231 * the range can be dropped, especially to avoid memory waste···276248 if (!folio_trylock(folio2))277249 goto out;278250279279- /*280280- * make sure folio2 is large and does not change its mapping.281281- * Its split result does not matter here.282282- */251251+ /* make sure folio2 is large and does not change its mapping */283252 if (folio_test_large(folio2) &&284253 folio2->mapping == folio->mapping)285285- try_folio_split(folio2, split_at2, NULL);254254+ try_folio_split_or_unmap(folio2, split_at2, min_order);286255287256 folio_unlock(folio2);288257out:
···6060 struct sk_buff *skb;6161 int work_done = 0;62626363- __local_lock_nested_bh(&cell->bh_lock);6463 while (work_done < budget) {6464+ __local_lock_nested_bh(&cell->bh_lock);6565 skb = __skb_dequeue(&cell->napi_skbs);6666+ __local_unlock_nested_bh(&cell->bh_lock);6667 if (!skb)6768 break;6869 napi_gro_receive(napi, skb);···72717372 if (work_done < budget)7473 napi_complete_done(napi, work_done);7575- __local_unlock_nested_bh(&cell->bh_lock);7674 return work_done;7775}7876
+7-7
net/core/netpoll.c
···228228{229229 struct sk_buff_head *skb_pool;230230 struct sk_buff *skb;231231- unsigned long flags;232231233232 skb_pool = &np->skb_pool;234233235235- spin_lock_irqsave(&skb_pool->lock, flags);236236- while (skb_pool->qlen < MAX_SKBS) {234234+ while (READ_ONCE(skb_pool->qlen) < MAX_SKBS) {237235 skb = alloc_skb(MAX_SKB_SIZE, GFP_ATOMIC);238236 if (!skb)239237 break;240238241241- __skb_queue_tail(skb_pool, skb);239239+ skb_queue_tail(skb_pool, skb);242240 }243243- spin_unlock_irqrestore(&skb_pool->lock, flags);244241}245242246243static void zap_completion_queue(void)···811814 if (!npinfo)812815 return;813816817817+ /* At this point, there is a single npinfo instance per netdevice, and818818+ * its refcnt tracks how many netpoll structures are linked to it. We819819+ * only perform npinfo cleanup when the refcnt decrements to zero.820820+ */814821 if (refcount_dec_and_test(&npinfo->refcnt)) {815822 const struct net_device_ops *ops;816823···824823825824 RCU_INIT_POINTER(np->dev->npinfo, NULL);826825 call_rcu(&npinfo->rcu, rcu_cleanup_netpoll_info);827827- } else828828- RCU_INIT_POINTER(np->dev->npinfo, NULL);826826+ }829827830828 skb_pool_flush(np);831829}
+12-4
net/dsa/tag_brcm.c
···176176 /* Remove Broadcom tag and update checksum */177177 skb_pull_rcsum(skb, BRCM_TAG_LEN);178178179179- dsa_default_offload_fwd_mark(skb);179179+ if (likely(!is_link_local_ether_addr(eth_hdr(skb)->h_dest)))180180+ dsa_default_offload_fwd_mark(skb);180181181182 return skb;182183}···225224{226225 int len = BRCM_LEG_TAG_LEN;227226 int source_port;227227+ __be16 *proto;228228 u8 *brcm_tag;229229230230 if (unlikely(!pskb_may_pull(skb, BRCM_LEG_TAG_LEN + VLAN_HLEN)))231231 return NULL;232232233233 brcm_tag = dsa_etype_header_pos_rx(skb);234234+ proto = (__be16 *)(brcm_tag + BRCM_LEG_TAG_LEN);234235235236 source_port = brcm_tag[5] & BRCM_LEG_PORT_ID;236237···240237 if (!skb->dev)241238 return NULL;242239243243- /* VLAN tag is added by BCM63xx internal switch */244244- if (netdev_uses_dsa(skb->dev))240240+ /* The internal switch in BCM63XX SoCs always tags on egress on the CPU241241+ * port. We use VID 0 internally for untagged traffic, so strip the tag242242+ * if the TCI field is all 0, and keep it otherwise to also retain243243+ * e.g. 802.1p tagged packets.244244+ */245245+ if (proto[0] == htons(ETH_P_8021Q) && proto[1] == 0)245246 len += VLAN_HLEN;246247247248 /* Remove Broadcom tag and update checksum */248249 skb_pull_rcsum(skb, len);249250250250- dsa_default_offload_fwd_mark(skb);251251+ if (likely(!is_link_local_ether_addr(eth_hdr(skb)->h_dest)))252252+ dsa_default_offload_fwd_mark(skb);251253252254 dsa_strip_etype_header(skb, len);253255
···223223 if (netif_carrier_ok(sdata->dev))224224 return -EBUSY;225225226226+ /* if any stations are set known (so they know this vif too), reject */227227+ if (sta_info_get_by_idx(sdata, 0))228228+ return -EBUSY;229229+226230 /* First check no ROC work is happening on this iface */227231 list_for_each_entry(roc, &local->roc_list, list) {228232 if (roc->sdata != sdata)···246242 ret = -EBUSY;247243 }248244245245+ /*246246+ * More interface types could be added here but changing the247247+ * address while powered makes the most sense in client modes.248248+ */249249 switch (sdata->vif.type) {250250 case NL80211_IFTYPE_STATION:251251 case NL80211_IFTYPE_P2P_CLIENT:252252- /* More interface types could be added here but changing the253253- * address while powered makes the most sense in client modes.254254- */252252+ /* refuse while connecting */253253+ if (sdata->u.mgd.auth_data || sdata->u.mgd.assoc_data)254254+ return -EBUSY;255255 break;256256 default:257257 ret = -EOPNOTSUPP;
+2-2
net/mac80211/link.c
···472472 * from there.473473 */474474 if (link->conf->csa_active)475475- wiphy_delayed_work_queue(local->hw.wiphy,475475+ wiphy_hrtimer_work_queue(local->hw.wiphy,476476 &link->u.mgd.csa.switch_work,477477 link->u.mgd.csa.time -478478- jiffies);478478+ ktime_get_boottime());479479 }480480481481 for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
+26-26
net/mac80211/mlme.c
···4545#define IEEE80211_ASSOC_TIMEOUT_SHORT (HZ / 10)4646#define IEEE80211_ASSOC_MAX_TRIES 347474848-#define IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS msecs_to_jiffies(100)4848+#define IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS (100 * USEC_PER_MSEC)4949#define IEEE80211_ADV_TTLM_ST_UNDERFLOW 0xff0050505151#define IEEE80211_NEG_TTLM_REQ_TIMEOUT (HZ / 5)···25942594 return;25952595 }2596259625972597- wiphy_delayed_work_queue(sdata->local->hw.wiphy,25972597+ wiphy_hrtimer_work_queue(sdata->local->hw.wiphy,25982598 &link->u.mgd.csa.switch_work, 0);25992599 }26002600···27532753 .timestamp = timestamp,27542754 .device_timestamp = device_timestamp,27552755 };27562756- unsigned long now;27562756+ u32 csa_time_tu;27572757+ ktime_t now;27572758 int res;2758275927592760 lockdep_assert_wiphy(local->hw.wiphy);···29842983 csa_ie.mode);2985298429862985 /* we may have to handle timeout for deactivated link in software */29872987- now = jiffies;29882988- link->u.mgd.csa.time = now +29892989- TU_TO_JIFFIES((max_t(int, csa_ie.count, 1) - 1) *29902990- link->conf->beacon_int);29862986+ now = ktime_get_boottime();29872987+ csa_time_tu = (max_t(int, csa_ie.count, 1) - 1) * link->conf->beacon_int;29882988+ link->u.mgd.csa.time = now + us_to_ktime(ieee80211_tu_to_usec(csa_time_tu));2991298929922990 if (ieee80211_vif_link_active(&sdata->vif, link->link_id) &&29932991 local->ops->channel_switch) {···30013001 }3002300230033003 /* channel switch handled in software */30043004- wiphy_delayed_work_queue(local->hw.wiphy,30043004+ wiphy_hrtimer_work_queue(local->hw.wiphy,30053005 &link->u.mgd.csa.switch_work,30063006 link->u.mgd.csa.time - now);30073007 return;···4242424242434243 memset(&sdata->u.mgd.ttlm_info, 0,42444244 sizeof(sdata->u.mgd.ttlm_info));42454245- wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);42454245+ wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);4246424642474247 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm));42484248 wiphy_delayed_work_cancel(sdata->local->hw.wiphy,42494249 &ifmgd->neg_ttlm_timeout_work);4250425042514251 sdata->u.mgd.removed_links = 0;42524252- wiphy_delayed_work_cancel(sdata->local->hw.wiphy,42524252+ wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy,42534253 &sdata->u.mgd.ml_reconf_work);4254425442554255 wiphy_work_cancel(sdata->local->hw.wiphy,···68766876 /* In case the removal was cancelled, abort it */68776877 if (sdata->u.mgd.removed_links) {68786878 sdata->u.mgd.removed_links = 0;68796879- wiphy_delayed_work_cancel(sdata->local->hw.wiphy,68796879+ wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy,68806880 &sdata->u.mgd.ml_reconf_work);68816881 }68826882 return;···69066906 }6907690769086908 sdata->u.mgd.removed_links = removed_links;69096909- wiphy_delayed_work_queue(sdata->local->hw.wiphy,69096909+ wiphy_hrtimer_work_queue(sdata->local->hw.wiphy,69106910 &sdata->u.mgd.ml_reconf_work,69116911- TU_TO_JIFFIES(delay));69116911+ us_to_ktime(ieee80211_tu_to_usec(delay)));69126912}6913691369146914static int ieee80211_ttlm_set_links(struct ieee80211_sub_if_data *sdata,···70957095 /* if a planned TID-to-link mapping was cancelled -70967096 * abort it70977097 */70987098- wiphy_delayed_work_cancel(sdata->local->hw.wiphy,70987098+ wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy,70997099 &sdata->u.mgd.ttlm_work);71007100 } else if (sdata->u.mgd.ttlm_info.active) {71017101 /* if no TID-to-link element, set to default mapping in···7130713071317131 if (ttlm_info.switch_time) {71327132 u16 beacon_ts_tu, st_tu, delay;71337133- u32 delay_jiffies;71337133+ u64 delay_usec;71347134 u64 mask;7135713571367136 /* The t2l map switch time is indicated with a partial···71527152 if (delay > IEEE80211_ADV_TTLM_ST_UNDERFLOW)71537153 return;7154715471557155- delay_jiffies = TU_TO_JIFFIES(delay);71557155+ delay_usec = ieee80211_tu_to_usec(delay);7156715671577157 /* Link switching can take time, so schedule it71587158 * 100ms before to be ready on time71597159 */71607160- if (delay_jiffies > IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS)71617161- delay_jiffies -=71607160+ if (delay_usec > IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS)71617161+ delay_usec -=71627162 IEEE80211_ADV_TTLM_SAFETY_BUFFER_MS;71637163 else71647164- delay_jiffies = 0;71647164+ delay_usec = 0;7165716571667166 sdata->u.mgd.ttlm_info = ttlm_info;71677167- wiphy_delayed_work_cancel(sdata->local->hw.wiphy,71677167+ wiphy_hrtimer_work_cancel(sdata->local->hw.wiphy,71687168 &sdata->u.mgd.ttlm_work);71697169- wiphy_delayed_work_queue(sdata->local->hw.wiphy,71697169+ wiphy_hrtimer_work_queue(sdata->local->hw.wiphy,71707170 &sdata->u.mgd.ttlm_work,71717171- delay_jiffies);71717171+ us_to_ktime(delay_usec));71727172 return;71737173 }71747174 }···87938793 ieee80211_csa_connection_drop_work);87948794 wiphy_delayed_work_init(&ifmgd->tdls_peer_del_work,87958795 ieee80211_tdls_peer_del_work);87968796- wiphy_delayed_work_init(&ifmgd->ml_reconf_work,87968796+ wiphy_hrtimer_work_init(&ifmgd->ml_reconf_work,87978797 ieee80211_ml_reconf_work);87988798 wiphy_delayed_work_init(&ifmgd->reconf.wk,87998799 ieee80211_ml_sta_reconf_timeout);···88028802 timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0);88038803 wiphy_delayed_work_init(&ifmgd->tx_tspec_wk,88048804 ieee80211_sta_handle_tspec_ac_params_wk);88058805- wiphy_delayed_work_init(&ifmgd->ttlm_work,88058805+ wiphy_hrtimer_work_init(&ifmgd->ttlm_work,88068806 ieee80211_tid_to_link_map_work);88078807 wiphy_delayed_work_init(&ifmgd->neg_ttlm_timeout_work,88088808 ieee80211_neg_ttlm_timeout_work);···88498849 else88508850 link->u.mgd.req_smps = IEEE80211_SMPS_OFF;8851885188528852- wiphy_delayed_work_init(&link->u.mgd.csa.switch_work,88528852+ wiphy_hrtimer_work_init(&link->u.mgd.csa.switch_work,88538853 ieee80211_csa_switch_work);8854885488558855 ieee80211_clear_tpe(&link->conf->tpe);···1006410064 &link->u.mgd.request_smps_work);1006510065 wiphy_work_cancel(link->sdata->local->hw.wiphy,1006610066 &link->u.mgd.recalc_smps);1006710067- wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy,1006710067+ wiphy_hrtimer_work_cancel(link->sdata->local->hw.wiphy,1006810068 &link->u.mgd.csa.switch_work);1006910069}1007010070
+7-3
net/mac80211/rx.c
···53605360 if (WARN_ON(!local->started))53615361 goto drop;5362536253635363- if (likely(!(status->flag & RX_FLAG_FAILED_PLCP_CRC))) {53635363+ if (likely(!(status->flag & RX_FLAG_FAILED_PLCP_CRC) &&53645364+ !(status->flag & RX_FLAG_NO_PSDU &&53655365+ status->zero_length_psdu_type ==53665366+ IEEE80211_RADIOTAP_ZERO_LEN_PSDU_NOT_CAPTURED))) {53645367 /*53655365- * Validate the rate, unless a PLCP error means that53665366- * we probably can't have a valid rate here anyway.53685368+ * Validate the rate, unless there was a PLCP error which may53695369+ * have an invalid rate or the PSDU was not capture and may be53705370+ * missing rate information.53675371 */5368537253695373 switch (status->encoding) {
+4-2
net/mptcp/protocol.c
···61616262static const struct proto_ops *mptcp_fallback_tcp_ops(const struct sock *sk)6363{6464+ unsigned short family = READ_ONCE(sk->sk_family);6565+6466#if IS_ENABLED(CONFIG_MPTCP_IPV6)6565- if (sk->sk_prot == &tcpv6_prot)6767+ if (family == AF_INET6)6668 return &inet6_stream_ops;6769#endif6868- WARN_ON_ONCE(sk->sk_prot != &tcp_prot);7070+ WARN_ON_ONCE(family != AF_INET);6971 return &inet_stream_ops;7072}7173
···6969# the time being (https://github.com/rust-lang/rust/issues/144521).7070rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18)71717272+# Similarly, for doctests (https://github.com/rust-lang/rust/issues/146465).7373+doctests_modifiers_workaround := $(rustdoc_modifiers_workaround)$(if $(call rustc-min-version,109100),$(comma)sanitizer)7474+7275# `rustc` recognizes `--remap-path-prefix` since 1.26.0, but `rustdoc` only7376# since Rust 1.81.0. Moreover, `rustdoc` ICEs on out-of-tree builds since Rust7477# 1.82.0 (https://github.com/rust-lang/rust/issues/138520). Thus workaround both···130127rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs rustdoc-clean FORCE131128 +$(call if_changed,rustdoc)132129130130+# Even if `rustdoc` targets are not kernel objects, they should still be131131+# treated as such so that we pass the same flags. Otherwise, for instance,132132+# `rustdoc` will complain about missing sanitizer flags causing an ABI mismatch.133133+rustdoc-compiler_builtins: private is-kernel-object := y133134rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE134135 +$(call if_changed,rustdoc)135136137137+rustdoc-ffi: private is-kernel-object := y136138rustdoc-ffi: $(src)/ffi.rs rustdoc-core FORCE137139 +$(call if_changed,rustdoc)138140···155147 rustdoc-macros FORCE156148 +$(call if_changed,rustdoc)157149150150+rustdoc-kernel: private is-kernel-object := y158151rustdoc-kernel: private rustc_target_flags = --extern ffi --extern pin_init \159152 --extern build_error --extern macros \160153 --extern bindings --extern uapi···239230 --extern bindings --extern uapi \240231 --no-run --crate-name kernel -Zunstable-options \241232 --sysroot=/dev/null \242242- $(rustdoc_modifiers_workaround) \233233+ $(doctests_modifiers_workaround) \243234 --test-builder $(objtree)/scripts/rustdoc_test_builder \244235 $< $(rustdoc_test_kernel_quiet); \245236 $(objtree)/scripts/rustdoc_test_gen···298289 -fno-inline-functions-called-once -fsanitize=bounds-strict \299290 -fstrict-flex-arrays=% -fmin-function-alignment=% \300291 -fzero-init-padding-bits=% -mno-fdpic \301301- --param=% --param asan-%292292+ --param=% --param asan-% -fno-isolate-erroneous-paths-dereference302293303294# Derived from `scripts/Makefile.clang`.304295BINDGEN_TARGET_x86 := x86_64-linux-gnu···531522 $(obj)/$(libpin_init_internal_name) $(obj)/$(libmacros_name) FORCE532523 +$(call if_changed_rule,rustc_library)533524525525+# Even if normally `build_error` is not a kernel object, it should still be526526+# treated as such so that we pass the same flags. Otherwise, for instance,527527+# `rustc` will complain about missing sanitizer flags causing an ABI mismatch.528528+$(obj)/build_error.o: private is-kernel-object := y534529$(obj)/build_error.o: private skip_gendwarfksyms = 1535530$(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE536531 +$(call if_changed_rule,rustc_library)
+1-1
rust/kernel/devres.rs
···103103///104104/// # Invariants105105///106106-/// [`Self::inner`] is guaranteed to be initialized and is always accessed read-only.106106+/// `Self::inner` is guaranteed to be initialized and is always accessed read-only.107107#[pin_data(PinnedDrop)]108108pub struct Devres<T: Send> {109109 dev: ARef<Device>,
+1-1
rust/kernel/sync/condvar.rs
···3636/// spuriously.3737///3838/// Instances of [`CondVar`] need a lock class and to be pinned. The recommended way to create such3939-/// instances is with the [`pin_init`](crate::pin_init!) and [`new_condvar`] macros.3939+/// instances is with the [`pin_init`](pin_init::pin_init!) and [`new_condvar`] macros.4040///4141/// # Examples4242///
···102102# modules.builtin.modinfo103103# ---------------------------------------------------------------------------104104105105+# .modinfo in vmlinux.unstripped is aligned to 8 bytes for compatibility with106106+# tools that expect vmlinux to have sufficiently aligned sections but the107107+# additional bytes used for padding .modinfo to satisfy this requirement break108108+# certain versions of kmod with109109+#110110+# depmod: ERROR: kmod_builtin_iter_next: unexpected string without modname prefix111111+#112112+# Strip the trailing padding bytes after extracting .modinfo to comply with113113+# what kmod expects to parse.114114+quiet_cmd_modules_builtin_modinfo = GEN $@115115+ cmd_modules_builtin_modinfo = $(cmd_objcopy); \116116+ sed -i 's/\x00\+$$/\x00/g' $@117117+105118OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary106119107120targets += modules.builtin.modinfo108121modules.builtin.modinfo: vmlinux.unstripped FORCE109109- $(call if_changed,objcopy)122122+ $(call if_changed,modules_builtin_modinfo)110123111124# modules.builtin112125# ---------------------------------------------------------------------------
+8-6
scripts/decode_stacktrace.sh
···277277 fi278278 done279279280280- if [[ ${words[$last]} =~ ^[0-9a-f]+\] ]]; then281281- words[$last-1]="${words[$last-1]} ${words[$last]}"282282- unset words[$last] spaces[$last]283283- last=$(( $last - 1 ))284284- fi285285-286280 # Extract info after the symbol if present. E.g.:287281 # func_name+0x54/0x80 (P)288282 # ^^^···285291 local info_str=""286292 if [[ ${words[$last]} =~ \([A-Z]*\) ]]; then287293 info_str=${words[$last]}294294+ unset words[$last] spaces[$last]295295+ last=$(( $last - 1 ))296296+ fi297297+298298+ # Join module name with its build id if present, as these were299299+ # split during tokenization (e.g. "[module" and "modbuildid]").300300+ if [[ ${words[$last]} =~ ^[0-9a-f]+\] ]]; then301301+ words[$last-1]="${words[$last-1]} ${words[$last]}"288302 unset words[$last] spaces[$last]289303 last=$(( $last - 1 ))290304 fi
+2-1
scripts/gendwarfksyms/gendwarfksyms.c
···138138 error("no input files?");139139 }140140141141- symbol_read_exports(stdin);141141+ if (!symbol_read_exports(stdin))142142+ return 0;142143143144 if (symtypes_file) {144145 symfile = fopen(symtypes_file, "w");
+1-1
scripts/gendwarfksyms/gendwarfksyms.h
···123123typedef void (*symbol_callback_t)(struct symbol *, void *arg);124124125125bool is_symbol_ptr(const char *name);126126-void symbol_read_exports(FILE *file);126126+int symbol_read_exports(FILE *file);127127void symbol_read_symtab(int fd);128128struct symbol *symbol_get(const char *name);129129void symbol_set_ptr(struct symbol *sym, Dwarf_Die *ptr);
···23102310 tristate "WCD9340/WCD9341 Codec"23112311 depends on COMMON_CLK23122312 depends on SLIMBUS23132313+ depends on SOUNDWIRE || !SOUNDWIRE23132314 select REGMAP_IRQ23142315 select REGMAP_SLIMBUS23152316 select SND_SOC_WCD_CLASSH
+18-3
sound/soc/codecs/pm4125.c
···15511551 struct device_link *devlink;15521552 int ret;1553155315541554+ /* Initialize device pointers to NULL for safe cleanup */15551555+ pm4125->rxdev = NULL;15561556+ pm4125->txdev = NULL;15571557+15541558 /* Give the soundwire subdevices some more time to settle */15551559 usleep_range(15000, 15010);15561560···15781574 if (!pm4125->txdev) {15791575 dev_err(dev, "could not find txslave with matching of node\n");15801576 ret = -EINVAL;15811581- goto error_unbind_all;15771577+ goto error_put_rx;15821578 }1583157915841580 pm4125->sdw_priv[AIF1_CAP] = dev_get_drvdata(pm4125->txdev);···15881584 if (!pm4125->tx_sdw_dev) {15891585 dev_err(dev, "could not get txslave with matching of dev\n");15901586 ret = -EINVAL;15911591- goto error_unbind_all;15871587+ goto error_put_tx;15921588 }1593158915941590 /*···16001596 if (!devlink) {16011597 dev_err(dev, "Could not devlink TX and RX\n");16021598 ret = -EINVAL;16031603- goto error_unbind_all;15991599+ goto error_put_tx;16041600 }1605160116061602 devlink = device_link_add(dev, pm4125->txdev,···16541650 device_link_remove(dev, pm4125->txdev);16551651link_remove_rx_tx:16561652 device_link_remove(pm4125->rxdev, pm4125->txdev);16531653+error_put_tx:16541654+ put_device(pm4125->txdev);16551655+error_put_rx:16561656+ put_device(pm4125->rxdev);16571657error_unbind_all:16581658 component_unbind_all(dev, pm4125);16591659 return ret;···16711663 device_link_remove(dev, pm4125->txdev);16721664 device_link_remove(dev, pm4125->rxdev);16731665 device_link_remove(pm4125->rxdev, pm4125->txdev);16661666+16671667+ /* Release device references acquired in bind */16681668+ if (pm4125->txdev)16691669+ put_device(pm4125->txdev);16701670+ if (pm4125->rxdev)16711671+ put_device(pm4125->rxdev);16721672+16741673 component_unbind_all(dev, pm4125);16751674}16761675
+1-1
sound/soc/codecs/tas2781-comlib-i2c.c
···320320 for (i = 0; i < tas_dev->ndev; i++) {321321 ret = tasdevice_dev_write(tas_dev, i,322322 TASDEVICE_REG_SWRESET,323323- tas_dev->chip_id >= TAS5825 ?323323+ tas_dev->chip_id >= TAS5802 ?324324 TAS5825_REG_SWRESET_RESET :325325 TASDEVICE_REG_SWRESET_RESET);326326 if (ret < 0)
+1-1
sound/soc/codecs/tas2781-i2c.c
···1391139113921392 /*13931393 * Alloc kcontrol via devm_kzalloc(), which don't manually13941394- * free the kcontrol。13941394+ * free the kcontrol.13951395 */13961396 cali_ctrls = devm_kcalloc(priv->dev, nctrls,13971397 sizeof(cali_ctrls[0]), GFP_KERNEL);
+34-9
sound/soc/codecs/wcd937x.c
···27482748 wcd937x->rxdev = of_sdw_find_device_by_node(wcd937x->rxnode);27492749 if (!wcd937x->rxdev) {27502750 dev_err(dev, "could not find slave with matching of node\n");27512751- return -EINVAL;27512751+ ret = -EINVAL;27522752+ goto err_component_unbind;27522753 }2753275427542755 wcd937x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd937x->rxdev);···27582757 wcd937x->txdev = of_sdw_find_device_by_node(wcd937x->txnode);27592758 if (!wcd937x->txdev) {27602759 dev_err(dev, "could not find txslave with matching of node\n");27612761- return -EINVAL;27602760+ ret = -EINVAL;27612761+ goto err_put_rxdev;27622762 }2763276327642764 wcd937x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd937x->txdev);···27672765 wcd937x->tx_sdw_dev = dev_to_sdw_dev(wcd937x->txdev);27682766 if (!wcd937x->tx_sdw_dev) {27692767 dev_err(dev, "could not get txslave with matching of dev\n");27702770- return -EINVAL;27682768+ ret = -EINVAL;27692769+ goto err_put_txdev;27712770 }2772277127732772 /*···27782775 if (!device_link_add(wcd937x->rxdev, wcd937x->txdev,27792776 DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME)) {27802777 dev_err(dev, "Could not devlink TX and RX\n");27812781- return -EINVAL;27782778+ ret = -EINVAL;27792779+ goto err_put_txdev;27822780 }2783278127842782 if (!device_link_add(dev, wcd937x->txdev,27852783 DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME)) {27862784 dev_err(dev, "Could not devlink WCD and TX\n");27872787- return -EINVAL;27852785+ ret = -EINVAL;27862786+ goto err_remove_link1;27882787 }2789278827902789 if (!device_link_add(dev, wcd937x->rxdev,27912790 DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME)) {27922791 dev_err(dev, "Could not devlink WCD and RX\n");27932793- return -EINVAL;27922792+ ret = -EINVAL;27932793+ goto err_remove_link2;27942794 }2795279527962796 wcd937x->regmap = wcd937x->sdw_priv[AIF1_CAP]->regmap;27972797 if (!wcd937x->regmap) {27982798 dev_err(dev, "could not get TX device regmap\n");27992799- return -EINVAL;27992799+ ret = -EINVAL;28002800+ goto err_remove_link3;28002801 }2801280228022803 ret = wcd937x_irq_init(wcd937x, dev);28032804 if (ret) {28042805 dev_err(dev, "IRQ init failed: %d\n", ret);28052805- return ret;28062806+ goto err_remove_link3;28062807 }2807280828082809 wcd937x->sdw_priv[AIF1_PB]->slave_irq = wcd937x->virq;···2816280928172810 ret = snd_soc_register_component(dev, &soc_codec_dev_wcd937x,28182811 wcd937x_dais, ARRAY_SIZE(wcd937x_dais));28192819- if (ret)28122812+ if (ret) {28202813 dev_err(dev, "Codec registration failed\n");28142814+ goto err_remove_link3;28152815+ }2821281628172817+ return ret;28182818+28192819+err_remove_link3:28202820+ device_link_remove(dev, wcd937x->rxdev);28212821+err_remove_link2:28222822+ device_link_remove(dev, wcd937x->txdev);28232823+err_remove_link1:28242824+ device_link_remove(wcd937x->rxdev, wcd937x->txdev);28252825+err_put_txdev:28262826+ put_device(wcd937x->txdev);28272827+err_put_rxdev:28282828+ put_device(wcd937x->rxdev);28292829+err_component_unbind:28302830+ component_unbind_all(dev, wcd937x);28222831 return ret;28232832}28242833···28482825 device_link_remove(wcd937x->rxdev, wcd937x->txdev);28492826 component_unbind_all(dev, wcd937x);28502827 mutex_destroy(&wcd937x->micb_lock);28282828+ put_device(wcd937x->txdev);28292829+ put_device(wcd937x->rxdev);28512830}2852283128532832static const struct component_master_ops wcd937x_comp_ops = {
···182182183183bpftool prog tracelog { stdout | stderr } *PROG*184184 Dump the BPF stream of the program. BPF programs can write to these streams185185- at runtime with the **bpf_stream_vprintk**\ () kfunc. The kernel may write185185+ at runtime with the **bpf_stream_vprintk_impl**\ () kfunc. The kernel may write186186 error messages to the standard error stream. This facility should be used187187 only for debugging purposes.188188
···1010 *1111 * Undefined if no set bit exists, so code should check against 0 first.1212 */1313-static __always_inline unsigned int generic___fls(unsigned long word)1313+static __always_inline __attribute_const__ unsigned int generic___fls(unsigned long word)1414{1515 unsigned int num = BITS_PER_LONG - 1;1616
+1-1
tools/include/asm-generic/bitops/fls.h
···1010 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.1111 */12121313-static __always_inline int generic_fls(unsigned int x)1313+static __always_inline __attribute_const__ int generic_fls(unsigned int x)1414{1515 int r = 32;1616
+2-2
tools/include/asm-generic/bitops/fls64.h
···1616 * at position 64.1717 */1818#if BITS_PER_LONG == 321919-static __always_inline int fls64(__u64 x)1919+static __always_inline __attribute_const__ int fls64(__u64 x)2020{2121 __u32 h = x >> 32;2222 if (h)···2424 return fls(x);2525}2626#elif BITS_PER_LONG == 642727-static __always_inline int fls64(__u64 x)2727+static __always_inline __attribute_const__ int fls64(__u64 x)2828{2929 if (x == 0)3030 return 0;
+51-12
tools/include/uapi/drm/drm.h
···597597 int drm_dd_minor;598598};599599600600-/* DRM_IOCTL_GEM_CLOSE ioctl argument type */600600+/**601601+ * struct drm_gem_close - Argument for &DRM_IOCTL_GEM_CLOSE ioctl.602602+ * @handle: Handle of the object to be closed.603603+ * @pad: Padding.604604+ *605605+ * Releases the handle to an mm object.606606+ */601607struct drm_gem_close {602602- /** Handle of the object to be closed. */603608 __u32 handle;604609 __u32 pad;605610};606611607607-/* DRM_IOCTL_GEM_FLINK ioctl argument type */612612+/**613613+ * struct drm_gem_flink - Argument for &DRM_IOCTL_GEM_FLINK ioctl.614614+ * @handle: Handle for the object being named.615615+ * @name: Returned global name.616616+ *617617+ * Create a global name for an object, returning the name.618618+ *619619+ * Note that the name does not hold a reference; when the object620620+ * is freed, the name goes away.621621+ */608622struct drm_gem_flink {609609- /** Handle for the object being named */610623 __u32 handle;611611-612612- /** Returned global name */613624 __u32 name;614625};615626616616-/* DRM_IOCTL_GEM_OPEN ioctl argument type */627627+/**628628+ * struct drm_gem_open - Argument for &DRM_IOCTL_GEM_OPEN ioctl.629629+ * @name: Name of object being opened.630630+ * @handle: Returned handle for the object.631631+ * @size: Returned size of the object632632+ *633633+ * Open an object using the global name, returning a handle and the size.634634+ *635635+ * This handle (of course) holds a reference to the object, so the object636636+ * will not go away until the handle is deleted.637637+ */617638struct drm_gem_open {618618- /** Name of object being opened */619639 __u32 name;620620-621621- /** Returned handle for the object */622640 __u32 handle;623623-624624- /** Returned size of the object */625641 __u64 size;642642+};643643+644644+/**645645+ * struct drm_gem_change_handle - Argument for &DRM_IOCTL_GEM_CHANGE_HANDLE ioctl.646646+ * @handle: The handle of a gem object.647647+ * @new_handle: An available gem handle.648648+ *649649+ * This ioctl changes the handle of a GEM object to the specified one.650650+ * The new handle must be unused. On success the old handle is closed651651+ * and all further IOCTL should refer to the new handle only.652652+ * Calls to DRM_IOCTL_PRIME_FD_TO_HANDLE will return the new handle.653653+ */654654+struct drm_gem_change_handle {655655+ __u32 handle;656656+ __u32 new_handle;626657};627658628659/**···13391308 * The call will fail if the name contains whitespaces or non-printable chars.13401309 */13411310#define DRM_IOCTL_SET_CLIENT_NAME DRM_IOWR(0xD1, struct drm_set_client_name)13111311+13121312+/**13131313+ * DRM_IOCTL_GEM_CHANGE_HANDLE - Move an object to a different handle13141314+ *13151315+ * Some applications (notably CRIU) need objects to have specific gem handles.13161316+ * This ioctl changes the object at one gem handle to use a new gem handle.13171317+ */13181318+#define DRM_IOCTL_GEM_CHANGE_HANDLE DRM_IOWR(0xD2, struct drm_gem_change_handle)1342131913431320/*13441321 * Device specific ioctls should only be in their respective headers
···354354355355FEATURE_CHECK_LDFLAGS-libaio = -lrt356356357357-FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl358358-FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl359359-360357CORE_CFLAGS += -fno-omit-frame-pointer361358CORE_CFLAGS += -Wall362359CORE_CFLAGS += -Wextra···927930928931 ifeq ($(feature-libbfd), 1)929932 EXTLIBS += -lbfd -lopcodes933933+ FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl934934+ FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl930935 else931936 # we are on a system that requires -liberty and (maybe) -lz932937 # to link against -lbfd; test each case individually here
+1
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
···345345333 common io_pgetevents sys_io_pgetevents346346334 common rseq sys_rseq347347335 common uretprobe sys_uretprobe348348+336 common uprobe sys_uprobe348349# don't use numbers 387 through 423, add new calls after the last349350# 'common' entry350351424 common pidfd_send_signal sys_pidfd_send_signal
···111111#define PIDFD_SELF_THREAD_GROUP -10001 /* Current thread group leader. */112112113113#define FD_PIDFS_ROOT -10002 /* Root of the pidfs filesystem */114114+#define FD_NSFS_ROOT -10003 /* Root of the nsfs filesystem */114115#define FD_INVALID -10009 /* Invalid file descriptor: -10000 - EBADF = -10009 */115116116117/* Generic flags for the *at(2) family of syscalls. */
+4-1
tools/perf/trace/beauty/include/uapi/linux/fs.h
···430430/* buffered IO that drops the cache after reading or writing data */431431#define RWF_DONTCACHE ((__force __kernel_rwf_t)0x00000080)432432433433+/* prevent pipe and socket writes from raising SIGPIPE */434434+#define RWF_NOSIGNAL ((__force __kernel_rwf_t)0x00000100)435435+433436/* mask of flags supported by the kernel */434437#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\435438 RWF_APPEND | RWF_NOAPPEND | RWF_ATOMIC |\436436- RWF_DONTCACHE)439439+ RWF_DONTCACHE | RWF_NOSIGNAL)437440438441#define PROCFS_IOCTL_MAGIC 'f'439442
···177177178178#define PR_GET_TID_ADDRESS 40179179180180+/*181181+ * Flags for PR_SET_THP_DISABLE are only applicable when disabling. Bit 0182182+ * is reserved, so PR_GET_THP_DISABLE can return "1 | flags", to effectively183183+ * return "1" when no flags were specified for PR_SET_THP_DISABLE.184184+ */180185#define PR_SET_THP_DISABLE 41186186+/*187187+ * Don't disable THPs when explicitly advised (e.g., MADV_HUGEPAGE /188188+ * VM_HUGEPAGE, MADV_COLLAPSE).189189+ */190190+# define PR_THP_DISABLE_EXCEPT_ADVISED (1 << 1)181191#define PR_GET_THP_DISABLE 42182192183193/*
+2-8
tools/perf/util/header.c
···1022102210231023 down_read(&env->bpf_progs.lock);1024102410251025- if (env->bpf_progs.infos_cnt == 0)10261026- goto out;10271027-10281025 ret = do_write(ff, &env->bpf_progs.infos_cnt,10291026 sizeof(env->bpf_progs.infos_cnt));10301030- if (ret < 0)10271027+ if (ret < 0 || env->bpf_progs.infos_cnt == 0)10311028 goto out;1032102910331030 root = &env->bpf_progs.infos;···1064106710651068 down_read(&env->bpf_progs.lock);1066106910671067- if (env->bpf_progs.btfs_cnt == 0)10681068- goto out;10691069-10701070 ret = do_write(ff, &env->bpf_progs.btfs_cnt,10711071 sizeof(env->bpf_progs.btfs_cnt));1072107210731073- if (ret < 0)10731073+ if (ret < 0 || env->bpf_progs.btfs_cnt == 0)10741074 goto out;1075107510761076 root = &env->bpf_progs.btfs;
···104104 * process-private attribute.105105 */106106void mutex_init_pshared(struct mutex *mtx);107107+/* Initializes a mutex that may be recursively held on the same thread. */108108+void mutex_init_recursive(struct mutex *mtx);107109void mutex_destroy(struct mutex *mtx);108110109111void mutex_lock(struct mutex *mtx) EXCLUSIVE_LOCK_FUNCTION(*mtx);
···11+#!/usr/bin/env bash22+# SPDX-License-Identifier: GPL-2.033+#44+# This selftest exercises trying to have multiple netpoll users at the same55+# time.66+#77+# This selftest has multiple smalls test inside, and the goal is to88+# get interfaces with bonding and netconsole in different orders in order99+# to catch any possible issue.1010+#1111+# The main test composes of four interfaces being created using netdevsim; two1212+# of them are bonded to serve as the netconsole's transmit interface. The1313+# remaining two interfaces are similarly bonded and assigned to a separate1414+# network namespace, which acts as the receive interface, where socat monitors1515+# for incoming messages.1616+#1717+# A netconsole message is then sent to ensure it is properly received across1818+# this configuration.1919+#2020+# Later, run a few other tests, to make sure that bonding and netconsole2121+# cannot coexist.2222+#2323+# The test's objective is to exercise netpoll usage when managed simultaneously2424+# by multiple subsystems (netconsole and bonding).2525+#2626+# Author: Breno Leitao <leitao@debian.org>2727+2828+set -euo pipefail2929+3030+SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")3131+3232+source "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh3333+3434+modprobe netdevsim 2> /dev/null || true3535+modprobe netconsole 2> /dev/null || true3636+modprobe bonding 2> /dev/null || true3737+modprobe veth 2> /dev/null || true3838+3939+# The content of kmsg will be save to the following file4040+OUTPUT_FILE="/tmp/${TARGET}"4141+4242+# Check for basic system dependency and exit if not found4343+check_for_dependencies4444+# Set current loglevel to KERN_INFO(6), and default to KERN_NOTICE(5)4545+echo "6 5" > /proc/sys/kernel/printk4646+# Remove the namespace, interfaces and netconsole target on exit4747+trap cleanup_bond EXIT4848+4949+FORMAT="extended"5050+IP_VERSION="ipv4"5151+VETH0="veth"$(( RANDOM % 256))5252+VETH1="veth"$((256 + RANDOM % 256))5353+TXNS=""5454+RXNS=""5555+5656+# Create "bond_tx_XX" and "bond_rx_XX" interfaces, and set DSTIF and SRCIF with5757+# the bonding interfaces5858+function setup_bonding_ifaces() {5959+ local RAND=$(( RANDOM % 100 ))6060+ BOND_TX_MAIN_IF="bond_tx_$RAND"6161+ BOND_RX_MAIN_IF="bond_rx_$RAND"6262+6363+ # Setup TX6464+ if ! ip -n "${TXNS}" link add "${BOND_TX_MAIN_IF}" type bond mode balance-rr6565+ then6666+ echo "Failed to create bond TX interface. Is CONFIG_BONDING set?" >&26767+ # only clean nsim ifaces and namespace. Nothing else has been6868+ # initialized6969+ cleanup_bond_nsim7070+ trap - EXIT7171+ exit "${ksft_skip}"7272+ fi7373+7474+ # create_netdevsim() got the interface up, but it needs to be down7575+ # before being enslaved.7676+ ip -n "${TXNS}" \7777+ link set "${BOND_TX1_SLAVE_IF}" down7878+ ip -n "${TXNS}" \7979+ link set "${BOND_TX2_SLAVE_IF}" down8080+ ip -n "${TXNS}" \8181+ link set "${BOND_TX1_SLAVE_IF}" master "${BOND_TX_MAIN_IF}"8282+ ip -n "${TXNS}" \8383+ link set "${BOND_TX2_SLAVE_IF}" master "${BOND_TX_MAIN_IF}"8484+ ip -n "${TXNS}" \8585+ link set "${BOND_TX_MAIN_IF}" up8686+8787+ # Setup RX8888+ ip -n "${RXNS}" \8989+ link add "${BOND_RX_MAIN_IF}" type bond mode balance-rr9090+ ip -n "${RXNS}" \9191+ link set "${BOND_RX1_SLAVE_IF}" down9292+ ip -n "${RXNS}" \9393+ link set "${BOND_RX2_SLAVE_IF}" down9494+ ip -n "${RXNS}" \9595+ link set "${BOND_RX1_SLAVE_IF}" master "${BOND_RX_MAIN_IF}"9696+ ip -n "${RXNS}" \9797+ link set "${BOND_RX2_SLAVE_IF}" master "${BOND_RX_MAIN_IF}"9898+ ip -n "${RXNS}" \9999+ link set "${BOND_RX_MAIN_IF}" up100100+101101+ export DSTIF="${BOND_RX_MAIN_IF}"102102+ export SRCIF="${BOND_TX_MAIN_IF}"103103+}104104+105105+# Create 4 netdevsim interfaces. Two of them will be bound to TX bonding iface106106+# and the other two will be bond to the RX interface (on the other namespace)107107+function create_ifaces_bond() {108108+ BOND_TX1_SLAVE_IF=$(create_netdevsim "${NSIM_BOND_TX_1}" "${TXNS}")109109+ BOND_TX2_SLAVE_IF=$(create_netdevsim "${NSIM_BOND_TX_2}" "${TXNS}")110110+ BOND_RX1_SLAVE_IF=$(create_netdevsim "${NSIM_BOND_RX_1}" "${RXNS}")111111+ BOND_RX2_SLAVE_IF=$(create_netdevsim "${NSIM_BOND_RX_2}" "${RXNS}")112112+}113113+114114+# netdevsim link BOND_TX to BOND_RX interfaces115115+function link_ifaces_bond() {116116+ local BOND_TX1_SLAVE_IFIDX117117+ local BOND_TX2_SLAVE_IFIDX118118+ local BOND_RX1_SLAVE_IFIDX119119+ local BOND_RX2_SLAVE_IFIDX120120+ local TXNS_FD121121+ local RXNS_FD122122+123123+ BOND_TX1_SLAVE_IFIDX=$(ip netns exec "${TXNS}" \124124+ cat /sys/class/net/"$BOND_TX1_SLAVE_IF"/ifindex)125125+ BOND_TX2_SLAVE_IFIDX=$(ip netns exec "${TXNS}" \126126+ cat /sys/class/net/"$BOND_TX2_SLAVE_IF"/ifindex)127127+ BOND_RX1_SLAVE_IFIDX=$(ip netns exec "${RXNS}" \128128+ cat /sys/class/net/"$BOND_RX1_SLAVE_IF"/ifindex)129129+ BOND_RX2_SLAVE_IFIDX=$(ip netns exec "${RXNS}" \130130+ cat /sys/class/net/"$BOND_RX2_SLAVE_IF"/ifindex)131131+132132+ exec {TXNS_FD}</var/run/netns/"${TXNS}"133133+ exec {RXNS_FD}</var/run/netns/"${RXNS}"134134+135135+ # Linking TX ifaces to the RX ones (on the other namespace)136136+ echo "${TXNS_FD}:$BOND_TX1_SLAVE_IFIDX $RXNS_FD:$BOND_RX1_SLAVE_IFIDX" \137137+ > "$NSIM_DEV_SYS_LINK"138138+ echo "${TXNS_FD}:$BOND_TX2_SLAVE_IFIDX $RXNS_FD:$BOND_RX2_SLAVE_IFIDX" \139139+ > "$NSIM_DEV_SYS_LINK"140140+141141+ exec {TXNS_FD}<&-142142+ exec {RXNS_FD}<&-143143+}144144+145145+function create_all_ifaces() {146146+ # setup_ns function is coming from lib.sh147147+ setup_ns TXNS RXNS148148+ export NAMESPACE="${RXNS}"149149+150150+ # Create two interfaces for RX and two for TX151151+ create_ifaces_bond152152+ # Link netlink ifaces153153+ link_ifaces_bond154154+}155155+156156+# configure DSTIF and SRCIF IPs157157+function configure_ifaces_ips() {158158+ local IP_VERSION=${1:-"ipv4"}159159+ select_ipv4_or_ipv6 "${IP_VERSION}"160160+161161+ ip -n "${RXNS}" addr add "${DSTIP}"/24 dev "${DSTIF}"162162+ ip -n "${RXNS}" link set "${DSTIF}" up163163+164164+ ip -n "${TXNS}" addr add "${SRCIP}"/24 dev "${SRCIF}"165165+ ip -n "${TXNS}" link set "${SRCIF}" up166166+}167167+168168+function test_enable_netpoll_on_enslaved_iface() {169169+ echo 0 > "${NETCONS_PATH}"/enabled170170+171171+ # At this stage, BOND_TX1_SLAVE_IF is enslaved to BOND_TX_MAIN_IF, and172172+ # linked to BOND_RX1_SLAVE_IF inside the namespace.173173+ echo "${BOND_TX1_SLAVE_IF}" > "${NETCONS_PATH}"/dev_name174174+175175+ # This should fail with the following message in dmesg:176176+ # netpoll: netconsole: ethX is a slave device, aborting177177+ set +e178178+ enable_netcons_ns 2> /dev/null179179+ set -e180180+181181+ if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 1 ]]182182+ then183183+ echo "test failed: Bonding and netpoll cannot co-exists." >&2184184+ exit "${ksft_fail}"185185+ fi186186+}187187+188188+function test_delete_bond_and_reenable_target() {189189+ ip -n "${TXNS}" \190190+ link delete "${BOND_TX_MAIN_IF}" type bond191191+192192+ # BOND_TX1_SLAVE_IF is not attached to a bond interface anymore193193+ # netpoll can be plugged in there194194+ echo "${BOND_TX1_SLAVE_IF}" > "${NETCONS_PATH}"/dev_name195195+196196+ # this should work, since the interface is not enslaved197197+ enable_netcons_ns198198+199199+ if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 0 ]]200200+ then201201+ echo "test failed: Unable to start netpoll on an unbond iface." >&2202202+ exit "${ksft_fail}"203203+ fi204204+}205205+206206+# Send a netconsole message to the netconsole target207207+function test_send_netcons_msg_through_bond_iface() {208208+ # Listen for netconsole port inside the namespace and209209+ # destination interface210210+ listen_port_and_save_to "${OUTPUT_FILE}" "${IP_VERSION}" &211211+ # Wait for socat to start and listen to the port.212212+ wait_for_port "${RXNS}" "${PORT}" "${IP_VERSION}"213213+ # Send the message214214+ echo "${MSG}: ${TARGET}" > /dev/kmsg215215+ # Wait until socat saves the file to disk216216+ busywait "${BUSYWAIT_TIMEOUT}" test -s "${OUTPUT_FILE}"217217+ # Make sure the message was received in the dst part218218+ # and exit219219+ validate_result "${OUTPUT_FILE}" "${FORMAT}"220220+ # kill socat in case it is still running221221+ pkill_socat222222+}223223+224224+# BOND_TX1_SLAVE_IF has netconsole enabled on it, bind it to BOND_TX_MAIN_IF.225225+# Given BOND_TX_MAIN_IF was deleted, recreate it first226226+function test_enslave_netcons_enabled_iface {227227+ # netconsole got disabled while the interface was down228228+ if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 0 ]]229229+ then230230+ echo "test failed: netconsole expected to be enabled against BOND_TX1_SLAVE_IF" >&2231231+ exit "${ksft_fail}"232232+ fi233233+234234+ # recreate the bonding iface. it got deleted by previous235235+ # test (test_delete_bond_and_reenable_target)236236+ ip -n "${TXNS}" \237237+ link add "${BOND_TX_MAIN_IF}" type bond mode balance-rr238238+239239+ # sub-interface need to be down before attaching to bonding240240+ # This will also disable netconsole.241241+ ip -n "${TXNS}" \242242+ link set "${BOND_TX1_SLAVE_IF}" down243243+ ip -n "${TXNS}" \244244+ link set "${BOND_TX1_SLAVE_IF}" master "${BOND_TX_MAIN_IF}"245245+ ip -n "${TXNS}" \246246+ link set "${BOND_TX_MAIN_IF}" up247247+248248+ # netconsole got disabled while the interface was down249249+ if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 1 ]]250250+ then251251+ echo "test failed: Device is part of a bond iface, cannot have netcons enabled" >&2252252+ exit "${ksft_fail}"253253+ fi254254+}255255+256256+# Get netconsole enabled on a bonding interface and attach a second257257+# sub-interface.258258+function test_enslave_iface_to_bond {259259+ # BOND_TX_MAIN_IF has only BOND_TX1_SLAVE_IF right now260260+ echo "${BOND_TX_MAIN_IF}" > "${NETCONS_PATH}"/dev_name261261+ enable_netcons_ns262262+263263+ # netcons is attached to bond0 and BOND_TX1_SLAVE_IF is264264+ # part of BOND_TX_MAIN_IF. Attach BOND_TX2_SLAVE_IF to BOND_TX_MAIN_IF.265265+ ip -n "${TXNS}" \266266+ link set "${BOND_TX2_SLAVE_IF}" master "${BOND_TX_MAIN_IF}"267267+ if [[ $(cat "${NETCONS_PATH}"/enabled) -eq 0 ]]268268+ then269269+ echo "test failed: Netconsole should be enabled on bonding interface. Failed" >&2270270+ exit "${ksft_fail}"271271+ fi272272+}273273+274274+function test_enslave_iff_disabled_netpoll_iface {275275+ local ret276276+277277+ # Create two interfaces. veth interfaces it known to have278278+ # IFF_DISABLE_NETPOLL set279279+ if ! ip link add "${VETH0}" type veth peer name "${VETH1}"280280+ then281281+ echo "Failed to create veth TX interface. Is CONFIG_VETH set?" >&2282282+ exit "${ksft_skip}"283283+ fi284284+ set +e285285+ # This will print RTNETLINK answers: Device or resource busy286286+ ip link set "${VETH0}" master "${BOND_TX_MAIN_IF}" 2> /dev/null287287+ ret=$?288288+ set -e289289+ if [[ $ret -eq 0 ]]290290+ then291291+ echo "test failed: veth interface could not be enslaved"292292+ exit "${ksft_fail}"293293+ fi294294+}295295+296296+# Given that netconsole picks the current net namespace, we need to enable it297297+# from inside the TXNS namespace298298+function enable_netcons_ns() {299299+ ip netns exec "${TXNS}" sh -c \300300+ "mount -t configfs configfs /sys/kernel/config && echo 1 > $NETCONS_PATH/enabled"301301+}302302+303303+####################304304+# Tests start here #305305+####################306306+307307+# Create regular interfaces using netdevsim and link them308308+create_all_ifaces309309+310310+# Setup the bonding interfaces311311+# BOND_RX_MAIN_IF has BOND_RX{1,2}_SLAVE_IF312312+# BOND_TX_MAIN_IF has BOND_TX{1,2}_SLAVE_IF313313+setup_bonding_ifaces314314+315315+# Configure the ips as BOND_RX1_SLAVE_IF and BOND_TX1_SLAVE_IF316316+configure_ifaces_ips "${IP_VERSION}"317317+318318+_create_dynamic_target "${FORMAT}" "${NETCONS_PATH}"319319+enable_netcons_ns320320+set_user_data321321+322322+# Test #1 : Create an bonding interface and attach netpoll into323323+# the bonding interface. Netconsole/netpoll should work on324324+# the bonding interface.325325+test_send_netcons_msg_through_bond_iface326326+echo "test #1: netpoll on bonding interface worked. Test passed" >&2327327+328328+# Test #2: Attach netpoll to an enslaved interface329329+# Try to attach netpoll to an enslaved sub-interface (while still being part of330330+# a bonding interface), which shouldn't be allowed331331+test_enable_netpoll_on_enslaved_iface332332+echo "test #2: netpoll correctly rejected enslaved interface (expected behavior). Test passed." >&2333333+334334+# Test #3: Unplug the sub-interface from bond and enable netconsole335335+# Detach the interface from a bonding interface and attach netpoll again336336+test_delete_bond_and_reenable_target337337+echo "test #3: Able to attach to an unbound interface. Test passed." >&2338338+339339+# Test #4: Enslave a sub-interface that had netconsole enabled340340+# Try to enslave an interface that has netconsole/netpoll enabled.341341+# Previous test has netconsole enabled in BOND_TX1_SLAVE_IF, try to enslave it342342+test_enslave_netcons_enabled_iface343343+echo "test #4: Enslaving an interface with netpoll attached. Test passed." >&2344344+345345+# Test #5: Enslave a sub-interface to a bonding interface346346+# Enslave an interface to a bond interface that has netpoll attached347347+# At this stage, BOND_TX_MAIN_IF is created and BOND_TX1_SLAVE_IF is part of348348+# it. Netconsole is currently disabled349349+test_enslave_iface_to_bond350350+echo "test #5: Enslaving an interface to bond+netpoll. Test passed." >&2351351+352352+# Test #6: Enslave a IFF_DISABLE_NETPOLL sub-interface to a bonding interface353353+# At this stage, BOND_TX_MAIN_IF has both sub interface and netconsole is354354+# enabled. This test will try to enslave an a veth (IFF_DISABLE_NETPOLL) interface355355+# and it should fail, with netpoll: veth0 doesn't support polling356356+test_enslave_iff_disabled_netpoll_iface357357+echo "test #6: Enslaving IFF_DISABLE_NETPOLL ifaces to bond iface is not supported. Test passed." >&2358358+359359+cleanup_bond360360+trap - EXIT361361+exit "${EXIT_STATUS}"
···1111LIBDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")12121313SRCIF="" # to be populated later1414+SRCIP="" # to be populated later1415SRCIP4="192.0.2.1"1516SRCIP6="fc00::1"1617DSTIF="" # to be populated later1818+DSTIP="" # to be populated later1719DSTIP4="192.0.2.2"1820DSTIP6="fc00::2"1921···3028# NAMESPACE will be populated by setup_ns with a random value3129NAMESPACE=""32303333-# IDs for netdevsim3131+# IDs for netdevsim. We either use NSIM_DEV_{1,2}_ID for standard test3232+# or NSIM_BOND_{T,R}X_{1,2} for the bonding tests. Not both at the3333+# same time.3434NSIM_DEV_1_ID=$((256 + RANDOM % 256))3535NSIM_DEV_2_ID=$((512 + RANDOM % 256))3636+NSIM_BOND_TX_1=$((768 + RANDOM % 256))3737+NSIM_BOND_TX_2=$((1024 + RANDOM % 256))3838+NSIM_BOND_RX_1=$((1280 + RANDOM % 256))3939+NSIM_BOND_RX_2=$((1536 + RANDOM % 256))3640NSIM_DEV_SYS_NEW="/sys/bus/netdevsim/new_device"4141+NSIM_DEV_SYS_LINK="/sys/bus/netdevsim/link_device"37423843# Used to create and delete namespaces3944source "${LIBDIR}"/../../../../net/lib.sh40454146# Create netdevsim interfaces4247create_ifaces() {4343-4448 echo "$NSIM_DEV_2_ID" > "$NSIM_DEV_SYS_NEW"4549 echo "$NSIM_DEV_1_ID" > "$NSIM_DEV_SYS_NEW"4650 udevadm settle 2> /dev/null || true···121113 configure_ip122114}123115124124-function create_dynamic_target() {125125- local FORMAT=${1:-"extended"}116116+function _create_dynamic_target() {117117+ local FORMAT="${1:?FORMAT parameter required}"118118+ local NCPATH="${2:?NCPATH parameter required}"126119127120 DSTMAC=$(ip netns exec "${NAMESPACE}" \128121 ip link show "${DSTIF}" | awk '/ether/ {print $2}')129122130123 # Create a dynamic target131131- mkdir "${NETCONS_PATH}"124124+ mkdir "${NCPATH}"132125133133- echo "${DSTIP}" > "${NETCONS_PATH}"/remote_ip134134- echo "${SRCIP}" > "${NETCONS_PATH}"/local_ip135135- echo "${DSTMAC}" > "${NETCONS_PATH}"/remote_mac136136- echo "${SRCIF}" > "${NETCONS_PATH}"/dev_name126126+ echo "${DSTIP}" > "${NCPATH}"/remote_ip127127+ echo "${SRCIP}" > "${NCPATH}"/local_ip128128+ echo "${DSTMAC}" > "${NCPATH}"/remote_mac129129+ echo "${SRCIF}" > "${NCPATH}"/dev_name137130138131 if [ "${FORMAT}" == "basic" ]139132 then140133 # Basic target does not support release141141- echo 0 > "${NETCONS_PATH}"/release142142- echo 0 > "${NETCONS_PATH}"/extended134134+ echo 0 > "${NCPATH}"/release135135+ echo 0 > "${NCPATH}"/extended143136 elif [ "${FORMAT}" == "extended" ]144137 then145145- echo 1 > "${NETCONS_PATH}"/extended138138+ echo 1 > "${NCPATH}"/extended146139 fi140140+}147141148148- echo 1 > "${NETCONS_PATH}"/enabled142142+function create_dynamic_target() {143143+ local FORMAT=${1:-"extended"}144144+ local NCPATH=${2:-"$NETCONS_PATH"}145145+ _create_dynamic_target "${FORMAT}" "${NCPATH}"146146+147147+ echo 1 > "${NCPATH}"/enabled149148150149 # This will make sure that the kernel was able to151150 # load the netconsole driver configuration. The console message···200185 echo "${DEFAULT_PRINTK_VALUES}" > /proc/sys/kernel/printk201186}202187203203-function cleanup() {188188+function cleanup_netcons() {204189 # delete netconsole dynamic reconfiguration205205- echo 0 > "${NETCONS_PATH}"/enabled190190+ # do not fail if the target is already disabled191191+ if [[ ! -d "${NETCONS_PATH}" ]]192192+ then193193+ # in some cases this is called before netcons path is created194194+ return195195+ fi196196+ if [[ $(cat "${NETCONS_PATH}"/enabled) != 0 ]]197197+ then198198+ echo 0 > "${NETCONS_PATH}"/enabled || true199199+ fi206200 # Remove all the keys that got created during the selftest207201 find "${NETCONS_PATH}/userdata/" -mindepth 1 -type d -delete208202 # Remove the configfs entry209203 rmdir "${NETCONS_PATH}"204204+}210205206206+function cleanup() {207207+ cleanup_netcons211208 do_cleanup212209}213210···395368 # otherwise the packet could be missed, and the test will fail. Happens396369 # more frequently on IPv6397370 sleep 1371371+}372372+373373+# Clean up netdevsim ifaces created for bonding test374374+function cleanup_bond_nsim() {375375+ ip -n "${TXNS}" \376376+ link delete "${BOND_TX_MAIN_IF}" type bond || true377377+ ip -n "${RXNS}" \378378+ link delete "${BOND_RX_MAIN_IF}" type bond || true379379+380380+ cleanup_netdevsim "$NSIM_BOND_TX_1"381381+ cleanup_netdevsim "$NSIM_BOND_TX_2"382382+ cleanup_netdevsim "$NSIM_BOND_RX_1"383383+ cleanup_netdevsim "$NSIM_BOND_RX_2"384384+}385385+386386+# cleanup tests that use bonding interfaces387387+function cleanup_bond() {388388+ cleanup_netcons389389+ cleanup_bond_nsim390390+ cleanup_all_ns391391+ ip link delete "${VETH0}" || true398392}
···11+#!/usr/bin/env bash22+# SPDX-License-Identifier: GPL-2.033+44+# Repeatedly send kernel messages, toggles netconsole targets on and off,55+# creates and deletes targets in parallel, and toggles the source interface to66+# simulate stress conditions.77+#88+# This test aims to verify the robustness of netconsole under dynamic99+# configurations and concurrent operations.1010+#1111+# The major goal is to run this test with LOCKDEP, Kmemleak and KASAN to make1212+# sure no issues is reported.1313+#1414+# Author: Breno Leitao <leitao@debian.org>1515+1616+set -euo pipefail1717+1818+SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")1919+2020+source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh2121+2222+# Number of times the main loop run2323+ITERATIONS=${1:-150}2424+2525+# Only test extended format2626+FORMAT="extended"2727+# And ipv6 only2828+IP_VERSION="ipv6"2929+3030+# Create, enable and delete some targets.3131+create_and_delete_random_target() {3232+ COUNT=23333+ RND_PREFIX=$(mktemp -u netcons_rnd_XXXX_)3434+3535+ if [ -d "${NETCONS_CONFIGFS}/${RND_PREFIX}${COUNT}" ] || \3636+ [ -d "${NETCONS_CONFIGFS}/${RND_PREFIX}0" ]; then3737+ echo "Function didn't finish yet, skipping it." >&23838+ return3939+ fi4040+4141+ # enable COUNT targets4242+ for i in $(seq ${COUNT})4343+ do4444+ RND_TARGET="${RND_PREFIX}"${i}4545+ RND_TARGET_PATH="${NETCONS_CONFIGFS}"/"${RND_TARGET}"4646+4747+ # Basic population so the target can come up4848+ _create_dynamic_target "${FORMAT}" "${RND_TARGET_PATH}"4949+ done5050+5151+ echo "netconsole selftest: ${COUNT} additional targets were created" > /dev/kmsg5252+ # disable them all5353+ for i in $(seq ${COUNT})5454+ do5555+ RND_TARGET="${RND_PREFIX}"${i}5656+ RND_TARGET_PATH="${NETCONS_CONFIGFS}"/"${RND_TARGET}"5757+ if [[ $(cat "${RND_TARGET_PATH}/enabled") -eq 1 ]]5858+ then5959+ echo 0 > "${RND_TARGET_PATH}"/enabled6060+ fi6161+ rmdir "${RND_TARGET_PATH}"6262+ done6363+}6464+6565+# Disable and enable the target mid-air, while messages6666+# are being transmitted.6767+toggle_netcons_target() {6868+ for i in $(seq 2)6969+ do7070+ if [ ! -d "${NETCONS_PATH}" ]7171+ then7272+ break7373+ fi7474+ echo 0 > "${NETCONS_PATH}"/enabled 2> /dev/null || true7575+ # Try to enable a bit harder, given it might fail to enable7676+ # Write to `enabled` might fail depending on the lock, which is7777+ # highly contentious here7878+ for _ in $(seq 5)7979+ do8080+ echo 1 > "${NETCONS_PATH}"/enabled 2> /dev/null || true8181+ done8282+ done8383+}8484+8585+toggle_iface(){8686+ ip link set "${SRCIF}" down8787+ ip link set "${SRCIF}" up8888+}8989+9090+# Start here9191+9292+modprobe netdevsim 2> /dev/null || true9393+modprobe netconsole 2> /dev/null || true9494+9595+# Check for basic system dependency and exit if not found9696+check_for_dependencies9797+# Set current loglevel to KERN_INFO(6), and default to KERN_NOTICE(5)9898+echo "6 5" > /proc/sys/kernel/printk9999+# Remove the namespace, interfaces and netconsole target on exit100100+trap cleanup EXIT101101+# Create one namespace and two interfaces102102+set_network "${IP_VERSION}"103103+# Create a dynamic target for netconsole104104+create_dynamic_target "${FORMAT}"105105+106106+for i in $(seq "$ITERATIONS")107107+do108108+ for _ in $(seq 10)109109+ do110110+ echo "${MSG}: ${TARGET} ${i}" > /dev/kmsg111111+ done112112+ wait113113+114114+ if (( i % 30 == 0 )); then115115+ toggle_netcons_target &116116+ fi117117+118118+ if (( i % 50 == 0 )); then119119+ # create some targets, enable them, send msg and disable120120+ # all in a parallel thread121121+ create_and_delete_random_target &122122+ fi123123+124124+ if (( i % 70 == 0 )); then125125+ toggle_iface &126126+ fi127127+done128128+wait129129+130130+exit "${EXIT_STATUS}"
···2020 udp_tunnel_nic.sh \2121# end of TEST_PROGS22222323+TEST_FILES := \2424+ ethtool-common.sh2525+# end of TEST_FILES2626+2327include ../../../lib.mk
···17251725"-n, --notrace\t\tIf latency is detected, do not print out the content of\n"17261726"\t\t\tthe trace file to standard output\n\n"1727172717281728-"-t, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n"17281728+"-e, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n"1729172917301730"-r, --random\t\tArbitrarily sleep a certain amount of time, default\n"17311731"\t\t\t%ld ms, before reading the trace file. The\n"
+33-14
virt/kvm/guest_memfd.c
···623623 return r;624624}625625626626-void kvm_gmem_unbind(struct kvm_memory_slot *slot)626626+static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct kvm_gmem *gmem)627627{628628 unsigned long start = slot->gmem.pgoff;629629 unsigned long end = start + slot->npages;630630- struct kvm_gmem *gmem;631631- struct file *file;632630633633- /*634634- * Nothing to do if the underlying file was already closed (or is being635635- * closed right now), kvm_gmem_release() invalidates all bindings.636636- */637637- file = kvm_gmem_get_file(slot);638638- if (!file)639639- return;640640-641641- gmem = file->private_data;642642-643643- filemap_invalidate_lock(file->f_mapping);644631 xa_store_range(&gmem->bindings, start, end - 1, NULL, GFP_KERNEL);645632646633 /*···635648 * cannot see this memslot.636649 */637650 WRITE_ONCE(slot->gmem.file, NULL);651651+}652652+653653+void kvm_gmem_unbind(struct kvm_memory_slot *slot)654654+{655655+ struct file *file;656656+657657+ /*658658+ * Nothing to do if the underlying file was _already_ closed, as659659+ * kvm_gmem_release() invalidates and nullifies all bindings.660660+ */661661+ if (!slot->gmem.file)662662+ return;663663+664664+ file = kvm_gmem_get_file(slot);665665+666666+ /*667667+ * However, if the file is _being_ closed, then the bindings need to be668668+ * removed as kvm_gmem_release() might not run until after the memslot669669+ * is freed. Note, modifying the bindings is safe even though the file670670+ * is dying as kvm_gmem_release() nullifies slot->gmem.file under671671+ * slots_lock, and only puts its reference to KVM after destroying all672672+ * bindings. I.e. reaching this point means kvm_gmem_release() hasn't673673+ * yet destroyed the bindings or freed the gmem_file, and can't do so674674+ * until the caller drops slots_lock.675675+ */676676+ if (!file) {677677+ __kvm_gmem_unbind(slot, slot->gmem.file->private_data);678678+ return;679679+ }680680+681681+ filemap_invalidate_lock(file->f_mapping);682682+ __kvm_gmem_unbind(slot, file->private_data);638683 filemap_invalidate_unlock(file->f_mapping);639684640685 fput(file);