Re: [PATCHv2 pci-next 2/2] PCI/AER: Rate limit the reporting of the correctable errors
On Wed, May 17, 2023 at 9:03 AM Bjorn Helgaas wrote: > > On Fri, Apr 07, 2023 at 04:46:03PM -0700, Grant Grundler wrote: > > On Fri, Apr 7, 2023 at 12:46 PM Bjorn Helgaas wrote: > > > On Fri, Apr 07, 2023 at 11:53:27AM -0700, Grant Grundler wrote: > > > > On Thu, Apr 6, 2023 at 12:50 PM Bjorn Helgaas > > > wrote: > > > > > On Fri, Mar 17, 2023 at 10:51:09AM -0700, Grant Grundler wrote: > > > > > > From: Rajat Khandelwal > > > > > > > > > > > > There are many instances where correctable errors tend to inundate > > > > > > the message buffer. We observe such instances during thunderbolt > > > > > > PCIe > > > > > > tunneling. > > > > ... > > > > > > > > > if (info->severity == AER_CORRECTABLE) > > > > > > - pci_info(dev, " [%2d] %-22s%s\n", i, errmsg, > > > > > > - info->first_error == i ? " (First)" : > > > ""); > > > > > > + pci_info_ratelimited(dev, " [%2d] > > > %-22s%s\n", i, errmsg, > > > > > > + info->first_error == i ? > > > " (First)" : ""); > > > > > > > > > > I don't think this is going to reliably work the way we want. We have > > > > > a bunch of pci_info_ratelimited() calls, and each caller has its own > > > > > ratelimit_state data. Unless we call pci_info_ratelimited() exactly > > > > > the same number of times for each error, the ratelimit counters will > > > > > get out of sync and we'll end up printing fragments from error A mixed > > > > > with fragments from error B. Despite consolidating the error output, my impression is this is still possible. :( ... > > > Rate-limiting is per call location, so yes, if we only have one call > > > location, that would solve it. It would also have the nice property > > > that all the output would be atomic so it wouldn't get mixed with > > > other stuff, and it might encourage us to be a little less wordy in > > > the output. Unfortunately, I think this needs further surgery. > > +1 to all of those reasons. Especially reducing the number of lines output. > > > > I'm going to be out for the next week. If someone else (Rajat Kendalwal > > maybe?) wants to rework this to use one call location it should be fairly > > straight forward. If not, I'll tackle this when I'm back (in 2 weeks > > essentially). > > Ping? Really hoping to merge this for v6.5. I've appended what I have now... but there are still two issues: 1) we still end up with two "pci_info_ratelimited" call locations: one in aer_print_err() and another in __aer_print_err(). 2) I just noticed both functions output info->status and info->mask (so this ends up getting printed twice in different formats). and that's not really even looking carefully at the other call site: cper_print_aer() If this is "good enough" for now, I can repost as v3. cheers, grant From 5ee8c86ce0496be66784eff94e0b165be33f83f4 Mon Sep 17 00:00:00 2001 From: Grant Grundler Date: Tue, 28 Feb 2023 22:04:53 -0800 Subject: [PATCH 1/2] PCI/AER: correctable error message as KERN_INFO Since correctable errors have been corrected (and counted), the dmesg output should not be reported as a warning, but rather as "informational". Otherwise, using a certain well known vendor's PCIe parts in a USB4 docking station, the dmesg buffer can be spammed with correctable errors, 717 bytes per instance, potentially many MB per day. Given the "WARN" priority, these messages have already confused the typical user that stumbles across them, support staff (triaging feedback reports), and more than a few linux kernel devs. Changing to INFO will hide these messages from most audiences. Signed-off-by: Grant Grundler --- drivers/pci/pcie/aer.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index f6c24ded134c..d7bfc6070ddb 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -692,7 +692,7 @@ static void __aer_print_error(struct pci_dev *dev, if (info->severity == AER_CORRECTABLE) { strings = aer_correctable_error_string; - level = KERN_WARNING; + level = KERN_INFO; } else { strings = aer_uncorrectable_error_string; level = KERN_ERR; @@ -724,7 +724,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) layer = AER_GET_LAYER_ERROR(info->severity, info->status); agent = AER_GET_AGENT(info->severity, info->status); - level = (info->severity == AER_CORRECTABLE) ? KERN_WARNING : KERN_ERR; + level = (info->severity == AER_CORRECTABLE) ? KERN_INFO : KERN_ERR; pci_printk(level, dev, "PCIe Bus Error: severity=%s, type=%s, (%s)\n", aer_error_severity_string[info->severity], @@ -797,14 +797,22 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity, info.mask = mask; info.first_error = PCI_ERR_CAP_FEP(aer->cap_control); - pci_err(dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", status, mask); + if (aer_severity == AER_CORRECTABLE) + pci_info(dev,
Re: [PATCH v2 00/25] iommu: Make default_domain's mandatory
On Mon, May 15, 2023 at 09:00:33PM -0300, Jason Gunthorpe wrote: > This is on github: > https://github.com/jgunthorpe/linux/commits/iommu_all_defdom Ran some VFIO-passthrough sanity on x86 and ARM64, using this branch. It should cover partially this series. So, if I may: Tested-by: Nicolin Chen Thanks Nic > v2: > - FSL is an IDENTITY domain > - Delete terga-gart instead of trying to carry it > - Use the policy determination from iommu_get_default_domain_type() to >drive the arm_iommu mode > - Reorganize and introduce new patches to do the above: > * Split the ops->identity_domain to an independent earlier patch > * Remove the UNMANAGED return from def_domain_type in mtk_v1 earlier > so the new iommu_get_default_domain_type() can work > * Make the driver's def_domain_type have higher policy priority than > untrusted > * Merge the set_platfom_dma_ops hunk from mtk_v1 along with rockchip > into the patch that forced IDENTITY on ARM32 > - Revise sun50i to be cleaner and have a non-NULL internal domain > - Reword logging in exynos > - Remove the gdev from the group alloc path, instead add a new >function __iommu_group_domain_alloc() that takes in the group >and uses the first device. Split this to its own patch > - New patch to make iommufd's mock selftest into a real driver > - New patch to fix power's partial iommu driver
Re: [PATCH 09/14] kunit: include debugfs header file
On Wed, 17 May 2023 at 21:12, Arnd Bergmann wrote: > > From: Arnd Bergmann > > An extra #include statement is needed to ensure the prototypes > for debugfs interfaces are visible, avoiding this warning: > > lib/kunit/debugfs.c:28:6: error: no previous prototype for > 'kunit_debugfs_cleanup' [-Werror=missing-prototypes] > lib/kunit/debugfs.c:33:6: error: no previous prototype for > 'kunit_debugfs_init' [-Werror=missing-prototypes] > lib/kunit/debugfs.c:102:6: error: no previous prototype for > 'kunit_debugfs_create_suite' [-Werror=missing-prototypes] > lib/kunit/debugfs.c:118:6: error: no previous prototype for > 'kunit_debugfs_destroy_suite' [-Werror=missing-prototypes] > > Signed-off-by: Arnd Bergmann > --- Nice catch, thanks. I'm fine with this going in via -mm, but if you'd prefer it to go via kselftest/kunit, let me know. Reviewed-by: David Gow Cheers, -- David > lib/kunit/debugfs.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c > index b08bb1fba106..22c5c496a68f 100644 > --- a/lib/kunit/debugfs.c > +++ b/lib/kunit/debugfs.c > @@ -10,6 +10,7 @@ > #include > > #include "string-stream.h" > +#include "debugfs.h" > > #define KUNIT_DEBUGFS_ROOT "kunit" > #define KUNIT_DEBUGFS_RESULTS "results" > -- > 2.39.2 > > -- > You received this message because you are subscribed to the Google Groups > "KUnit Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to kunit-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/kunit-dev/20230517131102.934196-10-arnd%40kernel.org. smime.p7s Description: S/MIME Cryptographic Signature
[powerpc:fixes] BUILD SUCCESS 1f7aacc5eb9ed2cc17be7a90da5cd559effb9d59
tree/branch: INFO setup_repo_specs: /db/releases/20230517200055/lkp-src/repo/*/powerpc https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes branch HEAD: 1f7aacc5eb9ed2cc17be7a90da5cd559effb9d59 powerpc/iommu: Incorrect DDW Table is referenced for SR-IOV device elapsed time: 725m configs tested: 181 configs skipped: 152 The following configs have been built successfully. More configs may be tested in the coming days. tested configs: alphaallyesconfig gcc alphabuildonly-randconfig-r002-20230517 gcc alpha defconfig gcc alpharandconfig-r015-20230517 gcc alpharandconfig-r034-20230517 gcc alpharandconfig-r035-20230517 gcc arc allyesconfig gcc arc buildonly-randconfig-r005-20230517 gcc arc defconfig gcc arc randconfig-r001-20230517 gcc arc randconfig-r022-20230517 gcc arc randconfig-r025-20230517 gcc arm allmodconfig gcc arm allyesconfig gcc arm am200epdkit_defconfig clang arm defconfig gcc arm imx_v4_v5_defconfig clang arm imx_v6_v7_defconfig gcc armkeystone_defconfig gcc arm randconfig-r046-20230517 clang arm u8500_defconfig gcc arm64allyesconfig gcc arm64buildonly-randconfig-r003-20230517 clang arm64 defconfig gcc arm64randconfig-r014-20230517 gcc arm64randconfig-r023-20230517 gcc arm64randconfig-r034-20230517 clang csky buildonly-randconfig-r002-20230517 gcc cskydefconfig gcc hexagon randconfig-r012-20230517 clang hexagon randconfig-r016-20230517 clang hexagon randconfig-r022-20230517 clang hexagon randconfig-r035-20230517 clang hexagon randconfig-r041-20230517 clang hexagon randconfig-r045-20230517 clang i386 allnoconfig clang i386 allyesconfig gcc i386 debian-10.3 gcc i386defconfig gcc i386 randconfig-a002 clang i386 randconfig-a004 clang i386 randconfig-a006 clang i386 randconfig-a012 gcc i386 randconfig-a014 gcc i386 randconfig-a016 gcc ia64 allmodconfig gcc ia64 buildonly-randconfig-r003-20230517 gcc ia64defconfig gcc ia64 randconfig-r012-20230517 gcc ia64 randconfig-r013-20230517 gcc ia64 randconfig-r014-20230517 gcc ia64 randconfig-r023-20230517 gcc loongarchallmodconfig gcc loongarch allnoconfig gcc loongarchbuildonly-randconfig-r005-20230517 gcc loongarch defconfig gcc loongarchrandconfig-r032-20230517 gcc m68k alldefconfig gcc m68k allmodconfig gcc m68k apollo_defconfig gcc m68kdefconfig gcc m68kmvme16x_defconfig gcc m68k randconfig-r005-20230517 gcc m68k randconfig-r023-20230517 gcc microblaze buildonly-randconfig-r005-20230517 gcc microblaze randconfig-r021-20230517 gcc microblaze randconfig-r025-20230517 gcc microblaze randconfig-r033-20230517 gcc mips allmodconfig gcc mips allyesconfig gcc mips bmips_stb_defconfig clang mipsmaltaup_defconfig clang mips randconfig-r025-20230517 clang mips randconfig-r032-20230517 gcc nios2buildonly-randconfig-r002-20230517 gcc nios2buildonly-randconfig-r006-20230517 gcc nios2 defconfig gcc nios2randconfig-r003-20230517 gcc nios2randconfig-r011-20230517 gcc nios2randconfig-r032-20230517 gcc openrisc buildonly-randconfig-r004-20230517 gcc openrisc randconfig-r001-20230517 gcc openrisc randconfig-r003-20230517 gcc openrisc randconfig
[powerpc:fixes-test] BUILD SUCCESS 211059f4d536f4322fc9ab5581870c8e26b43197
tree/branch: INFO setup_repo_specs: /db/releases/20230517200055/lkp-src/repo/*/powerpc https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test branch HEAD: 211059f4d536f4322fc9ab5581870c8e26b43197 powerpc/iommu: limit number of TCEs to 512 for H_STUFF_TCE hcall elapsed time: 723m configs tested: 181 configs skipped: 152 The following configs have been built successfully. More configs may be tested in the coming days. tested configs: alphaallyesconfig gcc alphabuildonly-randconfig-r002-20230517 gcc alpha defconfig gcc alpharandconfig-r015-20230517 gcc alpharandconfig-r034-20230517 gcc alpharandconfig-r035-20230517 gcc arc allyesconfig gcc arc buildonly-randconfig-r005-20230517 gcc arc defconfig gcc arc randconfig-r001-20230517 gcc arc randconfig-r022-20230517 gcc arc randconfig-r025-20230517 gcc arm allmodconfig gcc arm allyesconfig gcc arm am200epdkit_defconfig clang arm defconfig gcc arm imx_v4_v5_defconfig clang arm imx_v6_v7_defconfig gcc armkeystone_defconfig gcc arm randconfig-r046-20230517 clang arm u8500_defconfig gcc arm64allyesconfig gcc arm64buildonly-randconfig-r003-20230517 clang arm64 defconfig gcc arm64randconfig-r014-20230517 gcc arm64randconfig-r023-20230517 gcc arm64randconfig-r034-20230517 clang csky buildonly-randconfig-r002-20230517 gcc cskydefconfig gcc hexagon randconfig-r012-20230517 clang hexagon randconfig-r016-20230517 clang hexagon randconfig-r022-20230517 clang hexagon randconfig-r035-20230517 clang hexagon randconfig-r041-20230517 clang hexagon randconfig-r045-20230517 clang i386 allnoconfig clang i386 allyesconfig gcc i386 debian-10.3 gcc i386defconfig gcc i386 randconfig-a002 clang i386 randconfig-a004 clang i386 randconfig-a006 clang i386 randconfig-a012 gcc i386 randconfig-a014 gcc i386 randconfig-a016 gcc ia64 allmodconfig gcc ia64 buildonly-randconfig-r003-20230517 gcc ia64defconfig gcc ia64 randconfig-r012-20230517 gcc ia64 randconfig-r013-20230517 gcc ia64 randconfig-r014-20230517 gcc ia64 randconfig-r023-20230517 gcc loongarchallmodconfig gcc loongarch allnoconfig gcc loongarchbuildonly-randconfig-r005-20230517 gcc loongarch defconfig gcc loongarchrandconfig-r032-20230517 gcc m68k alldefconfig gcc m68k allmodconfig gcc m68k apollo_defconfig gcc m68kdefconfig gcc m68kmvme16x_defconfig gcc m68k randconfig-r005-20230517 gcc m68k randconfig-r023-20230517 gcc microblaze buildonly-randconfig-r005-20230517 gcc microblaze randconfig-r021-20230517 gcc microblaze randconfig-r025-20230517 gcc microblaze randconfig-r033-20230517 gcc mips allmodconfig gcc mips allyesconfig gcc mips bmips_stb_defconfig clang mipsmaltaup_defconfig clang mips randconfig-r025-20230517 clang mips randconfig-r032-20230517 gcc nios2buildonly-randconfig-r002-20230517 gcc nios2buildonly-randconfig-r006-20230517 gcc nios2 defconfig gcc nios2randconfig-r003-20230517 gcc nios2randconfig-r011-20230517 gcc nios2randconfig-r032-20230517 gcc openrisc buildonly-randconfig-r004-20230517 gcc openrisc randconfig-r001-20230517 gcc openrisc randconfig-r003-20230517 gcc openrisc randconfig
[PATCH 00/97] usb: Convert to platform remove callback returning void
Hello, this series convers the drivers below drivers/usb to the .remove_new() callback of struct platform_driver(). The motivation is to make the remove callback less prone for errors and wrong assumptions. See commit 5c5a7680e67b ("platform: Provide a remove callback that returns no value") for a more detailed rationale. All drivers converted here already returned zero unconditionally in their .remove() callback, so converting them to .remove_new() is trivial. Best regards Uwe Uwe Kleine-König (97): usb: c67x00-drv: Convert to platform remove callback returning void usb: cdns3-imx: Convert to platform remove callback returning void usb: cdns3-plat: Convert to platform remove callback returning void usb: cdns3-ti: Convert to platform remove callback returning void usb: chipidea/ci_hdrc_imx: Convert to platform remove callback returning void usb: chipidea/ci_hdrc_msm: Convert to platform remove callback returning void usb: chipidea/ci_hdrc_tegra: Convert to platform remove callback returning void usb: chipidea/ci_hdrc_usb2: Convert to platform remove callback returning void usb: chipidea/core: Convert to platform remove callback returning void usb: common: usb-conn-gpio: Convert to platform remove callback returning void usb: dwc2/platform: Convert to platform remove callback returning void usb: core: Convert to platform remove callback returning void usb: dwc3-am62: Convert to platform remove callback returning void usb: dwc3-exynos: Convert to platform remove callback returning void usb: dwc3-imx8mp: Convert to platform remove callback returning void usb: dwc3-keystone: Convert to platform remove callback returning void usb: dwc3-meson-g12a: Convert to platform remove callback returning void usb: dwc3-of-simple: Convert to platform remove callback returning void usb: dwc3-omap: Convert to platform remove callback returning void usb: dwc3-qcom: Convert to platform remove callback returning void usb: dwc3-st: Convert to platform remove callback returning void usb: dwc3-xilinx: Convert to platform remove callback returning void usb: fotg210: Convert to platform remove callback returning void usb: gadget: hid: Convert to platform remove callback returning void usb: gadget: aspeed: Convert to platform remove callback returning void usb: gadget/atmel_usba_udc: Convert to platform remove callback returning void usb: gadget/bcm63xx_udc: Convert to platform remove callback returning void usb: bdc: Convert to platform remove callback returning void usb: gadget/dummy_hcd: Convert to platform remove callback returning void usb: gadget/fsl_qe_udc: Convert to platform remove callback returning void usb: gadget/fusb300_udc: Convert to platform remove callback returning void usb: gadget/m66592-udc: Convert to platform remove callback returning void usb: gadget/mv_u3d_core: Convert to platform remove callback returning void usb: gadget/mv_udc_core: Convert to platform remove callback returning void usb: gadget/net2272: Convert to platform remove callback returning void usb: gadget/omap_udc: Convert to platform remove callback returning void usb: gadget/pxa27x_udc: Convert to platform remove callback returning void usb: gadget/r8a66597-udc: Convert to platform remove callback returning void usb: gadget/renesas_usb3: Convert to platform remove callback returning void usb: gadget/renesas_usbf: Convert to platform remove callback returning void usb: gadget/rzv2m_usb3drd: Convert to platform remove callback returning void usb: gadget/snps_udc_plat: Convert to platform remove callback returning void usb: gadget/tegra-xudc: Convert to platform remove callback returning void usb: gadget/udc-xilinx: Convert to platform remove callback returning void usb: ehci-atmel: Convert to platform remove callback returning void usb: ehci-brcm: Convert to platform remove callback returning void usb: ehci-exynos: Convert to platform remove callback returning void usb: ehci-fsl: Convert to platform remove callback returning void usb: ehci-grlib: Convert to platform remove callback returning void usb: ehci-mv: Convert to platform remove callback returning void usb: ehci-npcm7xx: Convert to platform remove callback returning void usb: ehci-omap: Convert to platform remove callback returning void usb: ehci-orion: Convert to platform remove callback returning void usb: ehci-platform: Convert to platform remove callback returning void usb: ehci-ppc-of: Convert to platform remove callback returning void usb: ehci-sh: Convert to platform remove callback returning void usb: ehci-spear: Convert to platform remove callback returning void usb: ehci-st: Convert to platform remove callback returning void usb: ehci-xilinx-of: Convert to platform remove callback returning void usb: fsl-mph-dr-of: Convert to platform remove callback
[PATCH 30/97] usb: gadget/fsl_qe_udc: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/usb/gadget/udc/fsl_qe_udc.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index 3b1cc8fa30c8..9c5dc1c1a68e 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.c +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c @@ -2628,7 +2628,7 @@ static int qe_udc_resume(struct platform_device *dev) } #endif -static int qe_udc_remove(struct platform_device *ofdev) +static void qe_udc_remove(struct platform_device *ofdev) { struct qe_udc *udc = platform_get_drvdata(ofdev); struct qe_ep *ep; @@ -2679,8 +2679,6 @@ static int qe_udc_remove(struct platform_device *ofdev) /* wait for release() of gadget.dev to free udc */ wait_for_completion(); - - return 0; } /*-*/ @@ -2708,7 +2706,7 @@ static struct platform_driver udc_driver = { .of_match_table = qe_udc_match, }, .probe = qe_udc_probe, - .remove = qe_udc_remove, + .remove_new = qe_udc_remove, #ifdef CONFIG_PM .suspend= qe_udc_suspend, .resume = qe_udc_resume, -- 2.39.2
Re: [PATCH v2 10/25] iommu/exynos: Implement an IDENTITY domain
On 16.05.2023 02:00, Jason Gunthorpe wrote: > What exynos calls exynos_iommu_detach_device is actually putting the iommu > into identity mode. > > Move to the new core support for ARM_DMA_USE_IOMMU by defining > ops->identity_domain. > > Signed-off-by: Jason Gunthorpe Acked-by: Marek Szyprowski > --- > drivers/iommu/exynos-iommu.c | 66 +--- > 1 file changed, 32 insertions(+), 34 deletions(-) > > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c > index c275fe71c4db32..5e12b85dfe8705 100644 > --- a/drivers/iommu/exynos-iommu.c > +++ b/drivers/iommu/exynos-iommu.c > @@ -24,6 +24,7 @@ > > typedef u32 sysmmu_iova_t; > typedef u32 sysmmu_pte_t; > +static struct iommu_domain exynos_identity_domain; > > /* We do not consider super section mapping (16MB) */ > #define SECT_ORDER 20 > @@ -829,7 +830,7 @@ static int __maybe_unused exynos_sysmmu_suspend(struct > device *dev) > struct exynos_iommu_owner *owner = dev_iommu_priv_get(master); > > mutex_lock(>rpm_lock); > - if (data->domain) { > + if (>domain->domain != _identity_domain) { > dev_dbg(data->sysmmu, "saving state\n"); > __sysmmu_disable(data); > } > @@ -847,7 +848,7 @@ static int __maybe_unused exynos_sysmmu_resume(struct > device *dev) > struct exynos_iommu_owner *owner = dev_iommu_priv_get(master); > > mutex_lock(>rpm_lock); > - if (data->domain) { > + if (>domain->domain != _identity_domain) { > dev_dbg(data->sysmmu, "restoring state\n"); > __sysmmu_enable(data); > } > @@ -980,17 +981,20 @@ static void exynos_iommu_domain_free(struct > iommu_domain *iommu_domain) > kfree(domain); > } > > -static void exynos_iommu_detach_device(struct iommu_domain *iommu_domain, > - struct device *dev) > +static int exynos_iommu_identity_attach(struct iommu_domain *identity_domain, > + struct device *dev) > { > - struct exynos_iommu_domain *domain = to_exynos_domain(iommu_domain); > struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev); > - phys_addr_t pagetable = virt_to_phys(domain->pgtable); > + struct exynos_iommu_domain *domain; > + phys_addr_t pagetable; > struct sysmmu_drvdata *data, *next; > unsigned long flags; > > - if (!has_sysmmu(dev) || owner->domain != iommu_domain) > - return; > + if (owner->domain == identity_domain) > + return 0; > + > + domain = to_exynos_domain(owner->domain); > + pagetable = virt_to_phys(domain->pgtable); > > mutex_lock(>rpm_lock); > > @@ -1009,15 +1013,25 @@ static void exynos_iommu_detach_device(struct > iommu_domain *iommu_domain, > list_del_init(>domain_node); > spin_unlock(>lock); > } > - owner->domain = NULL; > + owner->domain = identity_domain; > spin_unlock_irqrestore(>lock, flags); > > mutex_unlock(>rpm_lock); > > - dev_dbg(dev, "%s: Detached IOMMU with pgtable %pa\n", __func__, > - ); > + dev_dbg(dev, "%s: Restored IOMMU to IDENTITY from pgtable %pa\n", > + __func__, ); > + return 0; > } > > +static struct iommu_domain_ops exynos_identity_ops = { > + .attach_dev = exynos_iommu_identity_attach, > +}; > + > +static struct iommu_domain exynos_identity_domain = { > + .type = IOMMU_DOMAIN_IDENTITY, > + .ops = _identity_ops, > +}; > + > static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain, > struct device *dev) > { > @@ -1026,12 +1040,11 @@ static int exynos_iommu_attach_device(struct > iommu_domain *iommu_domain, > struct sysmmu_drvdata *data; > phys_addr_t pagetable = virt_to_phys(domain->pgtable); > unsigned long flags; > + int err; > > - if (!has_sysmmu(dev)) > - return -ENODEV; > - > - if (owner->domain) > - exynos_iommu_detach_device(owner->domain, dev); > + err = exynos_iommu_identity_attach(_identity_domain, dev); > + if (err) > + return err; > > mutex_lock(>rpm_lock); > > @@ -1407,26 +1420,12 @@ static struct iommu_device > *exynos_iommu_probe_device(struct device *dev) > return >iommu; > } > > -static void exynos_iommu_set_platform_dma(struct device *dev) > -{ > - struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev); > - > - if (owner->domain) { > - struct iommu_group *group = iommu_group_get(dev); > - > - if (group) { > - exynos_iommu_detach_device(owner->domain, dev); > - iommu_group_put(group); > - } > - } > -} > - > static void exynos_iommu_release_device(struct device *dev) > { >
Re: [PATCH v2 00/25] iommu: Make default_domain's mandatory
On 16.05.2023 02:00, Jason Gunthorpe wrote: > [ There was alot of unexpected complication after rc1 with this series, > several new patches were needed ] > > It has been a long time coming, this series completes the default_domain > transition and makes it so that the core IOMMU code will always have a > non-NULL default_domain for every driver on every > platform. set_platform_dma_ops() turned out to be a bad idea, and so > completely remove it. > > This is achieved by changing each driver to either: > > 1 - Convert the existing (or deleted) ops->detach_dev() into an > op->attach_dev() of an IDENTITY domain. > > This is based on the theory that the ARM32 HW is able to function when > the iommu is turned off as so the turned off state is an IDENTITY > translation. > > 2 - Use a new PLATFORM domain type. This is a hack to accommodate drivers > that we don't really know WTF they do. S390 is legitimately using this > to switch to it's platform dma_ops implementation, which is where the > name comes from. > > 3 - Do #1 and force the default domain to be IDENTITY, this corrects > the tegra-smmu case where even an ARM64 system would have a NULL > default_domain. > > Using this we can apply the rules: > > a) ARM_DMA_USE_IOMMU mode always uses either the driver's > ops->default_domain, ops->def_domain_type(), or an IDENTITY domain. > All ARM32 drivers provide one of these three options. > > b) dma-iommu.c mode uses either the driver's ops->default_domain, > ops->def_domain_type or the usual DMA API policy logic based on the > command line/etc to pick IDENTITY/DMA domain types > > c) All other arch's (PPC/S390) use ops->default_domain always. > > See the patch "Require a default_domain for all iommu drivers" for a > per-driver breakdown. > > The conversion broadly teaches a bunch of ARM32 drivers that they can do > IDENTITY domains. There is some educated guessing involved that these are > actual IDENTITY domains. If this turns out to be wrong the driver can be > trivially changed to use a BLOCKING domain type instead. Further, the > domain type only matters for drivers using ARM64's dma-iommu.c mode as it > will select IDENTITY based on the command line and expect IDENTITY to > work. For ARM32 and other arch cases it is purely documentation. > > Finally, based on all the analysis in this series, we can purge > IOMMU_DOMAIN_UNMANAGED/DMA constants from most of the drivers. This > greatly simplifies understanding the driver contract to the core > code. IOMMU drivers should not be involved in policy for how the DMA API > works, that should be a core core decision. > > The main gain from this work is to remove alot of ARM_DMA_USE_IOMMU > specific code and behaviors from drivers. All that remains in iommu > drivers after this series is the calls to arm_iommu_create_mapping(). > > This is a step toward removing ARM_DMA_USE_IOMMU. > > The IDENTITY domains added to the ARM64 supporting drivers can be tested > by booting in ARM64 mode and enabling CONFIG_IOMMU_DEFAULT_PASSTHROUGH. If > the system still boots then most likely the implementation is an IDENTITY > domain. If not we can trivially change it to BLOCKING or at worst PLATFORM > if there is no detail what is going on in the HW. > > I think this is pretty safe for the ARM32 drivers as they don't really > change, the code that was in detach_dev continues to be called in the same > places it was called before. Tested-by: Marek Szyprowski Works fine on ARM 32bit Exynos based boards. > This follows the prior series: > > https://lore.kernel.org/r/0-v5-1b99ae392328+44574-iommu_err_unwind_...@nvidia.com > > This is on github: > https://protect2.fireeye.com/v1/url?k=773809ed-1645e36e-773982a2-74fe48600158-bd3a7b89de1f2061=1=7f176af7-9cf3-429b-a0ce-8812c59dfb5c=https%3A%2F%2Fgithub.com%2Fjgunthorpe%2Flinux%2Fcommits%2Fiommu_all_defdom > > v2: > - FSL is an IDENTITY domain > - Delete terga-gart instead of trying to carry it > - Use the policy determination from iommu_get_default_domain_type() to > drive the arm_iommu mode > - Reorganize and introduce new patches to do the above: > * Split the ops->identity_domain to an independent earlier patch > * Remove the UNMANAGED return from def_domain_type in mtk_v1 earlier >so the new iommu_get_default_domain_type() can work > * Make the driver's def_domain_type have higher policy priority than >untrusted > * Merge the set_platfom_dma_ops hunk from mtk_v1 along with rockchip >into the patch that forced IDENTITY on ARM32 > - Revise sun50i to be cleaner and have a non-NULL internal domain > - Reword logging in exynos > - Remove the gdev from the group alloc path, instead add a new > function __iommu_group_domain_alloc() that takes in the group > and uses the first device. Split this to its own patch > - New patch to make iommufd's mock selftest into a real driver > - New patch to fix power's partial
[PATCH] scsi: ibmvscsi: Replace all non-returning strlcpy with strscpy
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] https://github.com/KSPP/linux/issues/89 Signed-off-by: Azeem Shaikh --- drivers/scsi/ibmvscsi/ibmvscsi.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 63f32f843e75..59599299615d 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -250,7 +250,7 @@ static void gather_partition_info(void) ppartition_name = of_get_property(of_root, "ibm,partition-name", NULL); if (ppartition_name) - strlcpy(partition_name, ppartition_name, + strscpy(partition_name, ppartition_name, sizeof(partition_name)); p_number_ptr = of_get_property(of_root, "ibm,partition-no", NULL); if (p_number_ptr) @@ -1282,12 +1282,12 @@ static void send_mad_capabilities(struct ibmvscsi_host_data *hostdata) if (hostdata->client_migrated) hostdata->caps.flags |= cpu_to_be32(CLIENT_MIGRATED); - strlcpy(hostdata->caps.name, dev_name(>host->shost_gendev), + strscpy(hostdata->caps.name, dev_name(>host->shost_gendev), sizeof(hostdata->caps.name)); location = of_get_property(of_node, "ibm,loc-code", NULL); location = location ? location : dev_name(hostdata->dev); - strlcpy(hostdata->caps.loc, location, sizeof(hostdata->caps.loc)); + strscpy(hostdata->caps.loc, location, sizeof(hostdata->caps.loc)); req->common.type = cpu_to_be32(VIOSRP_CAPABILITIES_TYPE); req->buffer = cpu_to_be64(hostdata->caps_addr);
Re: [PATCH v5 5/6] mm/gup: remove vmas parameter from pin_user_pages()
On Sun, May 14, 2023 at 10:26:58PM +0100, Lorenzo Stoakes wrote: > We are now in a position where no caller of pin_user_pages() requires the > vmas parameter at all, so eliminate this parameter from the function and > all callers. > > This clears the way to removing the vmas parameter from GUP altogether. > > Acked-by: David Hildenbrand > Acked-by: Dennis Dalessandro (for > qib) > Signed-off-by: Lorenzo Stoakes Acked-by: Sakari Ailus # drivers/media -- Sakari Ailus
Re: [PATCH] mm: kfence: Fix false positives on big endian
On Fri, 5 May 2023 16:02:17 + David Laight wrote: > From: Michael Ellerman > > Sent: 05 May 2023 04:51 > > > > Since commit 1ba3cbf3ec3b ("mm: kfence: improve the performance of > > __kfence_alloc() and __kfence_free()"), kfence reports failures in > > random places at boot on big endian machines. > > > > The problem is that the new KFENCE_CANARY_PATTERN_U64 encodes the > > address of each byte in its value, so it needs to be byte swapped on big > > endian machines. > > > > The compiler is smart enough to do the le64_to_cpu() at compile time, so > > there is no runtime overhead. > > > > Fixes: 1ba3cbf3ec3b ("mm: kfence: improve the performance of > > __kfence_alloc() and __kfence_free()") > > Signed-off-by: Michael Ellerman > > --- > > mm/kfence/kfence.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/kfence/kfence.h b/mm/kfence/kfence.h > > index 2aafc46a4aaf..392fb273e7bd 100644 > > --- a/mm/kfence/kfence.h > > +++ b/mm/kfence/kfence.h > > @@ -29,7 +29,7 @@ > > * canary of every 8 bytes is the same. 64-bit memory can be filled and > > checked > > * at a time instead of byte by byte to improve performance. > > */ > > -#define KFENCE_CANARY_PATTERN_U64 ((u64)0x ^ > > (u64)(0x0706050403020100)) > > +#define KFENCE_CANARY_PATTERN_U64 ((u64)0x ^ > > (u64)(le64_to_cpu(0x0706050403020100))) > > What at the (u64) casts for? > The constants should probably have a ul (or ull) suffix. > I tried that, didn't fix the sparse warnings described at https://lkml.kernel.org/r/202305132244.dwzbucud-...@intel.com. Michael, have you looked into this? I'll merge it upstream - I guess we can live with the warnings for a while.
Re: [PATCH] powerpc/security: Fix Speculation_Store_Bypass reporting on Power10
On Wed, 2023-05-17 at 17:49 +1000, Michael Ellerman wrote: > Nageswara reported that /proc/self/status was showing "vulnerable" > for > the Speculation_Store_Bypass feature on Power10, eg: > > $ grep Speculation_Store_Bypass: /proc/self/status > Speculation_Store_Bypass: vulnerable > > But at the same time the sysfs files, and lscpu, were showing "Not > affected". > > This turns out to simply be a bug in the reporting of the > Speculation_Store_Bypass, aka. PR_SPEC_STORE_BYPASS, case. > > When SEC_FTR_STF_BARRIER was added, so that firmware could > communicate > the vulnerability was not present, the code in ssb_prctl_get() was > not > updated to check the new flag. > > So add the check for SEC_FTR_STF_BARRIER being disabled. Rather than > adding the new check to the existing if block and expanding the > comment > to cover both cases, rewrite the three cases to be separate so they > can > be commented separately for clarity. > > Fixes: 84ed26fd00c5 ("powerpc/security: Add a security feature for > STF barrier") > Cc: sta...@vger.kernel.org # v5.14+ > Reported-by: Nageswara R Sastry > Signed-off-by: Michael Ellerman Reviewed-by: Russell Currey
Re: [PATCH 15/23] s390: allow pte_offset_map_lock() to fail
On Wed, 17 May 2023, Claudio Imbrenda wrote: > On Tue, 9 May 2023 22:01:16 -0700 (PDT) > Hugh Dickins wrote: > > > In rare transient cases, not yet made possible, pte_offset_map() and > > pte_offset_map_lock() may not find a page table: handle appropriately. > > > > Signed-off-by: Hugh Dickins > > --- > > arch/s390/kernel/uv.c | 2 ++ > > arch/s390/mm/gmap.c| 2 ++ > > arch/s390/mm/pgtable.c | 12 +--- > > 3 files changed, 13 insertions(+), 3 deletions(-) > > > > diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c > > index cb2ee06df286..3c62d1b218b1 100644 > > --- a/arch/s390/kernel/uv.c > > +++ b/arch/s390/kernel/uv.c > > @@ -294,6 +294,8 @@ int gmap_make_secure(struct gmap *gmap, unsigned long > > gaddr, void *uvcb) > > > > rc = -ENXIO; > > ptep = get_locked_pte(gmap->mm, uaddr, ); > > + if (!ptep) > > + goto out; You may or may not be asking about this instance too. When I looked at how the code lower down handles -ENXIO (promoting it to -EFAULT if an access fails, or to -EAGAIN to ask for a retry), this looked just right (whereas using -EAGAIN here would be wrong: that expects a "page" which has not been initialized at this point). > > if (pte_present(*ptep) && !(pte_val(*ptep) & _PAGE_INVALID) && > > pte_write(*ptep)) { > > page = pte_page(*ptep); > > rc = -EAGAIN; > > diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c > > index dc90d1eb0d55..d198fc9475a2 100644 > > --- a/arch/s390/mm/gmap.c > > +++ b/arch/s390/mm/gmap.c > > @@ -2549,6 +2549,8 @@ static int __zap_zero_pages(pmd_t *pmd, unsigned long > > start, > > spinlock_t *ptl; > > > > ptep = pte_offset_map_lock(walk->mm, pmd, addr, ); > > + if (!ptep) > > + break; > > so if pte_offset_map_lock fails, we abort and skip both the failed > entry and the rest of the entries? Yes. > > can pte_offset_map_lock be retried immediately if it fails? (consider > that we currently don't allow THP with KVM guests) > > Would something like this: > > do { > ptep = pte_offset_map_lock(...); > mb(); /* maybe? */ > } while (!ptep); > > make sense? No. But you're absolutely right to be asking: thank you for looking into it so carefully - and I realize that it's hard at this stage to judge what's appropriate, when I've not yet even posted the endpoint of these changes, the patches which make it possible not to find a page table here. And I'm intentionally keeping that vague, because although I shall only introduce a THP case, I do expect it to be built upon later in reclaiming empty page tables: it would be nice not to have to change the arch code again when extending further. My "rare transient cases" phrase may be somewhat misleading: one thing that's wrong with your tight pte_offset_map_lock() loop above is that the pmd entry pointing to page table may have been suddenly replaced by a pmd_none() entry; and there's nothing in your loop above to break out if that is so. But if a page table is suddenly removed, that would be because it was either empty, or replaced by a THP entry, or easily reconstructable on demand (by that, I probably mean it was only mapping shared file pages, which can just be refaulted if needed again). The case you're wary of, is if the page table were removed briefly, then put back shortly after: and still contains zero pages further down. That's not something mm does now, nor at the end of my several series, nor that I imagine us wanting to do in future: but I am struggling to find a killer argument to persuade you that it could never be done - most pages in a page table do need rmap tracking, which will BUG if it's broken, but that argument happens not to apply to the zero page. (Hmm, there could be somewhere, where we would find it convenient to remove a page table with intent to do ...something, then validation of that isolated page table fails, so we just put it back again.) Is it good enough for me to promise you that we won't do that? There are several ways in which we could change __zap_zero_pages(), but I don't see them as actually dealing with the concern at hand. One change, I've tended to make at the mm end but did not dare to interfere here: it would seem more sensible to do a single pte_offset_map_lock() outside the loop, return if that fails, increment ptep inside the loop, pte_unmap_unlock() after the loop. But perhaps you have preemption reasons for not wanting that; and although it would eliminate the oddity of half-processing a page table, it would not really resolve the problem at hand: because, what if this page table got removed just before __zap_zero_pages() tries to take the lock, then got put back just after? Another change: I see __zap_zero_pages() is driven by walk_page_range(), and over at the mm end I'm usually setting walk->action to ACTION_AGAIN in these failure cases; but thought that an unnecessary piece of magic here, and cannot see how
Re: [PATCH] scsi: ibmvscsi: Replace all non-returning strlcpy with strscpy
On 5/17/23 07:34, Azeem Shaikh wrote: > strlcpy() reads the entire source buffer first. > This read may exceed the destination size limit. > This is both inefficient and can lead to linear read > overflows if a source string is not NUL-terminated [1]. > In an effort to remove strlcpy() completely [2], replace > strlcpy() here with strscpy(). > No return values were used, so direct replacement is safe. > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy > [2] https://github.com/KSPP/linux/issues/89 > > Signed-off-by: Azeem Shaikh Acked-by: Tyrel Datwyler
Re: [PATCHv2 pci-next 2/2] PCI/AER: Rate limit the reporting of the correctable errors
On Wed, May 17, 2023 at 9:03 AM Bjorn Helgaas wrote: > > On Fri, Apr 07, 2023 at 04:46:03PM -0700, Grant Grundler wrote: > > On Fri, Apr 7, 2023 at 12:46 PM Bjorn Helgaas wrote: > > > On Fri, Apr 07, 2023 at 11:53:27AM -0700, Grant Grundler wrote: > > > > On Thu, Apr 6, 2023 at 12:50 PM Bjorn Helgaas > > > wrote: > > > > > On Fri, Mar 17, 2023 at 10:51:09AM -0700, Grant Grundler wrote: > > > > > > From: Rajat Khandelwal > > > > > > > > > > > > There are many instances where correctable errors tend to inundate > > > > > > the message buffer. We observe such instances during thunderbolt > > > > > > PCIe > > > > > > tunneling. > > > > ... > > > > > > > > > if (info->severity == AER_CORRECTABLE) > > > > > > - pci_info(dev, " [%2d] %-22s%s\n", i, errmsg, > > > > > > - info->first_error == i ? " (First)" : > > > ""); > > > > > > + pci_info_ratelimited(dev, " [%2d] > > > %-22s%s\n", i, errmsg, > > > > > > + info->first_error == i ? > > > " (First)" : ""); > > > > > > > > > > I don't think this is going to reliably work the way we want. We have > > > > > a bunch of pci_info_ratelimited() calls, and each caller has its own > > > > > ratelimit_state data. Unless we call pci_info_ratelimited() exactly > > > > > the same number of times for each error, the ratelimit counters will > > > > > get out of sync and we'll end up printing fragments from error A mixed > > > > > with fragments from error B. > > > > > > > > Ok - what I'm reading between the lines here is the output should be > > > > emitted in one step, not multiple pci_info_ratelimited() calls. if the > > > > code built an output string (using sprintnf()), and then called > > > > pci_info_ratelimited() exactly once at the bottom, would that be > > > > sufficient? > > > > > > > > > I think we need to explicitly manage the ratelimiting ourselves, > > > > > similar to print_hmi_event_info() or print_extlog_rcd(). Then we can > > > > > have a *single* ratelimit_state, and we can check it once to determine > > > > > whether to log this correctable error. > > > > > > > > Is the rate limiting per call location or per device? From above, I > > > > understood rate limiting is "per call location". If the code only > > > > has one call location, it should achieve the same goal, right? > > > > > > Rate-limiting is per call location, so yes, if we only have one call > > > location, that would solve it. It would also have the nice property > > > that all the output would be atomic so it wouldn't get mixed with > > > other stuff, and it might encourage us to be a little less wordy in > > > the output. > > > > > > > +1 to all of those reasons. Especially reducing the number of lines output. > > > > I'm going to be out for the next week. If someone else (Rajat Kendalwal > > maybe?) wants to rework this to use one call location it should be fairly > > straight forward. If not, I'll tackle this when I'm back (in 2 weeks > > essentially). > > Ping? Really hoping to merge this for v6.5. Sorry - I forgot about this... I'll take a shot at it. Should have something by this evening. cheers, grant > > Bjorn
[PATCH v6 5/6] mm/gup: remove vmas parameter from pin_user_pages()
We are now in a position where no caller of pin_user_pages() requires the vmas parameter at all, so eliminate this parameter from the function and all callers. This clears the way to removing the vmas parameter from GUP altogether. Acked-by: David Hildenbrand Acked-by: Dennis Dalessandro (for qib) Reviewed-by: Christoph Hellwig Acked-by: Sakari Ailus (for drivers/media) Signed-off-by: Lorenzo Stoakes --- arch/powerpc/mm/book3s64/iommu_api.c | 2 +- drivers/infiniband/hw/qib/qib_user_pages.c | 2 +- drivers/infiniband/hw/usnic/usnic_uiom.c | 2 +- drivers/infiniband/sw/siw/siw_mem.c| 2 +- drivers/media/v4l2-core/videobuf-dma-sg.c | 2 +- drivers/vdpa/vdpa_user/vduse_dev.c | 2 +- drivers/vhost/vdpa.c | 2 +- include/linux/mm.h | 3 +-- io_uring/rsrc.c| 2 +- mm/gup.c | 9 +++-- mm/gup_test.c | 9 - net/xdp/xdp_umem.c | 2 +- 12 files changed, 17 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/mm/book3s64/iommu_api.c b/arch/powerpc/mm/book3s64/iommu_api.c index 81d7185e2ae8..d19fb1f3007d 100644 --- a/arch/powerpc/mm/book3s64/iommu_api.c +++ b/arch/powerpc/mm/book3s64/iommu_api.c @@ -105,7 +105,7 @@ static long mm_iommu_do_alloc(struct mm_struct *mm, unsigned long ua, ret = pin_user_pages(ua + (entry << PAGE_SHIFT), n, FOLL_WRITE | FOLL_LONGTERM, - mem->hpages + entry, NULL); + mem->hpages + entry); if (ret == n) { pinned += n; continue; diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c index f693bc753b6b..1bb7507325bc 100644 --- a/drivers/infiniband/hw/qib/qib_user_pages.c +++ b/drivers/infiniband/hw/qib/qib_user_pages.c @@ -111,7 +111,7 @@ int qib_get_user_pages(unsigned long start_page, size_t num_pages, ret = pin_user_pages(start_page + got * PAGE_SIZE, num_pages - got, FOLL_LONGTERM | FOLL_WRITE, -p + got, NULL); +p + got); if (ret < 0) { mmap_read_unlock(current->mm); goto bail_release; diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c b/drivers/infiniband/hw/usnic/usnic_uiom.c index 2a5cac2658ec..84e0f41e7dfa 100644 --- a/drivers/infiniband/hw/usnic/usnic_uiom.c +++ b/drivers/infiniband/hw/usnic/usnic_uiom.c @@ -140,7 +140,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable, ret = pin_user_pages(cur_base, min_t(unsigned long, npages, PAGE_SIZE / sizeof(struct page *)), -gup_flags, page_list, NULL); +gup_flags, page_list); if (ret < 0) goto out; diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c index f51ab2ccf151..e6e25f15567d 100644 --- a/drivers/infiniband/sw/siw/siw_mem.c +++ b/drivers/infiniband/sw/siw/siw_mem.c @@ -422,7 +422,7 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable) umem->page_chunk[i].plist = plist; while (nents) { rv = pin_user_pages(first_page_va, nents, foll_flags, - plist, NULL); + plist); if (rv < 0) goto out_sem_up; diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c index 53001532e8e3..405b89ea1054 100644 --- a/drivers/media/v4l2-core/videobuf-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf-dma-sg.c @@ -180,7 +180,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, data, size, dma->nr_pages); err = pin_user_pages(data & PAGE_MASK, dma->nr_pages, gup_flags, -dma->pages, NULL); +dma->pages); if (err != dma->nr_pages) { dma->nr_pages = (err >= 0) ? err : 0; diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c index de97e38c3b82..4d4405f058e8 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -1052,7 +1052,7 @@ static int vduse_dev_reg_umem(struct vduse_dev *dev, goto out; pinned = pin_user_pages(uaddr, npages, FOLL_LONGTERM | FOLL_WRITE, - page_list, NULL); + page_list); if (pinned != npages) {
Re: [PATCH] scsi: ibmvscsi: Replace all non-returning strlcpy with strscpy
On Wed, May 17, 2023 at 02:34:09PM +, Azeem Shaikh wrote: > strlcpy() reads the entire source buffer first. > This read may exceed the destination size limit. > This is both inefficient and can lead to linear read > overflows if a source string is not NUL-terminated [1]. > In an effort to remove strlcpy() completely [2], replace > strlcpy() here with strscpy(). > No return values were used, so direct replacement is safe. > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy > [2] https://github.com/KSPP/linux/issues/89 > > Signed-off-by: Azeem Shaikh Reviewed-by: Kees Cook -- Kees Cook
Re: [PATCHv2 pci-next 2/2] PCI/AER: Rate limit the reporting of the correctable errors
On Fri, Apr 07, 2023 at 04:46:03PM -0700, Grant Grundler wrote: > On Fri, Apr 7, 2023 at 12:46 PM Bjorn Helgaas wrote: > > On Fri, Apr 07, 2023 at 11:53:27AM -0700, Grant Grundler wrote: > > > On Thu, Apr 6, 2023 at 12:50 PM Bjorn Helgaas > > wrote: > > > > On Fri, Mar 17, 2023 at 10:51:09AM -0700, Grant Grundler wrote: > > > > > From: Rajat Khandelwal > > > > > > > > > > There are many instances where correctable errors tend to inundate > > > > > the message buffer. We observe such instances during thunderbolt PCIe > > > > > tunneling. > > > ... > > > > > > > if (info->severity == AER_CORRECTABLE) > > > > > - pci_info(dev, " [%2d] %-22s%s\n", i, errmsg, > > > > > - info->first_error == i ? " (First)" : > > ""); > > > > > + pci_info_ratelimited(dev, " [%2d] > > %-22s%s\n", i, errmsg, > > > > > + info->first_error == i ? > > " (First)" : ""); > > > > > > > > I don't think this is going to reliably work the way we want. We have > > > > a bunch of pci_info_ratelimited() calls, and each caller has its own > > > > ratelimit_state data. Unless we call pci_info_ratelimited() exactly > > > > the same number of times for each error, the ratelimit counters will > > > > get out of sync and we'll end up printing fragments from error A mixed > > > > with fragments from error B. > > > > > > Ok - what I'm reading between the lines here is the output should be > > > emitted in one step, not multiple pci_info_ratelimited() calls. if the > > > code built an output string (using sprintnf()), and then called > > > pci_info_ratelimited() exactly once at the bottom, would that be > > > sufficient? > > > > > > > I think we need to explicitly manage the ratelimiting ourselves, > > > > similar to print_hmi_event_info() or print_extlog_rcd(). Then we can > > > > have a *single* ratelimit_state, and we can check it once to determine > > > > whether to log this correctable error. > > > > > > Is the rate limiting per call location or per device? From above, I > > > understood rate limiting is "per call location". If the code only > > > has one call location, it should achieve the same goal, right? > > > > Rate-limiting is per call location, so yes, if we only have one call > > location, that would solve it. It would also have the nice property > > that all the output would be atomic so it wouldn't get mixed with > > other stuff, and it might encourage us to be a little less wordy in > > the output. > > > > +1 to all of those reasons. Especially reducing the number of lines output. > > I'm going to be out for the next week. If someone else (Rajat Kendalwal > maybe?) wants to rework this to use one call location it should be fairly > straight forward. If not, I'll tackle this when I'm back (in 2 weeks > essentially). Ping? Really hoping to merge this for v6.5. Bjorn
Re: next: gcc-8-ppc6xx_defconfig: ERROR: modpost: "__divdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined!
Le 17/05/2023 à 16:02, Naresh Kamboju a écrit : > Linux next powerpc gcc-8 build failed on Linux next 20230516 and 20230517. > - build/gcc-8-ppc6xx_defconfig > > Reported-by: Linux Kernel Functional Testing > > Build log: > > make --silent --keep-going --jobs=8 > O=/home/tuxbuild/.cache/tuxmake/builds/1/build \ >ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- \ >'CC=sccache powerpc64le-linux-gnu-gcc' \ >'HOSTCC=sccache gcc' > > ERROR: modpost: "__divdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined! > ERROR: modpost: "__udivdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined! > make[2]: *** [/builds/linux/scripts/Makefile.modpost:136: > Module.symvers] Error 1 > make[2]: Target '__modpost' not remade because of errors. > make[1]: *** [/builds/linux/Makefile:1978: modpost] Error 2 Problem introduced by commits: bb5ceb43b7bf ("ALSA: emu10k1: fix non-zero mixer control defaults in highres mode") 1298bc978afb ("ALSA: emu10k1: enable bit-exact playback, part 1: DSP attenuation") More exactly by : + defval = defval * 0x7fffLL / 100; or + defval = defval * 0x8000LL / 100 - 1; powerpc/32 doesn't expect raw 64 bits division. You have to use function div_u64() as defined in include/linux/math64.h for this kind of operation. Christophe > > > links, > - > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230517/testrun/17031706/suite/build/test/gcc-8-ppc6xx_defconfig/log > - > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230517/testrun/17031706/suite/build/test/gcc-8-ppc6xx_defconfig/history/ > > Steps to reproduce: > === > # To install tuxmake on your system globally: > # sudo pip3 install -U tuxmake > # > # See https://docs.tuxmake.org/ for complete documentation. > # Original tuxmake command with fragments listed below. > > tuxmake --runtime podman --target-arch powerpc --toolchain gcc-8 > --kconfig ppc6xx_defconfig > > > -- > Linaro LKFT > https://lkft.linaro.org
Re: [PATCH 4/14] audit: avoid missing-prototype warnings
On Wed, May 17, 2023 at 10:51 AM Arnd Bergmann wrote: > On Wed, May 17, 2023, at 16:33, Paul Moore wrote: > > On May 17, 2023 Arnd Bergmann wrote: > > > We probably should move the audit_serial() and auditsc_get_stamp() > > away from the watch/mark/tree functions, but that isn't your problem. > > > > Anyway, this looks okay to me; do you have a problem if I merge this > > via the audit/next branch or were you hoping to have this go in > > through a different tree? > > Merging it through your tree is probably best, Andrew can either > pick the ones that nobody else took, or I can resend the rest. Easy enough, merged to audit/next, thanks. -- paul-moore.com
Re: [PATCH 10/14] suspend: add a arch_resume_nosmt() prototype
On Wed, May 17, 2023, at 15:48, Rafael J. Wysocki wrote: > On Wed, May 17, 2023 at 3:12 PM Arnd Bergmann wrote: >> >> From: Arnd Bergmann >> >> The arch_resume_nosmt() has a __weak definition, plus an x86 >> specific override, but no prototype that ensures the two have >> the same arguments. This causes a W=1 warning: >> >> arch/x86/power/hibernate.c:189:5: error: no previous prototype for >> 'arch_resume_nosmt' [-Werror=missing-prototypes] >> >> Add the prototype in linux/suspend.h, which is included in >> both places. >> >> Signed-off-by: Arnd Bergmann > > Do you want me to pick this up? Yes, please do. Thanks, Arnd
Re: [PATCH 4/14] audit: avoid missing-prototype warnings
On Wed, May 17, 2023, at 16:33, Paul Moore wrote: > On May 17, 2023 Arnd Bergmann wrote: > We probably should move the audit_serial() and auditsc_get_stamp() > away from the watch/mark/tree functions, but that isn't your problem. > > Anyway, this looks okay to me; do you have a problem if I merge this > via the audit/next branch or were you hoping to have this go in > through a different tree? Merging it through your tree is probably best, Andrew can either pick the ones that nobody else took, or I can resend the rest. Arnd
Re: [PATCH 4/14] audit: avoid missing-prototype warnings
On May 17, 2023 Arnd Bergmann wrote: > > Building with 'make W=1' reveals two function definitions without > a previous prototype in the audit code: > > lib/compat_audit.c:32:5: error: no previous prototype for > 'audit_classify_compat_syscall' [-Werror=missing-prototypes] > kernel/audit.c:1813:14: error: no previous prototype for 'audit_serial' > [-Werror=missing-prototypes] > > The first one needs a declaration from linux/audit.h but cannot > include that header without causing conflicting (compat) syscall number > definitions, so move the it into linux/audit_arch.h. > > The second one is declared conditionally based on CONFIG_AUDITSYSCALL > but needed as a local function even when that option is disabled, so > move the declaration out of the #ifdef block. > > Signed-off-by: Arnd Bergmann > --- > include/linux/audit.h | 2 -- > include/linux/audit_arch.h | 2 ++ > kernel/audit.h | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/audit.h b/include/linux/audit.h > index 31086a72e32a..6a3a9e122bb5 100644 > --- a/include/linux/audit.h > +++ b/include/linux/audit.h > @@ -130,8 +130,6 @@ extern unsigned compat_dir_class[]; > extern unsigned compat_chattr_class[]; > extern unsigned compat_signal_class[]; > > -extern int audit_classify_compat_syscall(int abi, unsigned syscall); > - > /* audit_names->type values */ > #define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ > #define AUDIT_TYPE_NORMAL 1 /* a "normal" audit record */ > diff --git a/include/linux/audit_arch.h b/include/linux/audit_arch.h > index 8fdb1afe251a..0e34d673ef17 100644 > --- a/include/linux/audit_arch.h > +++ b/include/linux/audit_arch.h > @@ -21,4 +21,6 @@ enum auditsc_class_t { > AUDITSC_NVALS /* count */ > }; > > +extern int audit_classify_compat_syscall(int abi, unsigned syscall); > + > #endif > diff --git a/kernel/audit.h b/kernel/audit.h > index c57b008b9914..94738bce40b2 100644 > --- a/kernel/audit.h > +++ b/kernel/audit.h > @@ -259,8 +259,8 @@ extern struct tty_struct *audit_get_tty(void); > extern void audit_put_tty(struct tty_struct *tty); > > /* audit watch/mark/tree functions */ > -#ifdef CONFIG_AUDITSYSCALL > extern unsigned int audit_serial(void); > +#ifdef CONFIG_AUDITSYSCALL > extern int auditsc_get_stamp(struct audit_context *ctx, > struct timespec64 *t, unsigned int *serial); We probably should move the audit_serial() and auditsc_get_stamp() away from the watch/mark/tree functions, but that isn't your problem. Anyway, this looks okay to me; do you have a problem if I merge this via the audit/next branch or were you hoping to have this go in through a different tree? -- paul-moore.com
Re: [PATCH] irq_work: consolidate arch_irq_work_raise prototypes
On Tue, May 16, 2023 at 10:02:31PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > The prototype was hidden on x86, which causes a warning: > > kernel/irq_work.c:72:13: error: no previous prototype for > 'arch_irq_work_raise' [-Werror=missing-prototypes] > > Fix this by providing it in only one place that is always visible. > > Signed-off-by: Arnd Bergmann > --- > arch/arm/include/asm/irq_work.h | 2 -- > arch/arm64/include/asm/irq_work.h | 2 -- > arch/csky/include/asm/irq_work.h| 2 +- > arch/powerpc/include/asm/irq_work.h | 1 - > arch/riscv/include/asm/irq_work.h | 2 +- > arch/s390/include/asm/irq_work.h| 2 -- > arch/x86/include/asm/irq_work.h | 1 - > include/linux/irq_work.h| 3 +++ > 8 files changed, 5 insertions(+), 10 deletions(-) ... > diff --git a/arch/s390/include/asm/irq_work.h > b/arch/s390/include/asm/irq_work.h > index 603783766d0a..f00c9f610d5a 100644 > --- a/arch/s390/include/asm/irq_work.h > +++ b/arch/s390/include/asm/irq_work.h > @@ -7,6 +7,4 @@ static inline bool arch_irq_work_has_interrupt(void) > return true; > } > > -void arch_irq_work_raise(void); > - > #endif /* _ASM_S390_IRQ_WORK_H */ ... > diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h > index 8cd11a223260..136f2980cba3 100644 > --- a/include/linux/irq_work.h > +++ b/include/linux/irq_work.h > @@ -66,6 +66,9 @@ void irq_work_sync(struct irq_work *work); > void irq_work_run(void); > bool irq_work_needs_cpu(void); > void irq_work_single(void *arg); > + > +void arch_irq_work_raise(void); > + > #else > static inline bool irq_work_needs_cpu(void) { return false; } > static inline void irq_work_run(void) { } For s390: Reviewed-by: Alexander Gordeev
next: gcc-8-ppc6xx_defconfig: ERROR: modpost: "__divdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined!
Linux next powerpc gcc-8 build failed on Linux next 20230516 and 20230517. - build/gcc-8-ppc6xx_defconfig Reported-by: Linux Kernel Functional Testing Build log: make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/1/build \ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- \ 'CC=sccache powerpc64le-linux-gnu-gcc' \ 'HOSTCC=sccache gcc' ERROR: modpost: "__divdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined! ERROR: modpost: "__udivdi3" [sound/pci/emu10k1/snd-emu10k1.ko] undefined! make[2]: *** [/builds/linux/scripts/Makefile.modpost:136: Module.symvers] Error 1 make[2]: Target '__modpost' not remade because of errors. make[1]: *** [/builds/linux/Makefile:1978: modpost] Error 2 links, - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230517/testrun/17031706/suite/build/test/gcc-8-ppc6xx_defconfig/log - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230517/testrun/17031706/suite/build/test/gcc-8-ppc6xx_defconfig/history/ Steps to reproduce: === # To install tuxmake on your system globally: # sudo pip3 install -U tuxmake # # See https://docs.tuxmake.org/ for complete documentation. # Original tuxmake command with fragments listed below. tuxmake --runtime podman --target-arch powerpc --toolchain gcc-8 --kconfig ppc6xx_defconfig -- Linaro LKFT https://lkft.linaro.org
Re: [PATCH 10/14] suspend: add a arch_resume_nosmt() prototype
On Wed, May 17, 2023 at 3:12 PM Arnd Bergmann wrote: > > From: Arnd Bergmann > > The arch_resume_nosmt() has a __weak definition, plus an x86 > specific override, but no prototype that ensures the two have > the same arguments. This causes a W=1 warning: > > arch/x86/power/hibernate.c:189:5: error: no previous prototype for > 'arch_resume_nosmt' [-Werror=missing-prototypes] > > Add the prototype in linux/suspend.h, which is included in > both places. > > Signed-off-by: Arnd Bergmann Do you want me to pick this up? If not Acked-by: Rafael J. Wysocki > --- > include/linux/suspend.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/linux/suspend.h b/include/linux/suspend.h > index f16653f7be32..bc911fecb8e8 100644 > --- a/include/linux/suspend.h > +++ b/include/linux/suspend.h > @@ -472,6 +472,8 @@ static inline int hibernate_quiet_exec(int (*func)(void > *data), void *data) { > } > #endif /* CONFIG_HIBERNATION */ > > +int arch_resume_nosmt(void); > + > #ifdef CONFIG_HIBERNATION_SNAPSHOT_DEV > int is_hibernate_resume_dev(dev_t dev); > #else > -- > 2.39.2 >
Re: [PATCH] procfs: consolidate arch_report_meminfo declaration
On 5/16/23 21:57, Arnd Bergmann wrote: From: Arnd Bergmann The arch_report_meminfo() function is provided by four architectures, with a __weak fallback in procfs itself. On architectures that don't have a custom version, the __weak version causes a warning because of the missing prototype. Remove the architecture specific prototypes and instead add one in linux/proc_fs.h. Signed-off-by: Arnd Bergmann --- arch/parisc/include/asm/pgtable.h| 3 --- Acked-by: Helge Deller # parisc Thanks! Helge arch/powerpc/include/asm/pgtable.h | 3 --- arch/s390/include/asm/pgtable.h | 3 --- arch/s390/mm/pageattr.c | 1 + arch/x86/include/asm/pgtable.h | 1 + arch/x86/include/asm/pgtable_types.h | 3 --- arch/x86/mm/pat/set_memory.c | 1 + include/linux/proc_fs.h | 2 ++ 8 files changed, 5 insertions(+), 12 deletions(-) diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index e715df5385d6..5656395c95ee 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h @@ -472,9 +472,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, #define pte_same(A,B) (pte_val(A) == pte_val(B)) -struct seq_file; -extern void arch_report_meminfo(struct seq_file *m); - #endif /* !__ASSEMBLY__ */ diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 9972626ddaf6..6a88bfdaa69b 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -165,9 +165,6 @@ static inline bool is_ioremap_addr(const void *x) return addr >= IOREMAP_BASE && addr < IOREMAP_END; } - -struct seq_file; -void arch_report_meminfo(struct seq_file *m); #endif /* CONFIG_PPC64 */ #endif /* __ASSEMBLY__ */ diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 6822a11c2c8a..c55f3c3365af 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -42,9 +42,6 @@ static inline void update_page_count(int level, long count) atomic_long_add(count, _pages_count[level]); } -struct seq_file; -void arch_report_meminfo(struct seq_file *m); - /* * The S390 doesn't have any external MMU info: the kernel page * tables contain all the necessary information. diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c index 5ba3bd8a7b12..ca5a418c58a8 100644 --- a/arch/s390/mm/pageattr.c +++ b/arch/s390/mm/pageattr.c @@ -4,6 +4,7 @@ * Author(s): Jan Glauber */ #include +#include #include #include #include diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 15ae4d6ba476..5700bb337987 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -27,6 +27,7 @@ extern pgd_t early_top_pgt[PTRS_PER_PGD]; bool __init __early_make_pgtable(unsigned long address, pmdval_t pmd); +struct seq_file; void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm); void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm, bool user); diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index 447d4bee25c4..ba3e2554799a 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h @@ -513,9 +513,6 @@ extern void native_pagetable_init(void); #define native_pagetable_initpaging_init #endif -struct seq_file; -extern void arch_report_meminfo(struct seq_file *m); - enum pg_level { PG_LEVEL_NONE, PG_LEVEL_4K, diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c index 7159cf787613..d1515756e369 100644 --- a/arch/x86/mm/pat/set_memory.c +++ b/arch/x86/mm/pat/set_memory.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 0260f5ea98fe..e981ef830252 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -158,6 +158,8 @@ int proc_pid_arch_status(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task); #endif /* CONFIG_PROC_PID_ARCH_STATUS */ +extern void arch_report_meminfo(struct seq_file *m); + #else /* CONFIG_PROC_FS */ static inline void proc_root_init(void)
Re: [PATCH] procfs: consolidate arch_report_meminfo declaration
On Tue, May 16, 2023 at 09:57:29PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > The arch_report_meminfo() function is provided by four architectures, > with a __weak fallback in procfs itself. On architectures that don't > have a custom version, the __weak version causes a warning because > of the missing prototype. > > Remove the architecture specific prototypes and instead add one > in linux/proc_fs.h. > > Signed-off-by: Arnd Bergmann > --- > arch/parisc/include/asm/pgtable.h| 3 --- > arch/powerpc/include/asm/pgtable.h | 3 --- > arch/s390/include/asm/pgtable.h | 3 --- > arch/s390/mm/pageattr.c | 1 + > arch/x86/include/asm/pgtable.h | 1 + > arch/x86/include/asm/pgtable_types.h | 3 --- > arch/x86/mm/pat/set_memory.c | 1 + > include/linux/proc_fs.h | 2 ++ > 8 files changed, 5 insertions(+), 12 deletions(-) ... > diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h > index 6822a11c2c8a..c55f3c3365af 100644 > --- a/arch/s390/include/asm/pgtable.h > +++ b/arch/s390/include/asm/pgtable.h > @@ -42,9 +42,6 @@ static inline void update_page_count(int level, long count) > atomic_long_add(count, _pages_count[level]); > } > > -struct seq_file; > -void arch_report_meminfo(struct seq_file *m); > - > /* > * The S390 doesn't have any external MMU info: the kernel page > * tables contain all the necessary information. > diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c > index 5ba3bd8a7b12..ca5a418c58a8 100644 > --- a/arch/s390/mm/pageattr.c > +++ b/arch/s390/mm/pageattr.c > @@ -4,6 +4,7 @@ > * Author(s): Jan Glauber > */ > #include > +#include > #include > #include > #include For s390: Reviewed-by: Alexander Gordeev
[PATCH 14/14] time_namespace: always provide arch_get_vdso_data() prototype for vdso
From: Arnd Bergmann The arch_get_vdso_data() function is defined separately on each architecture, but only called when CONFIG_TIME_NS is set. If the definition is a global function, this causes a W=1 warning without TIME_NS: arch/x86/entry/vdso/vma.c:35:19: error: no previous prototype for 'arch_get_vdso_data' [-Werror=missing-prototypes] Move the prototype out of the #ifdef block to reliably turn off that warning. Signed-off-by: Arnd Bergmann --- include/linux/time_namespace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/time_namespace.h b/include/linux/time_namespace.h index bb9d3f5542f8..03d9c5ac01d1 100644 --- a/include/linux/time_namespace.h +++ b/include/linux/time_namespace.h @@ -44,7 +44,6 @@ struct time_namespace *copy_time_ns(unsigned long flags, struct time_namespace *old_ns); void free_time_ns(struct time_namespace *ns); void timens_on_fork(struct nsproxy *nsproxy, struct task_struct *tsk); -struct vdso_data *arch_get_vdso_data(void *vvar_page); struct page *find_timens_vvar_page(struct vm_area_struct *vma); static inline void put_time_ns(struct time_namespace *ns) @@ -163,4 +162,6 @@ static inline ktime_t timens_ktime_to_host(clockid_t clockid, ktime_t tim) } #endif +struct vdso_data *arch_get_vdso_data(void *vvar_page); + #endif /* _LINUX_TIMENS_H */ -- 2.39.2
[PATCH 13/14] thread_info: move function declarations to linux/thread_info.h
From: Arnd Bergmann There are a few __weak functions in kernel/fork.c, which architectures can override. If there is no prototype, the compiler warns about them: kernel/fork.c:164:13: error: no previous prototype for 'arch_release_task_struct' [-Werror=missing-prototypes] kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes] kernel/fork.c:1086:12: error: no previous prototype for 'arch_dup_task_struct' [-Werror=missing-prototypes] There are already prototypes in a number of architecture specific headers that have addressed those warnings before, but it's much better to have these in a single place so the warning no longer shows up anywhere. Signed-off-by: Arnd Bergmann --- arch/arm64/include/asm/thread_info.h | 4 arch/s390/include/asm/thread_info.h | 3 --- arch/sh/include/asm/thread_info.h| 3 --- arch/x86/include/asm/thread_info.h | 3 --- include/linux/thread_info.h | 5 + 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 848739c15de8..553d1bc559c6 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -55,10 +55,6 @@ struct thread_info { void arch_setup_new_exec(void); #define arch_setup_new_exec arch_setup_new_exec -void arch_release_task_struct(struct task_struct *tsk); -int arch_dup_task_struct(struct task_struct *dst, - struct task_struct *src); - #endif #define TIF_SIGPENDING 0 /* signal pending */ diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index c7c97921ed8d..a674c7d25da5 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h @@ -52,9 +52,6 @@ struct thread_info { struct task_struct; -void arch_release_task_struct(struct task_struct *tsk); -int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); - void arch_setup_new_exec(void); #define arch_setup_new_exec arch_setup_new_exec diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h index 1400fbb8b423..9f19a682d315 100644 --- a/arch/sh/include/asm/thread_info.h +++ b/arch/sh/include/asm/thread_info.h @@ -84,9 +84,6 @@ static inline struct thread_info *current_thread_info(void) #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) -extern void arch_task_cache_init(void); -extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); -extern void arch_release_task_struct(struct task_struct *tsk); extern void init_thread_xstate(void); #endif /* __ASSEMBLY__ */ diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index f1cccba52eb9..d63b02940747 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -232,9 +232,6 @@ static inline int arch_within_stack_frames(const void * const stack, current_thread_info()->status & TS_COMPAT) #endif -extern void arch_task_cache_init(void); -extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); -extern void arch_release_task_struct(struct task_struct *tsk); extern void arch_setup_new_exec(void); #define arch_setup_new_exec arch_setup_new_exec #endif /* !__ASSEMBLY__ */ diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index c02646884fa8..9ea0b28068f4 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -256,6 +256,11 @@ check_copy_size(const void *addr, size_t bytes, bool is_source) static inline void arch_setup_new_exec(void) { } #endif +void arch_task_cache_init(void); /* for CONFIG_SH */ +void arch_release_task_struct(struct task_struct *tsk); +int arch_dup_task_struct(struct task_struct *dst, + struct task_struct *src); + #endif /* __KERNEL__ */ #endif /* _LINUX_THREAD_INFO_H */ -- 2.39.2
[PATCH 12/14] init: move cifs_root_data() prototype into linux/mount.h
From: Arnd Bergmann cifs_root_data() is defined in cifs and called from early init code, but lacks a global prototype: fs/cifs/cifsroot.c:83:12: error: no previous prototype for 'cifs_root_data' Move the declaration from do_mounts.c into an appropriate header. Signed-off-by: Arnd Bergmann --- include/linux/mount.h | 2 ++ init/do_mounts.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/mount.h b/include/linux/mount.h index 1ea326c368f7..f381eb44b24c 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -124,4 +124,6 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, struct vfsmount *); extern void kern_unmount_array(struct vfsmount *mnt[], unsigned int num); +extern int cifs_root_data(char **dev, char **opts); + #endif /* _LINUX_MOUNT_H */ diff --git a/init/do_mounts.c b/init/do_mounts.c index 811e94daf0a8..83447c46ad6d 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -489,8 +489,6 @@ static int __init mount_nfs_root(void) #ifdef CONFIG_CIFS_ROOT -extern int cifs_root_data(char **dev, char **opts); - #define CIFSROOT_TIMEOUT_MIN 5 #define CIFSROOT_TIMEOUT_MAX 30 #define CIFSROOT_RETRY_MAX 5 -- 2.39.2
[PATCH 11/14] init: consolidate prototypes in linux/init.h
From: Arnd Bergmann The init/main.c file contains some extern declarations for functions defined in architecture code, and it defines some other functions that are called from architecture code with a custom prototype. Both of those result in warnings with 'make W=1': init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes] init/main.c:790:20: error: no previous prototype for 'mem_encrypt_init' [-Werror=missing-prototypes] init/main.c:792:20: error: no previous prototype for 'poking_init' [-Werror=missing-prototypes] arch/arm64/kernel/irq.c:122:13: error: no previous prototype for 'init_IRQ' [-Werror=missing-prototypes] arch/arm64/kernel/time.c:55:13: error: no previous prototype for 'time_init' [-Werror=missing-prototypes] arch/x86/kernel/process.c:935:13: error: no previous prototype for 'arch_post_acpi_subsys_init' [-Werror=missing-prototypes] init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes] kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes] Add prototypes for all of these in include/linux/init.h or another appropriate header, and remove the duplicate declarations from architecture specific code. Signed-off-by: Arnd Bergmann --- arch/arm/include/asm/irq.h | 1 - arch/microblaze/include/asm/setup.h | 2 -- arch/mips/include/asm/irq.h | 1 - arch/parisc/kernel/smp.c| 1 - arch/powerpc/include/asm/irq.h | 1 - arch/riscv/include/asm/irq.h| 2 -- arch/riscv/include/asm/timex.h | 2 -- arch/s390/kernel/entry.h| 2 -- arch/sh/include/asm/irq.h | 1 - arch/sh/include/asm/rtc.h | 2 -- arch/sparc/include/asm/irq_32.h | 1 - arch/sparc/include/asm/irq_64.h | 1 - arch/sparc/include/asm/timer_64.h | 1 - arch/sparc/kernel/kernel.h | 4 arch/x86/include/asm/irq.h | 2 -- arch/x86/include/asm/mem_encrypt.h | 3 --- arch/x86/include/asm/time.h | 1 - arch/x86/include/asm/tsc.h | 1 - include/linux/acpi.h| 3 ++- include/linux/delay.h | 1 + include/linux/init.h| 20 init/main.c | 18 -- 22 files changed, 23 insertions(+), 48 deletions(-) diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h index f62fa9f36192..ea0fdf83c397 100644 --- a/arch/arm/include/asm/irq.h +++ b/arch/arm/include/asm/irq.h @@ -23,7 +23,6 @@ #endif #ifndef __ASSEMBLY__ -void init_IRQ(void); #ifdef CONFIG_SMP #include diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h index a06cc1f97aa9..3657f5e78a3d 100644 --- a/arch/microblaze/include/asm/setup.h +++ b/arch/microblaze/include/asm/setup.h @@ -16,8 +16,6 @@ extern char *klimit; extern void mmu_reset(void); -void time_init(void); -void init_IRQ(void); void machine_early_init(const char *cmdline, unsigned int ram, unsigned int fdt, unsigned int msr, unsigned int tlb0, unsigned int tlb1); diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index 44f9824c1d8c..75abfa834ab7 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h @@ -19,7 +19,6 @@ #define IRQ_STACK_SIZE THREAD_SIZE #define IRQ_STACK_START(IRQ_STACK_SIZE - 16) -extern void __init init_IRQ(void); extern void *irq_stack[NR_CPUS]; /* diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index b7fc859fa87d..83348125b524 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -271,7 +271,6 @@ void arch_send_call_function_single_ipi(int cpu) static void smp_cpu_init(int cpunum) { - extern void init_IRQ(void);/* arch/parisc/kernel/irq.c */ extern void start_cpu_itimer(void); /* arch/parisc/kernel/time.c */ /* Set modes and Enable floating point coprocessor */ diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index deadd2149426..94dffa1dd223 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h @@ -50,7 +50,6 @@ extern void *hardirq_ctx[NR_CPUS]; extern void *softirq_ctx[NR_CPUS]; void __do_IRQ(struct pt_regs *regs); -extern void __init init_IRQ(void); int irq_choose_cpu(const struct cpumask *mask); diff --git a/arch/riscv/include/asm/irq.h b/arch/riscv/include/asm/irq.h index 43b9ebfbd943..8e10a94430a2 100644 --- a/arch/riscv/include/asm/irq.h +++ b/arch/riscv/include/asm/irq.h @@ -16,6 +16,4 @@ void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void)); struct fwnode_handle *riscv_get_intc_hwnode(void); -extern void __init init_IRQ(void); - #endif /* _ASM_RISCV_IRQ_H */ diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h index d6a7428f6248..a06697846e69 100644
[PATCH 10/14] suspend: add a arch_resume_nosmt() prototype
From: Arnd Bergmann The arch_resume_nosmt() has a __weak definition, plus an x86 specific override, but no prototype that ensures the two have the same arguments. This causes a W=1 warning: arch/x86/power/hibernate.c:189:5: error: no previous prototype for 'arch_resume_nosmt' [-Werror=missing-prototypes] Add the prototype in linux/suspend.h, which is included in both places. Signed-off-by: Arnd Bergmann --- include/linux/suspend.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/suspend.h b/include/linux/suspend.h index f16653f7be32..bc911fecb8e8 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -472,6 +472,8 @@ static inline int hibernate_quiet_exec(int (*func)(void *data), void *data) { } #endif /* CONFIG_HIBERNATION */ +int arch_resume_nosmt(void); + #ifdef CONFIG_HIBERNATION_SNAPSHOT_DEV int is_hibernate_resume_dev(dev_t dev); #else -- 2.39.2
[PATCH 09/14] kunit: include debugfs header file
From: Arnd Bergmann An extra #include statement is needed to ensure the prototypes for debugfs interfaces are visible, avoiding this warning: lib/kunit/debugfs.c:28:6: error: no previous prototype for 'kunit_debugfs_cleanup' [-Werror=missing-prototypes] lib/kunit/debugfs.c:33:6: error: no previous prototype for 'kunit_debugfs_init' [-Werror=missing-prototypes] lib/kunit/debugfs.c:102:6: error: no previous prototype for 'kunit_debugfs_create_suite' [-Werror=missing-prototypes] lib/kunit/debugfs.c:118:6: error: no previous prototype for 'kunit_debugfs_destroy_suite' [-Werror=missing-prototypes] Signed-off-by: Arnd Bergmann --- lib/kunit/debugfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c index b08bb1fba106..22c5c496a68f 100644 --- a/lib/kunit/debugfs.c +++ b/lib/kunit/debugfs.c @@ -10,6 +10,7 @@ #include #include "string-stream.h" +#include "debugfs.h" #define KUNIT_DEBUGFS_ROOT "kunit" #define KUNIT_DEBUGFS_RESULTS "results" -- 2.39.2
[PATCH 08/14] panic: make function declarations visible
From: Arnd Bergmann A few panic() related functions have a global definition but not declaration, which causes a warning with W=1: kernel/panic.c:710:6: error: no previous prototype for '__warn_printk' [-Werror=missing-prototypes] kernel/panic.c:756:24: error: no previous prototype for '__stack_chk_fail' [-Werror=missing-prototypes] kernel/exit.c:1917:32: error: no previous prototype for 'abort' [-Werror=missing-prototypes] __warn_printk() is called both as a global function when CONFIG_BUG is enabled, and as a local function in other configs. The other two here are called indirectly from generated or assembler code. Add prototypes for all of these. Signed-off-by: Arnd Bergmann --- include/asm-generic/bug.h | 5 +++-- include/linux/panic.h | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 4050b191e1a9..6e794420bd39 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -87,10 +87,12 @@ struct bug_entry { * * Use the versions with printk format strings to provide better diagnostics. */ -#ifndef __WARN_FLAGS extern __printf(4, 5) void warn_slowpath_fmt(const char *file, const int line, unsigned taint, const char *fmt, ...); +extern __printf(1, 2) void __warn_printk(const char *fmt, ...); + +#ifndef __WARN_FLAGS #define __WARN() __WARN_printf(TAINT_WARN, NULL) #define __WARN_printf(taint, arg...) do { \ instrumentation_begin();\ @@ -98,7 +100,6 @@ void warn_slowpath_fmt(const char *file, const int line, unsigned taint, instrumentation_end(); \ } while (0) #else -extern __printf(1, 2) void __warn_printk(const char *fmt, ...); #define __WARN() __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN)) #define __WARN_printf(taint, arg...) do { \ instrumentation_begin();\ diff --git a/include/linux/panic.h b/include/linux/panic.h index 979b776e3bcb..6717b15e798c 100644 --- a/include/linux/panic.h +++ b/include/linux/panic.h @@ -32,6 +32,9 @@ extern int sysctl_panic_on_stackoverflow; extern bool crash_kexec_post_notifiers; +extern void __stack_chk_fail(void); +void abort(void); + /* * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It * holds a CPU number which is executing panic() currently. A value of -- 2.39.2
[PATCH 07/14] panic: hide unused global functions
From: Arnd Bergmann Building with W=1 shows warnings about two functions that have no declaration or caller in certain configurations: kernel/panic.c:688:6: error: no previous prototype for 'warn_slowpath_fmt' [-Werror=missing-prototypes] kernel/panic.c:710:6: error: no previous prototype for '__warn_printk' [-Werror=missing-prototypes] Enclose the definition in the same #ifdef check as the declaration. Signed-off-by: Arnd Bergmann --- kernel/panic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/panic.c b/kernel/panic.c index 886d2ebd0a0d..10effe40a3fa 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -684,6 +684,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint, add_taint(taint, LOCKDEP_STILL_OK); } +#ifdef CONFIG_BUG #ifndef __WARN_FLAGS void warn_slowpath_fmt(const char *file, int line, unsigned taint, const char *fmt, ...) @@ -722,8 +723,6 @@ void __warn_printk(const char *fmt, ...) EXPORT_SYMBOL(__warn_printk); #endif -#ifdef CONFIG_BUG - /* Support resetting WARN*_ONCE state */ static int clear_warn_once_set(void *data, u64 val) -- 2.39.2
[PATCH 06/14] locking: add lockevent_read() prototype
From: Arnd Bergmann lockevent_read() has a __weak definition and the only caller in kernel/locking/lock_events.c, plus a strong definition in qspinlock_stat.h that overrides it, but no other declaration. This causes a W=1 warning: kernel/locking/lock_events.c:61:16: error: no previous prototype for 'lockevent_read' [-Werror=missing-prototypes] Add shared prototype to avoid the warnings. Signed-off-by: Arnd Bergmann --- kernel/locking/lock_events.h | 4 1 file changed, 4 insertions(+) diff --git a/kernel/locking/lock_events.h b/kernel/locking/lock_events.h index 8c7e7d25f09c..a6016b91803d 100644 --- a/kernel/locking/lock_events.h +++ b/kernel/locking/lock_events.h @@ -57,4 +57,8 @@ static inline void __lockevent_add(enum lock_events event, int inc) #define lockevent_cond_inc(ev, c) #endif /* CONFIG_LOCK_EVENT_COUNTS */ + +ssize_t lockevent_read(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos); + #endif /* __LOCKING_LOCK_EVENTS_H */ -- 2.39.2
[PATCH 05/14] lib: devmem_is_allowed: include linux/io.h
From: Arnd Bergmann The devmem_is_allowed() function is defined in a file of the same name, but the declaration is in asm/io.h, which is not included there, causing a W=1 warning: lib/devmem_is_allowed.c:20:5: error: no previous prototype for 'devmem_is_allowed' [-Werror=missing-prototypes] Include the appropriate header to avoid the warning. Signed-off-by: Arnd Bergmann --- lib/devmem_is_allowed.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/devmem_is_allowed.c b/lib/devmem_is_allowed.c index 60be9e24bd57..9c060c69f134 100644 --- a/lib/devmem_is_allowed.c +++ b/lib/devmem_is_allowed.c @@ -10,6 +10,7 @@ #include #include +#include /* * devmem_is_allowed() checks to see if /dev/mem access to a certain address -- 2.39.2
[PATCH 04/14] audit: avoid missing-prototype warnings
From: Arnd Bergmann Building with 'make W=1' reveals two function definitions without a previous prototype in the audit code: lib/compat_audit.c:32:5: error: no previous prototype for 'audit_classify_compat_syscall' [-Werror=missing-prototypes] kernel/audit.c:1813:14: error: no previous prototype for 'audit_serial' [-Werror=missing-prototypes] The first one needs a declaration from linux/audit.h but cannot include that header without causing conflicting (compat) syscall number definitions, so move the it into linux/audit_arch.h. The second one is declared conditionally based on CONFIG_AUDITSYSCALL but needed as a local function even when that option is disabled, so move the declaration out of the #ifdef block. Signed-off-by: Arnd Bergmann --- include/linux/audit.h | 2 -- include/linux/audit_arch.h | 2 ++ kernel/audit.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/audit.h b/include/linux/audit.h index 31086a72e32a..6a3a9e122bb5 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h @@ -130,8 +130,6 @@ extern unsigned compat_dir_class[]; extern unsigned compat_chattr_class[]; extern unsigned compat_signal_class[]; -extern int audit_classify_compat_syscall(int abi, unsigned syscall); - /* audit_names->type values */ #defineAUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ #defineAUDIT_TYPE_NORMAL 1 /* a "normal" audit record */ diff --git a/include/linux/audit_arch.h b/include/linux/audit_arch.h index 8fdb1afe251a..0e34d673ef17 100644 --- a/include/linux/audit_arch.h +++ b/include/linux/audit_arch.h @@ -21,4 +21,6 @@ enum auditsc_class_t { AUDITSC_NVALS /* count */ }; +extern int audit_classify_compat_syscall(int abi, unsigned syscall); + #endif diff --git a/kernel/audit.h b/kernel/audit.h index c57b008b9914..94738bce40b2 100644 --- a/kernel/audit.h +++ b/kernel/audit.h @@ -259,8 +259,8 @@ extern struct tty_struct *audit_get_tty(void); extern void audit_put_tty(struct tty_struct *tty); /* audit watch/mark/tree functions */ -#ifdef CONFIG_AUDITSYSCALL extern unsigned int audit_serial(void); +#ifdef CONFIG_AUDITSYSCALL extern int auditsc_get_stamp(struct audit_context *ctx, struct timespec64 *t, unsigned int *serial); -- 2.39.2
[PATCH 03/14] mm: sparse: mark populate_section_memmap() static
From: Arnd Bergmann There are two definitions of this function, but the second one lacks the 'static' annotation: mm/sparse.c:704:25: error: no previous prototype for 'populate_section_memmap' [-Werror=missing-prototypes] Signed-off-by: Arnd Bergmann --- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/sparse.c b/mm/sparse.c index c2afdb26039e..b8d5d58fe240 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -701,7 +701,7 @@ static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages) return rc; } #else -struct page * __meminit populate_section_memmap(unsigned long pfn, +static struct page * __meminit populate_section_memmap(unsigned long pfn, unsigned long nr_pages, int nid, struct vmem_altmap *altmap, struct dev_pagemap *pgmap) { -- 2.39.2
[PATCH 02/14] mm: page_poison: always declare __kernel_map_pages() function
From: Arnd Bergmann The __kernel_map_pages() function is mainly used for CONFIG_DEBUG_PAGEALLOC, but has a number of architecture specific definitions that may also be used in other configurations, as well as a global fallback definition for architectures that do not support DEBUG_PAGEALLOC. When the option is disabled, any definitions without the prototype cause a warning: mm/page_poison.c:102:6: error: no previous prototype for '__kernel_map_pages' [-Werror=missing-prototypes] The function is a trivial nop here, so just declare it anyway to avoid the warning. Signed-off-by: Arnd Bergmann --- include/linux/mm.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 27ce77080c79..e95d7c575ea6 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3453,13 +3453,12 @@ static inline bool debug_pagealloc_enabled_static(void) return static_branch_unlikely(&_debug_pagealloc_enabled); } -#ifdef CONFIG_DEBUG_PAGEALLOC /* * To support DEBUG_PAGEALLOC architecture must ensure that * __kernel_map_pages() never fails */ extern void __kernel_map_pages(struct page *page, int numpages, int enable); - +#ifdef CONFIG_DEBUG_PAGEALLOC static inline void debug_pagealloc_map_pages(struct page *page, int numpages) { if (debug_pagealloc_enabled_static()) -- 2.39.2
[PATCH 01/14] mm: percpu: unhide pcpu_embed_first_chunk prototype
From: Arnd Bergmann This function is called whenever CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK or CONFIG_HAVE_SETUP_PER_CPU_AREA, but only declared when the former is set: mm/percpu.c:3055:12: error: no previous prototype for 'pcpu_embed_first_chunk' [-Werror=missing-prototypes] There is no real point in hiding declarations, so just remove the #ifdef here. Signed-off-by: Arnd Bergmann --- include/linux/percpu.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 1338ea2aa720..42125cf9c506 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -103,12 +103,10 @@ extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai); extern void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, void *base_addr); -#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK extern int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, size_t atom_size, pcpu_fc_cpu_distance_fn_t cpu_distance_fn, pcpu_fc_cpu_to_node_fn_t cpu_to_nd_fn); -#endif #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK void __init pcpu_populate_pte(unsigned long addr); -- 2.39.2
[PATCH 00/14] mm/init/kernel: missing-prototypes warnings
From: Arnd Bergmann These are patches addressing -Wmissing-prototypes warnings in common kernel code and memory management code files that usually get merged through the -mm tree. Andrew, can you pick these up in the -mm tree? Arnd Arnd Bergmann (14): mm: percpu: unhide pcpu_embed_first_chunk prototype mm: page_poison: always declare __kernel_map_pages() function mm: sparse: mark populate_section_memmap() static audit: avoid missing-prototype warnings lib: devmem_is_allowed: include linux/io.h locking: add lockevent_read() prototype panic: hide unused global functions panic: make function declarations visible kunit: include debugfs header file suspend: add a arch_resume_nosmt() prototype init: consolidate prototypes in linux/init.h init: move cifs_root_data() prototype into linux/mount.h thread_info: move function declarations to linux/thread_info.h time_namespace: always provide arch_get_vdso_data() prototype for vdso arch/arm/include/asm/irq.h | 1 - arch/arm64/include/asm/thread_info.h | 4 arch/microblaze/include/asm/setup.h | 2 -- arch/mips/include/asm/irq.h | 1 - arch/parisc/kernel/smp.c | 1 - arch/powerpc/include/asm/irq.h | 1 - arch/riscv/include/asm/irq.h | 2 -- arch/riscv/include/asm/timex.h | 2 -- arch/s390/include/asm/thread_info.h | 3 --- arch/s390/kernel/entry.h | 2 -- arch/sh/include/asm/irq.h| 1 - arch/sh/include/asm/rtc.h| 2 -- arch/sh/include/asm/thread_info.h| 3 --- arch/sparc/include/asm/irq_32.h | 1 - arch/sparc/include/asm/irq_64.h | 1 - arch/sparc/include/asm/timer_64.h| 1 - arch/sparc/kernel/kernel.h | 4 arch/x86/include/asm/irq.h | 2 -- arch/x86/include/asm/mem_encrypt.h | 3 --- arch/x86/include/asm/thread_info.h | 3 --- arch/x86/include/asm/time.h | 1 - arch/x86/include/asm/tsc.h | 1 - include/asm-generic/bug.h| 5 +++-- include/linux/acpi.h | 3 ++- include/linux/audit.h| 2 -- include/linux/audit_arch.h | 2 ++ include/linux/delay.h| 1 + include/linux/init.h | 20 include/linux/mm.h | 3 +-- include/linux/mount.h| 2 ++ include/linux/panic.h| 3 +++ include/linux/percpu.h | 2 -- include/linux/suspend.h | 2 ++ include/linux/thread_info.h | 5 + include/linux/time_namespace.h | 3 ++- init/do_mounts.c | 2 -- init/main.c | 18 -- kernel/audit.h | 2 +- kernel/locking/lock_events.h | 4 kernel/panic.c | 3 +-- lib/devmem_is_allowed.c | 1 + lib/kunit/debugfs.c | 1 + mm/sparse.c | 2 +- 43 files changed, 52 insertions(+), 76 deletions(-) -- 2.39.2 Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Michal Simek Cc: Thomas Bogendoerfer Cc: Helge Deller Cc: Michael Ellerman Cc: Palmer Dabbelt Cc: Heiko Carstens Cc: Thomas Gleixner Cc: Ingo Molnar Cc: x...@kernel.org Cc: "Rafael J. Wysocki" Cc: Paul Moore Cc: Eric Paris Cc: Andrew Morton Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Pavel Machek Cc: Peter Zijlstra Cc: Waiman Long Cc: Boqun Feng Cc: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org Cc: linux-m...@vger.kernel.org Cc: linux-par...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-ri...@lists.infradead.org Cc: linux-s...@vger.kernel.org Cc: linux...@vger.kernel.org Cc: au...@vger.kernel.org Cc: linux...@kvack.org Cc: linux...@vger.kernel.org Cc: linux-kselft...@vger.kernel.org Cc: kunit-...@googlegroups.com
[PATCH] powerpc/64s: Fix native_hpte_remove() to be irq-safe
Lockdep warns that the use of the hpte_lock in native_hpte_remove() is not safe against an IRQ coming in: WARNING: inconsistent lock state 6.4.0-rc2-g0c54f4d30ecc #1 Not tainted inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage. qemu-system-ppc/93865 [HC0[0]:SC0[0]:HE1:SE1] takes: c21f5180 (hpte_lock){+.?.}-{0:0}, at: native_lock_hpte+0x8/0xd0 {IN-SOFTIRQ-W} state was registered at: lock_acquire+0x134/0x3f0 native_lock_hpte+0x44/0xd0 native_hpte_insert+0xd4/0x2a0 __hash_page_64K+0x218/0x4f0 hash_page_mm+0x464/0x840 do_hash_fault+0x11c/0x260 data_access_common_virt+0x210/0x220 __ip_select_ident+0x140/0x150 ... net_rx_action+0x3bc/0x440 __do_softirq+0x180/0x534 ... sys_sendmmsg+0x34/0x50 system_call_exception+0x128/0x320 system_call_common+0x160/0x2e4 ... Possible unsafe locking scenario: CPU0 lock(hpte_lock); lock(hpte_lock); *** DEADLOCK *** ... Call Trace: dump_stack_lvl+0x98/0xe0 (unreliable) print_usage_bug.part.0+0x250/0x278 mark_lock+0xc9c/0xd30 __lock_acquire+0x440/0x1ca0 lock_acquire+0x134/0x3f0 native_lock_hpte+0x44/0xd0 native_hpte_remove+0xb0/0x190 kvmppc_mmu_map_page+0x650/0x698 [kvm_pr] kvmppc_handle_pagefault+0x534/0x6e8 [kvm_pr] kvmppc_handle_exit_pr+0x6d8/0xe90 [kvm_pr] after_sprg3_load+0x80/0x90 [kvm_pr] kvmppc_vcpu_run_pr+0x108/0x270 [kvm_pr] kvmppc_vcpu_run+0x34/0x48 [kvm] kvm_arch_vcpu_ioctl_run+0x340/0x470 [kvm] kvm_vcpu_ioctl+0x338/0x8b8 [kvm] sys_ioctl+0x7c4/0x13e0 system_call_exception+0x128/0x320 system_call_common+0x160/0x2e4 I suspect kvm_pr is the only caller that doesn't already have IRQs disabled, which is why this hasn't been reported previously. Fix it by disabling IRQs in native_hpte_remove(). Fixes: 35159b5717fa ("powerpc/64s: make HPTE lock and native_tlbie_lock irq-safe") Cc: sta...@vger.kernel.org # v6.1+ Signed-off-by: Michael Ellerman --- arch/powerpc/mm/book3s64/hash_native.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/mm/book3s64/hash_native.c b/arch/powerpc/mm/book3s64/hash_native.c index 9342e79870df..430d1d935a7c 100644 --- a/arch/powerpc/mm/book3s64/hash_native.c +++ b/arch/powerpc/mm/book3s64/hash_native.c @@ -328,10 +328,12 @@ static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn, static long native_hpte_remove(unsigned long hpte_group) { + unsigned long hpte_v, flags; struct hash_pte *hptep; int i; int slot_offset; - unsigned long hpte_v; + + local_irq_save(flags); DBG_LOW("remove(group=%lx)\n", hpte_group); @@ -356,13 +358,16 @@ static long native_hpte_remove(unsigned long hpte_group) slot_offset &= 0x7; } - if (i == HPTES_PER_GROUP) - return -1; + if (i == HPTES_PER_GROUP) { + i = -1; + goto out; + } /* Invalidate the hpte. NOTE: this also unlocks it */ release_hpte_lock(); hptep->v = 0; - +out: + local_irq_restore(flags); return i; } -- 2.40.1
Re: [PATCH] powerpc/iommu: limit number of TCEs to 512 for H_STUFF_TCE hcall
Gaurav Batra writes: > Hello Michael, > > System test hit the crash. I believe, it was PHYP that resulted in it > due to number of TCEs passed in to be >512. OK. It's always good to spell out in the change log whether it's a theoretical/unlikely bug, or one that's actually been hit in testing or the field. > I was wondering about the Fixes tag as well. But, this interface, in > it's current form, is there from the day the file was created. So, in > this case, should I mention the first commit which created this source file? If it really goes back to the origin commit, then it's probably better to just say so and tag it for stable, rather than pointing to 1da177e4. I wonder though is there something else that changed that means this bug is now being hit but wasn't before? Or maybe it's just that we are testing on systems with large enough amounts of memory to hit this but which aren't using a direct mapping? cheers
Re: [PATCH v2 3/5] locking/arch: Wire up local_try_cmpxchg
> +static __inline__ bool local_try_cmpxchg(local_t *l, long *old, long new) > +{ > + typeof(l->a.counter) *__old = (typeof(l->a.counter) *) old; > + return try_cmpxchg_local(>a.counter, __old, new); > +} > + This patch then causes following sparse errors: ./arch/x86/include/asm/local.h:131:16: warning: symbol '__old' shadows an earlier one ./arch/x86/include/asm/local.h:130:30: originally declared here This is then visible in all kinds of builds - which makes it hard to find out actual problems with sparse.
Re: [PATCH rc] iommu/power: Remove iommu_del_device()
Jason Gunthorpe writes: > Now that power calls iommu_device_register() and populates its groups > using iommu_ops->device_group it should not be calling > iommu_group_remove_device(). > > The core code owns the groups and all the other related iommu data, it > will clean it up automatically. > > Remove the bus notifiers and explicit calls to > iommu_group_remove_device(). > > Cc: io...@lists.linux.dev > Fixes: a940904443e4 ("powerpc/iommu: Add iommu_ops to report capabilities and > allow blocking domains") > Signed-off-by: Jason Gunthorpe > --- > arch/powerpc/include/asm/iommu.h | 5 - > arch/powerpc/kernel/iommu.c| 17 - > arch/powerpc/platforms/powernv/pci.c | 25 - > arch/powerpc/platforms/pseries/iommu.c | 25 - > 4 files changed, 72 deletions(-) > > Michael, please take this on the PPC tree to -rc thanks Will do, thanks. cheers
Re: [PATCH 16/23] s390: gmap use pte_unmap_unlock() not spin_unlock()
On Tue, May 09, 2023 at 10:02:32PM -0700, Hugh Dickins wrote: > pte_alloc_map_lock() expects to be followed by pte_unmap_unlock(): to > keep balance in future, pass ptep as well as ptl to gmap_pte_op_end(), > and use pte_unmap_unlock() instead of direct spin_unlock() (even though > ptep ends up unused inside the macro). > > Signed-off-by: Hugh Dickins > --- > arch/s390/mm/gmap.c | 22 +++--- > 1 file changed, 11 insertions(+), 11 deletions(-) Acked-by: Alexander Gordeev
Re: [PATCH 15/23] s390: allow pte_offset_map_lock() to fail
On Tue, 9 May 2023 22:01:16 -0700 (PDT) Hugh Dickins wrote: > In rare transient cases, not yet made possible, pte_offset_map() and > pte_offset_map_lock() may not find a page table: handle appropriately. > > Signed-off-by: Hugh Dickins > --- > arch/s390/kernel/uv.c | 2 ++ > arch/s390/mm/gmap.c| 2 ++ > arch/s390/mm/pgtable.c | 12 +--- > 3 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c > index cb2ee06df286..3c62d1b218b1 100644 > --- a/arch/s390/kernel/uv.c > +++ b/arch/s390/kernel/uv.c > @@ -294,6 +294,8 @@ int gmap_make_secure(struct gmap *gmap, unsigned long > gaddr, void *uvcb) > > rc = -ENXIO; > ptep = get_locked_pte(gmap->mm, uaddr, ); > + if (!ptep) > + goto out; > if (pte_present(*ptep) && !(pte_val(*ptep) & _PAGE_INVALID) && > pte_write(*ptep)) { > page = pte_page(*ptep); > rc = -EAGAIN; > diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c > index dc90d1eb0d55..d198fc9475a2 100644 > --- a/arch/s390/mm/gmap.c > +++ b/arch/s390/mm/gmap.c > @@ -2549,6 +2549,8 @@ static int __zap_zero_pages(pmd_t *pmd, unsigned long > start, > spinlock_t *ptl; > > ptep = pte_offset_map_lock(walk->mm, pmd, addr, ); > + if (!ptep) > + break; so if pte_offset_map_lock fails, we abort and skip both the failed entry and the rest of the entries? can pte_offset_map_lock be retried immediately if it fails? (consider that we currently don't allow THP with KVM guests) Would something like this: do { ptep = pte_offset_map_lock(...); mb(); /* maybe? */ } while (!ptep); make sense? otherwise maybe it's better to return an error and retry the whole walk_page_range() in s390_enable_sie() ? it's a slow path anyway. > if (is_zero_pfn(pte_pfn(*ptep))) > ptep_xchg_direct(walk->mm, addr, ptep, > __pte(_PAGE_INVALID)); > pte_unmap_unlock(ptep, ptl); [...]
[PATCH v2 2/2] ASoC: use pm.h instead of runtime_pm.h
Do not include pm_runtime.h header in files where runtime PM support is not implemented. Use pm.h instead as suspend to RAM specific implementation is available. Signed-off-by: Claudiu Beznea --- sound/soc/codecs/max98373-i2c.c | 2 +- sound/soc/qcom/lpass-sc7180.c | 2 +- sound/soc/qcom/lpass-sc7280.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c index 3d6da4f133de..0fa5ceca62a2 100644 --- a/sound/soc/codecs/max98373-i2c.c +++ b/sound/soc/codecs/max98373-i2c.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c index 41db6617e2ed..56db852f4eab 100644 --- a/sound/soc/qcom/lpass-sc7180.c +++ b/sound/soc/qcom/lpass-sc7180.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sound/soc/qcom/lpass-sc7280.c b/sound/soc/qcom/lpass-sc7280.c index d43f480cbae3..bcf18fe8e14d 100644 --- a/sound/soc/qcom/lpass-sc7280.c +++ b/sound/soc/qcom/lpass-sc7280.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include -- 2.34.1
[PATCH v2 1/2] ASoC: do not include pm_runtime.h if not used
Do not include pm_runtime.h header in files where APIs exported by pm_runtime.h are not used. Signed-off-by: Claudiu Beznea Acked-by: Jarkko Nikula # for omap-mcbsp-st.c --- sound/hda/hdac_regmap.c | 1 - sound/pci/hda/hda_bind.c | 1 - sound/soc/amd/acp/acp-pci.c | 1 - sound/soc/amd/acp/acp-platform.c | 1 - sound/soc/codecs/max98090.c | 1 - sound/soc/codecs/pcm186x.c| 1 - sound/soc/codecs/rk3328_codec.c | 1 - sound/soc/codecs/rt5682-i2c.c | 1 - sound/soc/codecs/rt5682s.c| 1 - sound/soc/codecs/tas2562.c| 1 - sound/soc/codecs/tas5720.c| 1 - sound/soc/codecs/tas6424.c| 1 - sound/soc/codecs/wm_adsp.c| 1 - sound/soc/fsl/imx-audmix.c| 1 - sound/soc/intel/atom/sst/sst_acpi.c | 1 - sound/soc/intel/atom/sst/sst_ipc.c| 1 - sound/soc/intel/atom/sst/sst_loader.c | 1 - sound/soc/intel/atom/sst/sst_pci.c| 1 - sound/soc/intel/atom/sst/sst_stream.c | 1 - sound/soc/mediatek/mt8186/mt8186-afe-control.c| 1 - sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c | 1 - sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c | 1 - sound/soc/mediatek/mt8192/mt8192-afe-control.c| 2 -- sound/soc/soc-compress.c | 1 - sound/soc/soc-pcm.c | 1 - sound/soc/sof/intel/hda-loader-skl.c | 1 - sound/soc/sof/intel/hda-stream.c | 1 - sound/soc/sof/intel/skl.c | 1 - sound/soc/sof/mediatek/mt8186/mt8186-clk.c| 1 - sound/soc/sof/mediatek/mt8195/mt8195-clk.c| 1 - sound/soc/tegra/tegra20_ac97.c| 1 - sound/soc/ti/omap-mcbsp-st.c | 1 - 32 files changed, 33 deletions(-) diff --git a/sound/hda/hdac_regmap.c b/sound/hda/hdac_regmap.c index fe3587547cfe..7cfaa908ff57 100644 --- a/sound/hda/hdac_regmap.c +++ b/sound/hda/hdac_regmap.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c index 890c2f7c33fc..b7ca2a83fbb0 100644 --- a/sound/pci/hda/hda_bind.c +++ b/sound/pci/hda/hda_bind.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include "hda_local.h" diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index a0c84cd07fde..8154fbfd1229 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include "amd.h" diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c index 447612a7a762..f220378ec20e 100644 --- a/sound/soc/amd/acp/acp-platform.c +++ b/sound/soc/amd/acp/acp-platform.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include "amd.h" diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index ad417d80691f..7bc463910d4f 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/pcm186x.c b/sound/soc/codecs/pcm186x.c index dd21803ba13c..451a8fd8fac5 100644 --- a/sound/soc/codecs/pcm186x.c +++ b/sound/soc/codecs/pcm186x.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/rk3328_codec.c b/sound/soc/codecs/rk3328_codec.c index 1d523bfd9d84..9697aefc6e03 100644 --- a/sound/soc/codecs/rk3328_codec.c +++ b/sound/soc/codecs/rk3328_codec.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c index d0041ba1e627..a88fcf507386 100644 --- a/sound/soc/codecs/rt5682-i2c.c +++ b/sound/soc/codecs/rt5682-i2c.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/rt5682s.c b/sound/soc/codecs/rt5682s.c index 81163b026b9e..cc12df15ee86 100644 --- a/sound/soc/codecs/rt5682s.c +++ b/sound/soc/codecs/rt5682s.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c index 2012d6f0071d..962c2cdfa017 100644 --- a/sound/soc/codecs/tas2562.c +++ b/sound/soc/codecs/tas2562.c @@ -8,7 +8,6 @@ #include #include
[PATCH v2 0/2] ASoC: do not include runtime_pm.h if not needed
Hi, Series removes the pm_runtime.h inclusion in files where APIs exported though pm_runtime.h are not used. In case of files that make use of pm.h which comes form pm_runtime.h added patch 2/2. Changes were built with allmodconfig on ARM and x86_64 and checked all the changed files were built at least once. Thank you, Claudiu Beznea Changes in v2: - removed cs35l45 handling - changed a bit commit description - added patch 2/2 - collected Jarkko Nikula's tag Claudiu Beznea (2): ASoC: do not include pm_runtime.h if not used ASoC: use pm.h instead of runtime_pm.h sound/hda/hdac_regmap.c | 1 - sound/pci/hda/hda_bind.c | 1 - sound/soc/amd/acp/acp-pci.c | 1 - sound/soc/amd/acp/acp-platform.c | 1 - sound/soc/codecs/max98090.c | 1 - sound/soc/codecs/max98373-i2c.c | 2 +- sound/soc/codecs/pcm186x.c| 1 - sound/soc/codecs/rk3328_codec.c | 1 - sound/soc/codecs/rt5682-i2c.c | 1 - sound/soc/codecs/rt5682s.c| 1 - sound/soc/codecs/tas2562.c| 1 - sound/soc/codecs/tas5720.c| 1 - sound/soc/codecs/tas6424.c| 1 - sound/soc/codecs/wm_adsp.c| 1 - sound/soc/fsl/imx-audmix.c| 1 - sound/soc/intel/atom/sst/sst_acpi.c | 1 - sound/soc/intel/atom/sst/sst_ipc.c| 1 - sound/soc/intel/atom/sst/sst_loader.c | 1 - sound/soc/intel/atom/sst/sst_pci.c| 1 - sound/soc/intel/atom/sst/sst_stream.c | 1 - sound/soc/mediatek/mt8186/mt8186-afe-control.c| 1 - sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c | 1 - sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c | 1 - sound/soc/mediatek/mt8192/mt8192-afe-control.c| 2 -- sound/soc/qcom/lpass-sc7180.c | 2 +- sound/soc/qcom/lpass-sc7280.c | 2 +- sound/soc/soc-compress.c | 1 - sound/soc/soc-pcm.c | 1 - sound/soc/sof/intel/hda-loader-skl.c | 1 - sound/soc/sof/intel/hda-stream.c | 1 - sound/soc/sof/intel/skl.c | 1 - sound/soc/sof/mediatek/mt8186/mt8186-clk.c| 1 - sound/soc/sof/mediatek/mt8195/mt8195-clk.c| 1 - sound/soc/tegra/tegra20_ac97.c| 1 - sound/soc/ti/omap-mcbsp-st.c | 1 - 35 files changed, 3 insertions(+), 36 deletions(-) -- 2.34.1
Re: [PATCH] powerpc/security: Fix Speculation_Store_Bypass reporting on Power10
On 17/05/23 1:19 pm, Michael Ellerman wrote: Nageswara reported that /proc/self/status was showing "vulnerable" for the Speculation_Store_Bypass feature on Power10, eg: $ grep Speculation_Store_Bypass: /proc/self/status Speculation_Store_Bypass: vulnerable But at the same time the sysfs files, and lscpu, were showing "Not affected". This turns out to simply be a bug in the reporting of the Speculation_Store_Bypass, aka. PR_SPEC_STORE_BYPASS, case. When SEC_FTR_STF_BARRIER was added, so that firmware could communicate the vulnerability was not present, the code in ssb_prctl_get() was not updated to check the new flag. So add the check for SEC_FTR_STF_BARRIER being disabled. Rather than adding the new check to the existing if block and expanding the comment to cover both cases, rewrite the three cases to be separate so they can be commented separately for clarity. Fixes: 84ed26fd00c5 ("powerpc/security: Add a security feature for STF barrier") Cc: sta...@vger.kernel.org # v5.14+ Reported-by: Nageswara R Sastry Signed-off-by: Michael Ellerman Thanks for the patch. Adding tested-by tag along with test results. With out patch: # grep Speculation_Store_Bypass: /proc/self/status Speculation_Store_Bypass: vulnerable # uname -r 6.4.0-rc2 With patch: # grep Speculation_Store_Bypass: /proc/self/status Speculation_Store_Bypass: not vulnerable # uname -r 6.4.0-rc2 Tested-by: Nageswara R Sastry --- arch/powerpc/kernel/security.c | 37 +- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c index 206475e3e0b4..4856e1a5161c 100644 --- a/arch/powerpc/kernel/security.c +++ b/arch/powerpc/kernel/security.c @@ -364,26 +364,27 @@ ssize_t cpu_show_spec_store_bypass(struct device *dev, struct device_attribute * static int ssb_prctl_get(struct task_struct *task) { + /* +* The STF_BARRIER feature is on by default, so if it's off that means +* firmware has explicitly said the CPU is not vulnerable via either +* the hypercall or device tree. +*/ + if (!security_ftr_enabled(SEC_FTR_STF_BARRIER)) + return PR_SPEC_NOT_AFFECTED; + + /* +* If the system's CPU has no known barrier (see setup_stf_barrier()) +* then assume that the CPU is not vulnerable. +*/ if (stf_enabled_flush_types == STF_BARRIER_NONE) - /* -* We don't have an explicit signal from firmware that we're -* vulnerable or not, we only have certain CPU revisions that -* are known to be vulnerable. -* -* We assume that if we're on another CPU, where the barrier is -* NONE, then we are not vulnerable. -*/ return PR_SPEC_NOT_AFFECTED; - else - /* -* If we do have a barrier type then we are vulnerable. The -* barrier is not a global or per-process mitigation, so the -* only value we can report here is PR_SPEC_ENABLE, which -* appears as "vulnerable" in /proc. -*/ - return PR_SPEC_ENABLE; - - return -EINVAL; + + /* +* Otherwise the CPU is vulnerable. The barrier is not a global or +* per-process mitigation, so the only value that can be reported here +* is PR_SPEC_ENABLE, which appears as "vulnerable" in /proc. +*/ + return PR_SPEC_ENABLE; } int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which) -- Thanks and Regards R.Nageswara Sastry
[PATCH] powerpc/security: Fix Speculation_Store_Bypass reporting on Power10
Nageswara reported that /proc/self/status was showing "vulnerable" for the Speculation_Store_Bypass feature on Power10, eg: $ grep Speculation_Store_Bypass: /proc/self/status Speculation_Store_Bypass: vulnerable But at the same time the sysfs files, and lscpu, were showing "Not affected". This turns out to simply be a bug in the reporting of the Speculation_Store_Bypass, aka. PR_SPEC_STORE_BYPASS, case. When SEC_FTR_STF_BARRIER was added, so that firmware could communicate the vulnerability was not present, the code in ssb_prctl_get() was not updated to check the new flag. So add the check for SEC_FTR_STF_BARRIER being disabled. Rather than adding the new check to the existing if block and expanding the comment to cover both cases, rewrite the three cases to be separate so they can be commented separately for clarity. Fixes: 84ed26fd00c5 ("powerpc/security: Add a security feature for STF barrier") Cc: sta...@vger.kernel.org # v5.14+ Reported-by: Nageswara R Sastry Signed-off-by: Michael Ellerman --- arch/powerpc/kernel/security.c | 37 +- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c index 206475e3e0b4..4856e1a5161c 100644 --- a/arch/powerpc/kernel/security.c +++ b/arch/powerpc/kernel/security.c @@ -364,26 +364,27 @@ ssize_t cpu_show_spec_store_bypass(struct device *dev, struct device_attribute * static int ssb_prctl_get(struct task_struct *task) { + /* +* The STF_BARRIER feature is on by default, so if it's off that means +* firmware has explicitly said the CPU is not vulnerable via either +* the hypercall or device tree. +*/ + if (!security_ftr_enabled(SEC_FTR_STF_BARRIER)) + return PR_SPEC_NOT_AFFECTED; + + /* +* If the system's CPU has no known barrier (see setup_stf_barrier()) +* then assume that the CPU is not vulnerable. +*/ if (stf_enabled_flush_types == STF_BARRIER_NONE) - /* -* We don't have an explicit signal from firmware that we're -* vulnerable or not, we only have certain CPU revisions that -* are known to be vulnerable. -* -* We assume that if we're on another CPU, where the barrier is -* NONE, then we are not vulnerable. -*/ return PR_SPEC_NOT_AFFECTED; - else - /* -* If we do have a barrier type then we are vulnerable. The -* barrier is not a global or per-process mitigation, so the -* only value we can report here is PR_SPEC_ENABLE, which -* appears as "vulnerable" in /proc. -*/ - return PR_SPEC_ENABLE; - - return -EINVAL; + + /* +* Otherwise the CPU is vulnerable. The barrier is not a global or +* per-process mitigation, so the only value that can be reported here +* is PR_SPEC_ENABLE, which appears as "vulnerable" in /proc. +*/ + return PR_SPEC_ENABLE; } int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which) -- 2.40.1
[PATCH] powerpc: Mark powermac as orphan in MAINTAINERS
Ben no longer has time to do any maintenance of the powermac code. Mark it as orphan. Signed-off-by: Michael Ellerman --- MAINTAINERS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index e0ad886d3163..865a50238f44 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11907,9 +11907,8 @@ F: lib/linear_ranges.c F: lib/test_linear_ranges.c LINUX FOR POWER MACINTOSH -M: Benjamin Herrenschmidt L: linuxppc-dev@lists.ozlabs.org -S: Odd Fixes +S: Orphan F: arch/powerpc/platforms/powermac/ F: drivers/macintosh/ -- 2.40.1
Re: [PATCH] procfs: consolidate arch_report_meminfo declaration
On Tue, 16 May 2023 21:57:29 +0200, Arnd Bergmann wrote: > The arch_report_meminfo() function is provided by four architectures, > with a __weak fallback in procfs itself. On architectures that don't > have a custom version, the __weak version causes a warning because > of the missing prototype. > > Remove the architecture specific prototypes and instead add one > in linux/proc_fs.h. > > [...] Applied to the vfs.misc branch of the vfs/vfs.git tree. Patches in the vfs.misc branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.misc [1/1] procfs: consolidate arch_report_meminfo declaration https://git.kernel.org/vfs/vfs/c/edb0469aa6e8
Re: [PATCH v5 RESEND 15/17] powerpc: mm: Convert to GENERIC_IOREMAP
Looks good: Reviewed-by: Christoph Hellwig
Re: [PATCH v5 RESEND 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros
Looks good: Reviewed-by: Christoph Hellwig