All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ethernet: ibmveth: use default_groups in kobj_type
From: Greg Kroah-Hartman @ 2022-01-05 18:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: Cristobal Forno, Greg Kroah-Hartman, netdev, Paul Mackerras,
	Jakub Kicinski, linuxppc-dev, David S. Miller

There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field.  Move the ibmveth sysfs code to use default_groups
field which has been the preferred way since aa30f47cf666 ("kobject: Add
support for default attribute groups to kobj_type") so that we can soon
get rid of the obsolete default_attrs field.

Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Cristobal Forno <cforno12@linux.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/ibm/ibmveth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 45ba40cf4d07..22fb0d109a68 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1890,6 +1890,7 @@ static struct attribute *veth_pool_attrs[] = {
 	&veth_size_attr,
 	NULL,
 };
+ATTRIBUTE_GROUPS(veth_pool);
 
 static const struct sysfs_ops veth_pool_ops = {
 	.show   = veth_pool_show,
@@ -1899,7 +1900,7 @@ static const struct sysfs_ops veth_pool_ops = {
 static struct kobj_type ktype_veth_pool = {
 	.release        = NULL,
 	.sysfs_ops      = &veth_pool_ops,
-	.default_attrs  = veth_pool_attrs,
+	.default_groups = veth_pool_groups,
 };
 
 static int ibmveth_resume(struct device *dev)
-- 
2.34.1


^ permalink raw reply related

* Re: [PATCH v8 18/40] KVM: SVM: Create a separate mapping for the GHCB save area
From: Venu Busireddy @ 2022-01-05 18:41 UTC (permalink / raw)
  To: Brijesh Singh
  Cc: x86, linux-kernel, kvm, linux-efi, platform-driver-x86,
	linux-coco, linux-mm, Thomas Gleixner, Ingo Molnar, Joerg Roedel,
	Tom Lendacky, H. Peter Anvin, Ard Biesheuvel, Paolo Bonzini,
	Sean Christopherson, Vitaly Kuznetsov, Jim Mattson,
	Andy Lutomirski, Dave Hansen, Sergio Lopez, Peter Gonda,
	Peter Zijlstra, Srinivas Pandruvada, David Rientjes, Dov Murik,
	Tobin Feldman-Fitzthum, Borislav Petkov, Michael Roth,
	Vlastimil Babka, Kirill A . Shutemov, Andi Kleen,
	Dr . David Alan Gilbert, tony.luck, marcorr,
	sathyanarayanan.kuppuswamy
In-Reply-To: <20211210154332.11526-19-brijesh.singh@amd.com>

On 2021-12-10 09:43:10 -0600, Brijesh Singh wrote:
> From: Tom Lendacky <thomas.lendacky@amd.com>
> 
> The initial implementation of the GHCB spec was based on trying to keep
> the register state offsets the same relative to the VM save area. However,
> the save area for SEV-ES has changed within the hardware causing the
> relation between the SEV-ES save area to change relative to the GHCB save
> area.
> 
> This is the second step in defining the multiple save areas to keep them
> separate and ensuring proper operation amongst the different types of
> guests. Create a GHCB save area that matches the GHCB specification.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>

Reviewed-by: Venu Busireddy <venu.busireddy@oracle.com>

> ---
>  arch/x86/include/asm/svm.h | 48 +++++++++++++++++++++++++++++++++++---
>  1 file changed, 45 insertions(+), 3 deletions(-)
> 

^ permalink raw reply

* Re: [PATCH] phy: mapphone-mdm6600: Fix PM disable depth imbalance in phy_mdm6600_probe
From: kernel test robot @ 2022-01-05 18:41 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: llvm, kbuild-all, linmq006, Kishon Vijay Abraham I, Vinod Koul,
	Tony Lindgren, linux-phy, linux-kernel
In-Reply-To: <20220105123947.17946-1-linmq006@gmail.com>

Hi Miaoqian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc8 next-20220105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Miaoqian-Lin/phy-mapphone-mdm6600-Fix-PM-disable-depth-imbalance-in-phy_mdm6600_probe/20220105-204113
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c9e6606c7fe92b50a02ce51dda82586ebdf99b48
config: hexagon-randconfig-r035-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060211.yT7coTKI-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/62cad5a4dd9feab731b40f99e6e0bf7a2429f1ed
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Miaoqian-Lin/phy-mapphone-mdm6600-Fix-PM-disable-depth-imbalance-in-phy_mdm6600_probe/20220105-204113
        git checkout 62cad5a4dd9feab731b40f99e6e0bf7a2429f1ed
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/phy/motorola/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/phy/motorola/phy-mapphone-mdm6600.c:633:1: warning: unused label 'disable_pm' [-Wunused-label]
   disable_pm:
   ^~~~~~~~~~~
   1 warning generated.


vim +/disable_pm +633 drivers/phy/motorola/phy-mapphone-mdm6600.c

   555	
   556	static int phy_mdm6600_probe(struct platform_device *pdev)
   557	{
   558		struct phy_mdm6600 *ddata;
   559		int error;
   560	
   561		ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
   562		if (!ddata)
   563			return -ENOMEM;
   564	
   565		INIT_DELAYED_WORK(&ddata->bootup_work,
   566				  phy_mdm6600_deferred_power_on);
   567		INIT_DELAYED_WORK(&ddata->status_work, phy_mdm6600_status);
   568		INIT_DELAYED_WORK(&ddata->modem_wake_work, phy_mdm6600_modem_wake);
   569		init_completion(&ddata->ack);
   570	
   571		ddata->dev = &pdev->dev;
   572		platform_set_drvdata(pdev, ddata);
   573	
   574		/* Active state selected in phy_mdm6600_power_on() */
   575		error = pinctrl_pm_select_sleep_state(ddata->dev);
   576		if (error)
   577			dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
   578				 __func__, error);
   579	
   580		error = phy_mdm6600_init_lines(ddata);
   581		if (error)
   582			return error;
   583	
   584		phy_mdm6600_init_irq(ddata);
   585		schedule_delayed_work(&ddata->bootup_work, 0);
   586	
   587		/*
   588		 * See phy_mdm6600_device_power_on(). We should be able
   589		 * to remove this eventually when ohci-platform can deal
   590		 * with -EPROBE_DEFER.
   591		 */
   592		msleep(PHY_MDM6600_PHY_DELAY_MS + 500);
   593	
   594		/*
   595		 * Enable PM runtime only after PHY has been powered up properly.
   596		 * It is currently only needed after USB suspends mdm6600 and n_gsm
   597		 * needs to access the device. We don't want to do this earlier as
   598		 * gpio mode0 pin doubles as mdm6600 wake-up gpio.
   599		 */
   600		pm_runtime_use_autosuspend(ddata->dev);
   601		pm_runtime_set_autosuspend_delay(ddata->dev,
   602						 MDM6600_MODEM_IDLE_DELAY_MS);
   603		pm_runtime_enable(ddata->dev);
   604		error = pm_runtime_get_sync(ddata->dev);
   605		if (error < 0) {
   606			dev_warn(ddata->dev, "failed to wake modem: %i\n", error);
   607			pm_runtime_put_noidle(ddata->dev);
   608			goto cleanup;
   609		}
   610	
   611		ddata->generic_phy = devm_phy_create(ddata->dev, NULL, &gpio_usb_ops);
   612		if (IS_ERR(ddata->generic_phy)) {
   613			error = PTR_ERR(ddata->generic_phy);
   614			goto idle;
   615		}
   616	
   617		phy_set_drvdata(ddata->generic_phy, ddata);
   618	
   619		ddata->phy_provider =
   620			devm_of_phy_provider_register(ddata->dev,
   621						      of_phy_simple_xlate);
   622		if (IS_ERR(ddata->phy_provider))
   623			error = PTR_ERR(ddata->phy_provider);
   624	
   625	idle:
   626		pm_runtime_mark_last_busy(ddata->dev);
   627		pm_runtime_put_autosuspend(ddata->dev);
   628	
   629	cleanup:
   630		if (error < 0)
   631			phy_mdm6600_device_power_off(ddata);
   632	
 > 633	disable_pm:
   634		pm_runtime_disable(ddata->dev);
   635	
   636		return error;
   637	}
   638	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* Re: [PATCH] phy: mapphone-mdm6600: Fix PM disable depth imbalance in phy_mdm6600_probe
From: kernel test robot @ 2022-01-05 18:41 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: llvm, kbuild-all, linmq006, Kishon Vijay Abraham I, Vinod Koul,
	Tony Lindgren, linux-phy, linux-kernel
In-Reply-To: <20220105123947.17946-1-linmq006@gmail.com>

Hi Miaoqian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc8 next-20220105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Miaoqian-Lin/phy-mapphone-mdm6600-Fix-PM-disable-depth-imbalance-in-phy_mdm6600_probe/20220105-204113
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c9e6606c7fe92b50a02ce51dda82586ebdf99b48
config: hexagon-randconfig-r035-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060211.yT7coTKI-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/62cad5a4dd9feab731b40f99e6e0bf7a2429f1ed
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Miaoqian-Lin/phy-mapphone-mdm6600-Fix-PM-disable-depth-imbalance-in-phy_mdm6600_probe/20220105-204113
        git checkout 62cad5a4dd9feab731b40f99e6e0bf7a2429f1ed
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/phy/motorola/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/phy/motorola/phy-mapphone-mdm6600.c:633:1: warning: unused label 'disable_pm' [-Wunused-label]
   disable_pm:
   ^~~~~~~~~~~
   1 warning generated.


vim +/disable_pm +633 drivers/phy/motorola/phy-mapphone-mdm6600.c

   555	
   556	static int phy_mdm6600_probe(struct platform_device *pdev)
   557	{
   558		struct phy_mdm6600 *ddata;
   559		int error;
   560	
   561		ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
   562		if (!ddata)
   563			return -ENOMEM;
   564	
   565		INIT_DELAYED_WORK(&ddata->bootup_work,
   566				  phy_mdm6600_deferred_power_on);
   567		INIT_DELAYED_WORK(&ddata->status_work, phy_mdm6600_status);
   568		INIT_DELAYED_WORK(&ddata->modem_wake_work, phy_mdm6600_modem_wake);
   569		init_completion(&ddata->ack);
   570	
   571		ddata->dev = &pdev->dev;
   572		platform_set_drvdata(pdev, ddata);
   573	
   574		/* Active state selected in phy_mdm6600_power_on() */
   575		error = pinctrl_pm_select_sleep_state(ddata->dev);
   576		if (error)
   577			dev_warn(ddata->dev, "%s: error with sleep_state: %i\n",
   578				 __func__, error);
   579	
   580		error = phy_mdm6600_init_lines(ddata);
   581		if (error)
   582			return error;
   583	
   584		phy_mdm6600_init_irq(ddata);
   585		schedule_delayed_work(&ddata->bootup_work, 0);
   586	
   587		/*
   588		 * See phy_mdm6600_device_power_on(). We should be able
   589		 * to remove this eventually when ohci-platform can deal
   590		 * with -EPROBE_DEFER.
   591		 */
   592		msleep(PHY_MDM6600_PHY_DELAY_MS + 500);
   593	
   594		/*
   595		 * Enable PM runtime only after PHY has been powered up properly.
   596		 * It is currently only needed after USB suspends mdm6600 and n_gsm
   597		 * needs to access the device. We don't want to do this earlier as
   598		 * gpio mode0 pin doubles as mdm6600 wake-up gpio.
   599		 */
   600		pm_runtime_use_autosuspend(ddata->dev);
   601		pm_runtime_set_autosuspend_delay(ddata->dev,
   602						 MDM6600_MODEM_IDLE_DELAY_MS);
   603		pm_runtime_enable(ddata->dev);
   604		error = pm_runtime_get_sync(ddata->dev);
   605		if (error < 0) {
   606			dev_warn(ddata->dev, "failed to wake modem: %i\n", error);
   607			pm_runtime_put_noidle(ddata->dev);
   608			goto cleanup;
   609		}
   610	
   611		ddata->generic_phy = devm_phy_create(ddata->dev, NULL, &gpio_usb_ops);
   612		if (IS_ERR(ddata->generic_phy)) {
   613			error = PTR_ERR(ddata->generic_phy);
   614			goto idle;
   615		}
   616	
   617		phy_set_drvdata(ddata->generic_phy, ddata);
   618	
   619		ddata->phy_provider =
   620			devm_of_phy_provider_register(ddata->dev,
   621						      of_phy_simple_xlate);
   622		if (IS_ERR(ddata->phy_provider))
   623			error = PTR_ERR(ddata->phy_provider);
   624	
   625	idle:
   626		pm_runtime_mark_last_busy(ddata->dev);
   627		pm_runtime_put_autosuspend(ddata->dev);
   628	
   629	cleanup:
   630		if (error < 0)
   631			phy_mdm6600_device_power_off(ddata);
   632	
 > 633	disable_pm:
   634		pm_runtime_disable(ddata->dev);
   635	
   636		return error;
   637	}
   638	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply

* stable/linux-5.4.y baseline: 171 runs, 4 regressions (v5.4.170)
From: kernelci.org bot @ 2022-01-05 18:42 UTC (permalink / raw)
  To: stable, kernel-build-reports, kernelci-results

stable/linux-5.4.y baseline: 171 runs, 4 regressions (v5.4.170)

Regressions Summary
-------------------

platform                 | arch | lab          | compiler | defconfig          | regressions
-------------------------+------+--------------+----------+--------------------+------------
qemu_arm-virt-gicv2-uefi | arm  | lab-baylibre | gcc-10   | multi_v7_defconfig | 1          
qemu_arm-virt-gicv2-uefi | arm  | lab-broonie  | gcc-10   | multi_v7_defconfig | 1          
qemu_arm-virt-gicv3-uefi | arm  | lab-baylibre | gcc-10   | multi_v7_defconfig | 1          
qemu_arm-virt-gicv3-uefi | arm  | lab-broonie  | gcc-10   | multi_v7_defconfig | 1          

  Details:  https://kernelci.org/test/job/stable/branch/linux-5.4.y/kernel/v5.4.170/plan/baseline/

  Test:     baseline
  Tree:     stable
  Branch:   linux-5.4.y
  Describe: v5.4.170
  URL:      https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
  SHA:      047dedaa38ce703d3c6a6b0fae180c85a5220cdb 


Test Regressions
---------------- 


platform                 | arch | lab          | compiler | defconfig          | regressions
-------------------------+------+--------------+----------+--------------------+------------
qemu_arm-virt-gicv2-uefi | arm  | lab-baylibre | gcc-10   | multi_v7_defconfig | 1          

  Details:     https://kernelci.org/test/plan/id/61d5b0a7458e6f3eeeef676e

  Results:     0 PASS, 1 FAIL, 0 SKIP
  Full config: multi_v7_defconfig
  Compiler:    gcc-10 (arm-linux-gnueabihf-gcc (Debian 10.2.1-6) 10.2.1 20210110)
  Plain log:   https://storage.kernelci.org//stable/linux-5.4.y/v5.4.170/arm/multi_v7_defconfig/gcc-10/lab-baylibre/baseline-qemu_arm-virt-gicv2-uefi.txt
  HTML log:    https://storage.kernelci.org//stable/linux-5.4.y/v5.4.170/arm/multi_v7_defconfig/gcc-10/lab-baylibre/baseline-qemu_arm-virt-gicv2-uefi.html
  Rootfs:      http://storage.kernelci.org/images/rootfs/buildroot/buildroot-baseline/20211210.0/armel/rootfs.cpio.gz 


  * baseline.login: https://kernelci.org/test/case/id/61d5b0a7458e6f3eeeef676f
        failing since 19 days (last pass: v5.4.166, first fail: v5.4.167) 
 


platform                 | arch | lab          | compiler | defconfig          | regressions
-------------------------+------+--------------+----------+--------------------+------------
qemu_arm-virt-gicv2-uefi | arm  | lab-broonie  | gcc-10   | multi_v7_defconfig | 1          

  Details:     https://kernelci.org/test/plan/id/61d5b0a5048cca3cccef673d

  Results:     0 PASS, 1 FAIL, 0 SKIP
  Full config: multi_v7_defconfig
  Compiler:    gcc-10 (arm-linux-gnueabihf-gcc (Debian 10.2.1-6) 10.2.1 20210110)
  Plain log:   https://storage.kernelci.org//stable/linux-5.4.y/v5.4.170/arm/multi_v7_defconfig/gcc-10/lab-broonie/baseline-qemu_arm-virt-gicv2-uefi.txt
  HTML log:    https://storage.kernelci.org//stable/linux-5.4.y/v5.4.170/arm/multi_v7_defconfig/gcc-10/lab-broonie/baseline-qemu_arm-virt-gicv2-uefi.html
  Rootfs:      http://storage.kernelci.org/images/rootfs/buildroot/buildroot-baseline/20211210.0/armel/rootfs.cpio.gz 


  * baseline.login: https://kernelci.org/test/case/id/61d5b0a5048cca3cccef673e
        failing since 19 days (last pass: v5.4.166, first fail: v5.4.167) 
 


platform                 | arch | lab          | compiler | defconfig          | regressions
-------------------------+------+--------------+----------+--------------------+------------
qemu_arm-virt-gicv3-uefi | arm  | lab-baylibre | gcc-10   | multi_v7_defconfig | 1          

  Details:     https://kernelci.org/test/plan/id/61d5b0a89b7d0d67cbef6741

  Results:     0 PASS, 1 FAIL, 0 SKIP
  Full config: multi_v7_defconfig
  Compiler:    gcc-10 (arm-linux-gnueabihf-gcc (Debian 10.2.1-6) 10.2.1 20210110)
  Plain log:   https://storage.kernelci.org//stable/linux-5.4.y/v5.4.170/arm/multi_v7_defconfig/gcc-10/lab-baylibre/baseline-qemu_arm-virt-gicv3-uefi.txt
  HTML log:    https://storage.kernelci.org//stable/linux-5.4.y/v5.4.170/arm/multi_v7_defconfig/gcc-10/lab-baylibre/baseline-qemu_arm-virt-gicv3-uefi.html
  Rootfs:      http://storage.kernelci.org/images/rootfs/buildroot/buildroot-baseline/20211210.0/armel/rootfs.cpio.gz 


  * baseline.login: https://kernelci.org/test/case/id/61d5b0a89b7d0d67cbef6742
        failing since 19 days (last pass: v5.4.166, first fail: v5.4.167) 
 


platform                 | arch | lab          | compiler | defconfig          | regressions
-------------------------+------+--------------+----------+--------------------+------------
qemu_arm-virt-gicv3-uefi | arm  | lab-broonie  | gcc-10   | multi_v7_defconfig | 1          

  Details:     https://kernelci.org/test/plan/id/61d5b0a647133fb1eeef673d

  Results:     0 PASS, 1 FAIL, 0 SKIP
  Full config: multi_v7_defconfig
  Compiler:    gcc-10 (arm-linux-gnueabihf-gcc (Debian 10.2.1-6) 10.2.1 20210110)
  Plain log:   https://storage.kernelci.org//stable/linux-5.4.y/v5.4.170/arm/multi_v7_defconfig/gcc-10/lab-broonie/baseline-qemu_arm-virt-gicv3-uefi.txt
  HTML log:    https://storage.kernelci.org//stable/linux-5.4.y/v5.4.170/arm/multi_v7_defconfig/gcc-10/lab-broonie/baseline-qemu_arm-virt-gicv3-uefi.html
  Rootfs:      http://storage.kernelci.org/images/rootfs/buildroot/buildroot-baseline/20211210.0/armel/rootfs.cpio.gz 


  * baseline.login: https://kernelci.org/test/case/id/61d5b0a647133fb1eeef673e
        failing since 19 days (last pass: v5.4.166, first fail: v5.4.167) 
  

^ permalink raw reply

* Re: [PATCH 13/13] iio:st-sensors: Move exports into ST_SENSORS namespace
From: Gwendal Grignou @ 2022-01-05 18:43 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Andy Shevchenko, Jonathan Cameron, Linus Walleij,
	Denis Ciocca
In-Reply-To: <20211230193331.283503-14-jic23@kernel.org>

On Thu, Dec 30, 2021 at 11:28 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> To avoid unnecessary pollution of the global symbol namespace move the
> driver core and type specific core exports into their a new namespace
> and import that where needed.
>
> For more info see https://lwn.net/Articles/760045/
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Denis Ciocca <denis.ciocca@st.com>
Code looks good, but the naming "ST_SENSORS" is not consistent with
existing namespaces already present in the iio subsystem:
12f13d1faead808 ("iio: hid-sensors: lighten exported symbols by moving
to IIO_HID namespace") has introduced IIO_HID_ATTRIBUTES and IIO_HID.

Would IIO_ST make more sense?

Gwendal.

> ---
>  drivers/iio/accel/st_accel_core.c             |  5 ++--
>  drivers/iio/accel/st_accel_i2c.c              |  1 +
>  drivers/iio/accel/st_accel_spi.c              |  1 +
>  .../iio/common/st_sensors/st_sensors_buffer.c |  2 +-
>  .../iio/common/st_sensors/st_sensors_core.c   | 28 +++++++++----------
>  .../iio/common/st_sensors/st_sensors_i2c.c    |  2 +-
>  .../iio/common/st_sensors/st_sensors_spi.c    |  2 +-
>  .../common/st_sensors/st_sensors_trigger.c    |  4 +--
>  drivers/iio/gyro/st_gyro_core.c               |  5 ++--
>  drivers/iio/gyro/st_gyro_i2c.c                |  1 +
>  drivers/iio/gyro/st_gyro_spi.c                |  1 +
>  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c  |  3 +-
>  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c   |  1 +
>  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c   |  1 +
>  drivers/iio/magnetometer/st_magn_core.c       |  5 ++--
>  drivers/iio/magnetometer/st_magn_i2c.c        |  1 +
>  drivers/iio/magnetometer/st_magn_spi.c        |  1 +
>  drivers/iio/pressure/st_pressure_core.c       |  5 ++--
>  drivers/iio/pressure/st_pressure_i2c.c        |  1 +
>  drivers/iio/pressure/st_pressure_spi.c        |  1 +
>  20 files changed, 43 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index 31ea19d0ba71..4bb4ce081d45 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -1329,7 +1329,7 @@ const struct st_sensor_settings *st_accel_get_settings(const char *name)
>
>         return &st_accel_sensors_settings[index];
>  }
> -EXPORT_SYMBOL(st_accel_get_settings);
> +EXPORT_SYMBOL_NS(st_accel_get_settings, ST_SENSORS);
>
>  int st_accel_common_probe(struct iio_dev *indio_dev)
>  {
> @@ -1383,8 +1383,9 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
>
>         return devm_iio_device_register(parent, indio_dev);
>  }
> -EXPORT_SYMBOL(st_accel_common_probe);
> +EXPORT_SYMBOL_NS(st_accel_common_probe, ST_SENSORS);
>
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics accelerometers driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
> index c0ce78eebad9..88b2b1767bf2 100644
> --- a/drivers/iio/accel/st_accel_i2c.c
> +++ b/drivers/iio/accel/st_accel_i2c.c
> @@ -194,3 +194,4 @@ module_i2c_driver(st_accel_driver);
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics accelerometers i2c driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
> index b74a1c6d03de..cecd6a38949e 100644
> --- a/drivers/iio/accel/st_accel_spi.c
> +++ b/drivers/iio/accel/st_accel_spi.c
> @@ -164,3 +164,4 @@ module_spi_driver(st_accel_driver);
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics accelerometers spi driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> index 5f2b1fb95fd7..668f825f22a6 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> @@ -76,4 +76,4 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p)
>
>         return IRQ_HANDLED;
>  }
> -EXPORT_SYMBOL(st_sensors_trigger_handler);
> +EXPORT_SYMBOL_NS(st_sensors_trigger_handler, ST_SENSORS);
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index eb452d0c423c..2708a5e9b43d 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -46,7 +46,7 @@ int st_sensors_debugfs_reg_access(struct iio_dev *indio_dev,
>
>         return 0;
>  }
> -EXPORT_SYMBOL(st_sensors_debugfs_reg_access);
> +EXPORT_SYMBOL_NS(st_sensors_debugfs_reg_access, ST_SENSORS);
>
>  static int st_sensors_match_odr(struct st_sensor_settings *sensor_settings,
>                         unsigned int odr, struct st_sensor_odr_avl *odr_out)
> @@ -106,7 +106,7 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
>  st_sensors_match_odr_error:
>         return err;
>  }
> -EXPORT_SYMBOL(st_sensors_set_odr);
> +EXPORT_SYMBOL_NS(st_sensors_set_odr, ST_SENSORS);
>
>  static int st_sensors_match_fs(struct st_sensor_settings *sensor_settings,
>                                         unsigned int fs, int *index_fs_avl)
> @@ -199,7 +199,7 @@ int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable)
>  set_enable_error:
>         return err;
>  }
> -EXPORT_SYMBOL(st_sensors_set_enable);
> +EXPORT_SYMBOL_NS(st_sensors_set_enable, ST_SENSORS);
>
>  int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
>  {
> @@ -213,7 +213,7 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
>                                 axis_enable);
>         return err;
>  }
> -EXPORT_SYMBOL(st_sensors_set_axis_enable);
> +EXPORT_SYMBOL_NS(st_sensors_set_axis_enable, ST_SENSORS);
>
>  static void st_reg_disable(void *reg)
>  {
> @@ -257,7 +257,7 @@ int st_sensors_power_enable(struct iio_dev *indio_dev)
>
>         return devm_add_action_or_reset(parent, st_reg_disable, pdata->vdd_io);
>  }
> -EXPORT_SYMBOL(st_sensors_power_enable);
> +EXPORT_SYMBOL_NS(st_sensors_power_enable, ST_SENSORS);
>
>  static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
>                                         struct st_sensors_platform_data *pdata)
> @@ -352,7 +352,7 @@ void st_sensors_dev_name_probe(struct device *dev, char *name, int len)
>         /* The name from the match takes precedence if present */
>         strlcpy(name, match, len);
>  }
> -EXPORT_SYMBOL(st_sensors_dev_name_probe);
> +EXPORT_SYMBOL_NS(st_sensors_dev_name_probe, ST_SENSORS);
>
>  int st_sensors_init_sensor(struct iio_dev *indio_dev,
>                                         struct st_sensors_platform_data *pdata)
> @@ -437,7 +437,7 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>
>         return err;
>  }
> -EXPORT_SYMBOL(st_sensors_init_sensor);
> +EXPORT_SYMBOL_NS(st_sensors_init_sensor, ST_SENSORS);
>
>  int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
>  {
> @@ -486,7 +486,7 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
>  st_accel_set_dataready_irq_error:
>         return err;
>  }
> -EXPORT_SYMBOL(st_sensors_set_dataready_irq);
> +EXPORT_SYMBOL_NS(st_sensors_set_dataready_irq, ST_SENSORS);
>
>  int st_sensors_set_fullscale_by_gain(struct iio_dev *indio_dev, int scale)
>  {
> @@ -509,7 +509,7 @@ int st_sensors_set_fullscale_by_gain(struct iio_dev *indio_dev, int scale)
>  st_sensors_match_scale_error:
>         return err;
>  }
> -EXPORT_SYMBOL(st_sensors_set_fullscale_by_gain);
> +EXPORT_SYMBOL_NS(st_sensors_set_fullscale_by_gain, ST_SENSORS);
>
>  static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
>                                      struct iio_chan_spec const *ch, int *data)
> @@ -572,7 +572,7 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
>
>         return err;
>  }
> -EXPORT_SYMBOL(st_sensors_read_info_raw);
> +EXPORT_SYMBOL_NS(st_sensors_read_info_raw, ST_SENSORS);
>
>  /*
>   * st_sensors_get_settings_index() - get index of the sensor settings for a
> @@ -599,7 +599,7 @@ int st_sensors_get_settings_index(const char *name,
>
>         return -ENODEV;
>  }
> -EXPORT_SYMBOL(st_sensors_get_settings_index);
> +EXPORT_SYMBOL_NS(st_sensors_get_settings_index, ST_SENSORS);
>
>  /*
>   * st_sensors_verify_id() - verify sensor ID (WhoAmI) is matching with the
> @@ -632,7 +632,7 @@ int st_sensors_verify_id(struct iio_dev *indio_dev)
>
>         return 0;
>  }
> -EXPORT_SYMBOL(st_sensors_verify_id);
> +EXPORT_SYMBOL_NS(st_sensors_verify_id, ST_SENSORS);
>
>  ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
>                                 struct device_attribute *attr, char *buf)
> @@ -654,7 +654,7 @@ ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
>
>         return len;
>  }
> -EXPORT_SYMBOL(st_sensors_sysfs_sampling_frequency_avail);
> +EXPORT_SYMBOL_NS(st_sensors_sysfs_sampling_frequency_avail, ST_SENSORS);
>
>  ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
>                                 struct device_attribute *attr, char *buf)
> @@ -678,7 +678,7 @@ ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
>
>         return len;
>  }
> -EXPORT_SYMBOL(st_sensors_sysfs_scale_avail);
> +EXPORT_SYMBOL_NS(st_sensors_sysfs_scale_avail, ST_SENSORS);
>
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics ST-sensors core");
> diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c b/drivers/iio/common/st_sensors/st_sensors_i2c.c
> index 18bd3c3d99bc..7f9fcc84e032 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
> @@ -61,7 +61,7 @@ int st_sensors_i2c_configure(struct iio_dev *indio_dev,
>
>         return 0;
>  }
> -EXPORT_SYMBOL(st_sensors_i2c_configure);
> +EXPORT_SYMBOL_NS(st_sensors_i2c_configure, ST_SENSORS);
>
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics ST-sensors i2c driver");
> diff --git a/drivers/iio/common/st_sensors/st_sensors_spi.c b/drivers/iio/common/st_sensors/st_sensors_spi.c
> index 7c60050e90dc..bf3893d619ee 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_spi.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_spi.c
> @@ -113,7 +113,7 @@ int st_sensors_spi_configure(struct iio_dev *indio_dev,
>
>         return 0;
>  }
> -EXPORT_SYMBOL(st_sensors_spi_configure);
> +EXPORT_SYMBOL_NS(st_sensors_spi_configure, ST_SENSORS);
>
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics ST-sensors spi driver");
> diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
> index ab7a5a24fa6e..1f382d011146 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
> @@ -227,7 +227,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
>
>         return 0;
>  }
> -EXPORT_SYMBOL(st_sensors_allocate_trigger);
> +EXPORT_SYMBOL_NS(st_sensors_allocate_trigger, ST_SENSORS);
>
>  int st_sensors_validate_device(struct iio_trigger *trig,
>                                struct iio_dev *indio_dev)
> @@ -239,4 +239,4 @@ int st_sensors_validate_device(struct iio_trigger *trig,
>
>         return 0;
>  }
> -EXPORT_SYMBOL(st_sensors_validate_device);
> +EXPORT_SYMBOL_NS(st_sensors_validate_device, ST_SENSORS);
> diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
> index 201050b76fe5..fe599f909806 100644
> --- a/drivers/iio/gyro/st_gyro_core.c
> +++ b/drivers/iio/gyro/st_gyro_core.c
> @@ -472,7 +472,7 @@ const struct st_sensor_settings *st_gyro_get_settings(const char *name)
>
>         return &st_gyro_sensors_settings[index];
>  }
> -EXPORT_SYMBOL(st_gyro_get_settings);
> +EXPORT_SYMBOL_NS(st_gyro_get_settings, ST_SENSORS);
>
>  int st_gyro_common_probe(struct iio_dev *indio_dev)
>  {
> @@ -518,8 +518,9 @@ int st_gyro_common_probe(struct iio_dev *indio_dev)
>
>         return devm_iio_device_register(parent, indio_dev);
>  }
> -EXPORT_SYMBOL(st_gyro_common_probe);
> +EXPORT_SYMBOL_NS(st_gyro_common_probe, ST_SENSORS);
>
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics gyroscopes driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c
> index 163c7ba300c1..4784ad819f73 100644
> --- a/drivers/iio/gyro/st_gyro_i2c.c
> +++ b/drivers/iio/gyro/st_gyro_i2c.c
> @@ -120,3 +120,4 @@ module_i2c_driver(st_gyro_driver);
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics gyroscopes i2c driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c
> index b0023f9b9771..4c6b8b15f894 100644
> --- a/drivers/iio/gyro/st_gyro_spi.c
> +++ b/drivers/iio/gyro/st_gyro_spi.c
> @@ -124,3 +124,4 @@ module_spi_driver(st_gyro_driver);
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics gyroscopes spi driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c
> index 9fb06b7cde3c..48fbd3905074 100644
> --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c
> +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c
> @@ -142,8 +142,9 @@ int st_lsm9ds0_probe(struct st_lsm9ds0 *lsm9ds0, struct regmap *regmap)
>         /* Setup magnetometer device */
>         return st_lsm9ds0_probe_magn(lsm9ds0, regmap);
>  }
> -EXPORT_SYMBOL_GPL(st_lsm9ds0_probe);
> +EXPORT_SYMBOL_NS_GPL(st_lsm9ds0_probe, ST_SENSORS);
>
>  MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
>  MODULE_DESCRIPTION("STMicroelectronics LSM9DS0 IMU core driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c
> index 8f205c477e6f..019b16809f84 100644
> --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c
> +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c
> @@ -77,3 +77,4 @@ module_i2c_driver(st_lsm9ds0_driver);
>  MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
>  MODULE_DESCRIPTION("STMicroelectronics LSM9DS0 IMU I2C driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c
> index 0ddfa53166af..4d631bcb7f41 100644
> --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c
> +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c
> @@ -76,3 +76,4 @@ module_spi_driver(st_lsm9ds0_driver);
>  MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
>  MODULE_DESCRIPTION("STMicroelectronics LSM9DS0 IMU SPI driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
> index 0806a1e65ce4..9f126361b5f0 100644
> --- a/drivers/iio/magnetometer/st_magn_core.c
> +++ b/drivers/iio/magnetometer/st_magn_core.c
> @@ -606,7 +606,7 @@ const struct st_sensor_settings *st_magn_get_settings(const char *name)
>
>         return &st_magn_sensors_settings[index];
>  }
> -EXPORT_SYMBOL(st_magn_get_settings);
> +EXPORT_SYMBOL_NS(st_magn_get_settings, ST_SENSORS);
>
>  int st_magn_common_probe(struct iio_dev *indio_dev)
>  {
> @@ -653,8 +653,9 @@ int st_magn_common_probe(struct iio_dev *indio_dev)
>
>         return devm_iio_device_register(parent, indio_dev);
>  }
> -EXPORT_SYMBOL(st_magn_common_probe);
> +EXPORT_SYMBOL_NS(st_magn_common_probe, ST_SENSORS);
>
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics magnetometers driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c
> index 7237711fc09b..f4a07d89543e 100644
> --- a/drivers/iio/magnetometer/st_magn_i2c.c
> +++ b/drivers/iio/magnetometer/st_magn_i2c.c
> @@ -115,3 +115,4 @@ module_i2c_driver(st_magn_driver);
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics magnetometers i2c driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
> index 489d4462862f..316a1d6c1647 100644
> --- a/drivers/iio/magnetometer/st_magn_spi.c
> +++ b/drivers/iio/magnetometer/st_magn_spi.c
> @@ -106,3 +106,4 @@ module_spi_driver(st_magn_driver);
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics magnetometers spi driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 26a1ee43d56e..14524d8c9783 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -672,7 +672,7 @@ const struct st_sensor_settings *st_press_get_settings(const char *name)
>
>         return &st_press_sensors_settings[index];
>  }
> -EXPORT_SYMBOL(st_press_get_settings);
> +EXPORT_SYMBOL_NS(st_press_get_settings, ST_SENSORS);
>
>  int st_press_common_probe(struct iio_dev *indio_dev)
>  {
> @@ -724,8 +724,9 @@ int st_press_common_probe(struct iio_dev *indio_dev)
>
>         return devm_iio_device_register(parent, indio_dev);
>  }
> -EXPORT_SYMBOL(st_press_common_probe);
> +EXPORT_SYMBOL_NS(st_press_common_probe, ST_SENSORS);
>
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics pressures driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
> index 1939e999a427..3ce69a14fc69 100644
> --- a/drivers/iio/pressure/st_pressure_i2c.c
> +++ b/drivers/iio/pressure/st_pressure_i2c.c
> @@ -120,3 +120,4 @@ module_i2c_driver(st_press_driver);
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics pressures i2c driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
> index d6fc954e28f8..a5302f95e82b 100644
> --- a/drivers/iio/pressure/st_pressure_spi.c
> +++ b/drivers/iio/pressure/st_pressure_spi.c
> @@ -118,3 +118,4 @@ module_spi_driver(st_press_driver);
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics pressures spi driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_IMPORT_NS(ST_SENSORS);
> --
> 2.34.1
>

^ permalink raw reply

* Re: [PATCH v9 03/15] kallsyms: Hide layout
From: Borislav Petkov @ 2022-01-05 18:46 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: linux-hardening, x86, Jesse Brandeburg, Kristen Carlson Accardi,
	Kees Cook, Miklos Szeredi, Ard Biesheuvel, Tony Luck,
	Bruce Schlobohm, Jessica Yu, kernel test robot, Miroslav Benes,
	Evgenii Shatokhin, Jonathan Corbet, Masahiro Yamada, Michal Marek,
	Nick Desaulniers, Herbert Xu, David S. Miller, Thomas Gleixner,
	Will Deacon, Ingo Molnar, Dave Hansen, H. Peter Anvin,
	Andy Lutomirski, Peter Zijlstra, Arnd Bergmann, Josh Poimboeuf,
	Nathan Chancellor, Masami Hiramatsu, Marios Pomonis,
	Sami Tolvanen, H.J. Lu, Nicolas Pitre, linux-kernel, linux-kbuild,
	linux-arch, live-patching, llvm
In-Reply-To: <20211223002209.1092165-4-alexandr.lobakin@intel.com>

On Thu, Dec 23, 2021 at 01:21:57AM +0100, Alexander Lobakin wrote:
> @@ -687,11 +697,12 @@ static void reset_iter(struct kallsym_iter *iter, loff_t new_pos)
>  	iter->name[0] = '\0';
>  	iter->nameoff = get_symbol_offset(new_pos);
>  	iter->pos = new_pos;
> -	if (new_pos == 0) {

	if (!iter->show_layout)
		return;

> +	if (iter->show_layout && new_pos == 0) {
>  		iter->pos_arch_end = 0;
>  		iter->pos_mod_end = 0;
>  		iter->pos_ftrace_mod_end = 0;
>  		iter->pos_bpf_end = 0;
> +		iter->pos_end = 0;
>  	}
>  }

...

> @@ -838,16 +860,54 @@ static int kallsyms_open(struct inode *inode, struct file *file)
>  	 * using get_symbol_offset for every symbol.
>  	 */
>  	struct kallsym_iter *iter;
> -	iter = __seq_open_private(file, &kallsyms_op, sizeof(*iter));
> -	if (!iter)
> -		return -ENOMEM;
> -	reset_iter(iter, 0);
> +	/*
> +	 * This fake iter is needed for the cases with unprivileged
> +	 * access. We need to know the exact number of symbols to
> +	 * randomize the display layout.
> +	 */
> +	struct kallsym_iter fake;
> +	size_t size = sizeof(*iter);
> +	loff_t pos;
> +
> +	fake.show_layout = true;
> +	reset_iter(&fake, 0);
>  
>  	/*
>  	 * Instead of checking this on every s_show() call, cache
>  	 * the result here at open time.
>  	 */
> -	iter->show_value = kallsyms_show_value(file->f_cred);
> +	fake.show_layout = kallsyms_show_value(file->f_cred);
> +	if (fake.show_layout)
> +		goto open;

There are those silly labels again:

	if (!fake.show_layout) {
		for (... )
			;
		size = ...
	}

	iter = __seq_open_private(...

> +
> +	for (pos = kallsyms_num_syms; update_iter_mod(&fake, pos); pos++)
> +		;
> +
> +	size = struct_size(iter, shuffled_pos, fake.pos_end + 1);
> +
> +open:
> +	iter = __seq_open_private(file, &kallsyms_op, size);
> +	if (!iter)
> +		return -ENOMEM;
> +
> +	iter->show_layout = fake.show_layout;
> +	reset_iter(iter, 0);
> +
> +	if (iter->show_layout)
> +		return 0;
> +
> +	/* Copy the bounds since they were already discovered above */
> +	iter->pos_arch_end = fake.pos_arch_end;
> +	iter->pos_mod_end = fake.pos_mod_end;
> +	iter->pos_ftrace_mod_end = fake.pos_ftrace_mod_end;
> +	iter->pos_bpf_end = fake.pos_bpf_end;
> +	iter->pos_end = fake.pos_end;
> +
> +	for (pos = 0; pos <= iter->pos_end; pos++)
> +		iter->shuffled_pos[pos] = pos;
> +
> +	shuffle_array(iter->shuffled_pos, iter->pos_end + 1);
> +
>  	return 0;
>  }

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply

* [PATCH 1/8] json: add support for primitive types
From: James Prestwood @ 2022-01-05 18:46 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 6138 bytes --]

This adds support for boolean, (unsigned) integers, and
null types. JSON_PRIMITIVE should be used as the type when
parsing and the value should be struct json_iter.

Once parsed the actual value can be obtained using one of
the primitive getters. If the type does not match they will
return false.

If using JSON_OPTIONAL with JSON_PRIMITIVE the resulting
iterator can be checked with json_iter_is_valid. If false
the key/value was not found or the type was not matching.
---
 src/json.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 src/json.h |  13 ++++-
 2 files changed, 143 insertions(+), 8 deletions(-)

diff --git a/src/json.c b/src/json.c
index 39570e7e..a83ba464 100644
--- a/src/json.c
+++ b/src/json.c
@@ -85,14 +85,26 @@ static int find_object_tokens(struct json_iter *iter, jsmntok_t *object)
 	return next - object - 1;
 }
 
-static void iter_recurse(struct json_iter *iter, jsmntok_t *object,
+static void iter_recurse(struct json_iter *iter, jsmntok_t *token,
 				struct json_iter *child)
 {
 	struct json_contents *c = iter->contents;
 
 	child->contents = c;
-	child->start = object - c->tokens;
-	child->count = find_object_tokens(iter, object);
+	child->start = token - c->tokens;
+
+	/*
+	* For objects iterating all tokens with the object as the parent
+	* parent should give the total number of tokens for this object.
+	*
+	* For strings/primitives the value is always going to one token which
+	* will not be iteratable. Because of this the count is set to zero to
+	* disallow any iteration on this child iterator.
+	*/
+	if (token->type == JSMN_OBJECT)
+		child->count = find_object_tokens(iter, token);
+	else
+		child->count = 0;
 }
 
 struct json_contents *json_contents_new(const char *json, size_t json_len)
@@ -153,7 +165,7 @@ static void assign_arg(void *data, void *user_data)
 	struct json_arg *arg = data;
 	struct json_contents *c = iter->contents;
 	char **sval;
-	struct json_iter *oval;
+	struct json_iter *iter_val;
 
 	switch (arg->type) {
 	case JSON_STRING:
@@ -163,12 +175,13 @@ static void assign_arg(void *data, void *user_data)
 
 		break;
 	case JSON_OBJECT:
-		oval = arg->value;
+	case JSON_PRIMITIVE:
+		iter_val = arg->value;
 
 		if (!arg->v)
-			oval->start = -1;
+			iter_val->start = -1;
 		else
-			iter_recurse(iter, arg->v, oval);
+			iter_recurse(iter, arg->v, iter_val);
 
 		break;
 	default:
@@ -209,6 +222,7 @@ bool json_iter_parse(struct json_iter *iter, enum json_type type, ...)
 			goto done;
 		case JSON_STRING:
 		case JSON_OBJECT:
+		case JSON_PRIMITIVE:
 			break;
 		default:
 			goto error;
@@ -268,3 +282,113 @@ error:
 	l_queue_destroy(args, l_free);
 	return false;
 }
+
+static bool iter_get_primitive_data(struct json_iter *iter, void **ptr,
+					size_t *len)
+{
+	struct json_contents *c = iter->contents;
+	jsmntok_t *t = c->tokens + iter->start;
+
+	if (t->type != JSMN_PRIMITIVE)
+		return false;
+
+	*ptr = TOK_PTR(c->json, t);
+	*len = TOK_LEN(t);
+
+	return true;
+}
+
+bool json_iter_get_int(struct json_iter *iter, int *i)
+{
+	void *ptr;
+	size_t len;
+	long int r;
+	int t;
+	char *endp;
+
+	if (json_iter_get_null(iter) || json_iter_get_boolean(iter, NULL))
+		return false;
+
+	if (!iter_get_primitive_data(iter, &ptr, &len))
+		return false;
+
+	errno = 0;
+
+	t = r = strtol(ptr, &endp, 0);
+	if (endp == ptr)
+		return false;
+
+	if (errno == ERANGE || r != t)
+		return false;
+
+	if (i)
+		*i = r;
+
+	return true;
+}
+
+bool json_iter_get_uint(struct json_iter *iter, unsigned int *i)
+{
+	void *ptr;
+	size_t len;
+	unsigned long int r;
+	unsigned int t;
+	char *endp;
+
+	if (json_iter_get_null(iter) || json_iter_get_boolean(iter, NULL))
+		return false;
+
+	if (!iter_get_primitive_data(iter, &ptr, &len))
+		return false;
+
+	errno = 0;
+
+	t = r = strtoul(ptr, &endp, 0);
+	if (endp == ptr)
+		return false;
+
+	if (errno == ERANGE || r != t)
+		return false;
+
+	if (i)
+		*i = r;
+
+	return true;
+}
+
+bool json_iter_get_boolean(struct json_iter *iter, bool *b)
+{
+	void *ptr;
+	size_t len;
+
+	if (!iter_get_primitive_data(iter, &ptr, &len))
+		return false;
+
+	if (len == 4 && !memcmp(ptr, "true", 4)) {
+		if (b)
+			*b = true;
+
+		return true;
+	} else if (len == 5 && !memcmp(ptr, "false", 5)) {
+		if (b)
+			*b = false;
+
+		return true;
+	}
+
+	return false;
+}
+
+bool json_iter_get_null(struct json_iter *iter)
+{
+	void *ptr;
+	size_t len;
+
+	if (!iter_get_primitive_data(iter, &ptr, &len))
+		return false;
+
+	if (len == 4 && !memcmp(ptr, "null", 4))
+		return true;
+
+	return false;
+}
diff --git a/src/json.h b/src/json.h
index 915b675b..9f00a9d5 100644
--- a/src/json.h
+++ b/src/json.h
@@ -73,11 +73,22 @@ void json_iter_init(struct json_iter *iter, struct json_contents *c);
  *
  * String values should be of type char ** and must be freed
  * Object values should be of type struct json_iter *
+ * Primitive types (numbers, booleans, null) should be of type
+ * 		struct json_iter *. This is to allow the caller to distinguish
+ * 		between the actual value type after parsing using a getter for
+ * 		the expected type (get_uint/get_int/get_boolean etc.). In
+ * 		addition this lets the caller use JSON_OPTIONAL and check post
+ * 		json_iter_parse if the iterator is valid (json_iter_is_valid).
  *
  * No other types are supported at this time, and json_iter_parse will fail if
  * other types are encountered.
  *
  * JSON_OPTIONAL string values will point to NULL if not found
- * JSON_OPTIONAL objects can be checked with json_object_not_found.
+ * JSON_OPTIONAL objects/primitives can be checked with json_object_is_valid.
  */
 bool json_iter_parse(struct json_iter *iter, enum json_type type, ...);
+
+bool json_iter_get_int(struct json_iter *iter, int *i);
+bool json_iter_get_uint(struct json_iter *iter, unsigned int *i);
+bool json_iter_get_boolean(struct json_iter *iter, bool *b);
+bool json_iter_get_null(struct json_iter *iter);
-- 
2.31.1

^ permalink raw reply related

* [PATCH 2/8] unit: add primitive json test
From: James Prestwood @ 2022-01-05 18:46 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 4739 bytes --]

---
 unit/test-json.c | 111 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 95 insertions(+), 16 deletions(-)

diff --git a/unit/test-json.c b/unit/test-json.c
index 854b92dd..fe8f756f 100644
--- a/unit/test-json.c
+++ b/unit/test-json.c
@@ -84,8 +84,6 @@ static void test_json_unsupported_types(const void *data)
 	 * Valid JSON objects but currently unsupported types
 	 */
 	char arrays[] = "{\"test\":[1, 2, 3, 4]}";
-	char integers[] = "{\"test\": 10 }";
-	char bools[] = "{\"test\": true}";
 
 	struct json_iter iter;
 	struct json_contents *c = json_contents_new(arrays, strlen(arrays));
@@ -95,20 +93,6 @@ static void test_json_unsupported_types(const void *data)
 				JSON_MANDATORY("test", JSON_ARRAY, NULL),
 				JSON_UNDEFINED));
 	json_contents_free(c);
-
-	c = json_contents_new(integers, strlen(integers));
-	json_iter_init(&iter, c);
-	assert(!json_iter_parse(&iter,
-				JSON_MANDATORY("test", JSON_PRIMITIVE, NULL),
-				JSON_UNDEFINED));
-	json_contents_free(c);
-
-	c = json_contents_new(bools, strlen(bools));
-	json_iter_init(&iter, c);
-	assert(!json_iter_parse(&iter,
-				JSON_MANDATORY("test", JSON_PRIMITIVE, NULL),
-				JSON_UNDEFINED));
-	json_contents_free(c);
 }
 
 /*
@@ -248,6 +232,100 @@ static void test_json_larger_object(const void *data)
 	json_contents_free(c);
 }
 
+static void check_primitives(struct json_iter *i, struct json_iter *ui,
+				struct json_iter *t, struct json_iter *f,
+				struct json_iter *null, struct json_iter *obj)
+{
+
+	int i_val;
+	unsigned int ui_val;
+	bool b_val;
+
+	assert(json_iter_is_valid(i));
+	assert(!json_iter_get_uint(i, NULL));
+	assert(!json_iter_get_boolean(i, NULL));
+	assert(!json_iter_get_null(i));
+	assert(json_iter_get_int(i, &i_val));
+	assert(i_val == -10);
+
+	assert(json_iter_is_valid(ui));
+	assert(!json_iter_get_boolean(ui, NULL));
+	assert(!json_iter_get_null(ui));
+	assert(json_iter_get_int(ui, &i_val));
+	assert(json_iter_get_uint(ui, &ui_val));
+	assert(i_val == 10 && ui_val == 10);
+
+
+	assert(json_iter_is_valid(t));
+	assert(!json_iter_get_null(t));
+	assert(!json_iter_get_int(t, NULL));
+	assert(!json_iter_get_uint(t, NULL));
+	assert(json_iter_get_boolean(t, &b_val));
+	assert(b_val == true);
+
+	assert(json_iter_is_valid(f));
+	assert(!json_iter_get_null(f));
+	assert(!json_iter_get_int(f, NULL));
+	assert(!json_iter_get_uint(f, NULL));
+	assert(json_iter_get_boolean(f, &b_val));
+	assert(b_val == false);
+
+	assert(json_iter_is_valid(null));
+	assert(!json_iter_get_int(null, NULL));
+	assert(!json_iter_get_uint(null, NULL));
+	assert(!json_iter_get_boolean(null, NULL));
+	assert(json_iter_get_null(null));
+
+	if (obj) {
+		assert(json_iter_is_valid(obj));
+		assert(json_iter_parse(obj,
+			JSON_MANDATORY("null_val", JSON_PRIMITIVE, null),
+			JSON_MANDATORY("false_val", JSON_PRIMITIVE, f),
+			JSON_MANDATORY("true_val", JSON_PRIMITIVE, t),
+			JSON_MANDATORY("int_val", JSON_PRIMITIVE, i),
+			JSON_MANDATORY("uint_val", JSON_PRIMITIVE, ui),
+			JSON_UNDEFINED));
+
+		check_primitives(i, ui, t, f, null, NULL);
+	}
+}
+
+static void test_json_primitives(const void *data)
+{
+	char json[] = "{\"int_val\": -10,"
+			"\"uint_val\": 10,"
+			"\"true_val\": true,"
+			"\"false_val\": false,"
+			"\"null_val\": null,"
+			"\"obj_val\":{"
+				"\"int_val\": -10,"
+				"\"uint_val\": 10,"
+				"\"true_val\": true,"
+				"\"false_val\": false,"
+				"\"null_val\": null}}";
+	struct json_contents *c = json_contents_new(json, strlen(json));
+	struct json_iter outer, inner, null, f, t, i, ui;
+	struct json_iter not_found;
+
+	json_iter_init(&outer, c);
+	assert(json_iter_parse(&outer,
+			JSON_MANDATORY("obj_val", JSON_OBJECT, &inner),
+			JSON_MANDATORY("null_val", JSON_PRIMITIVE, &null),
+			JSON_MANDATORY("false_val", JSON_PRIMITIVE, &f),
+			JSON_MANDATORY("true_val", JSON_PRIMITIVE, &t),
+			JSON_MANDATORY("int_val", JSON_PRIMITIVE, &i),
+			JSON_MANDATORY("uint_val", JSON_PRIMITIVE, &ui),
+			JSON_OPTIONAL("not_found", JSON_PRIMITIVE, &not_found),
+			JSON_UNDEFINED));
+
+	assert(!json_iter_is_valid(&not_found));
+
+	check_primitives(&i, &ui, &t, &f, &null, &inner);
+
+	json_contents_free(c);
+}
+
+
 int main(int argc, char *argv[])
 {
 	l_test_init(&argc, &argv);
@@ -259,6 +337,7 @@ int main(int argc, char *argv[])
 	l_test_add("json empty objects", test_json_empty_objects, NULL);
 	l_test_add("json parse out of order", test_json_out_of_order, NULL);
 	l_test_add("json larger object", test_json_larger_object, NULL);
+	l_test_add("json test primitives", test_json_primitives, NULL);
 
 	return l_test_run();
 }
-- 
2.31.1

^ permalink raw reply related

* [PATCH 3/8] json: add support for array iteration
From: James Prestwood @ 2022-01-05 18:46 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 5444 bytes --]

Arrays can now be parsed using the JSON_ARRAY type (stored in
a struct json_iter) then iterated using json_iter_next. When
iterating the type can be checked with json_iter_get_type. For
each iteration the value can be obtained using any of the type
getters (int/uint/boolean/null).

For now only primitive type arrays are supported.

Several internal APIs were renamed/altered to make them more
general purpose for both arrays and objects.
---
 src/json.c | 64 ++++++++++++++++++++++++++++++++++++++++++------------
 src/json.h |  5 +++++
 2 files changed, 55 insertions(+), 14 deletions(-)

diff --git a/src/json.c b/src/json.c
index a83ba464..879d43be 100644
--- a/src/json.c
+++ b/src/json.c
@@ -56,7 +56,8 @@ struct json_contents {
 	jsmn_parser *p;
 };
 
-static jsmntok_t *next_key_in_parent(struct json_iter *iter, jsmntok_t *current)
+static jsmntok_t *next_token_in_parent(struct json_iter *iter,
+					jsmntok_t *current)
 {
 	int parent = current->parent;
 
@@ -69,20 +70,14 @@ static jsmntok_t *next_key_in_parent(struct json_iter *iter, jsmntok_t *current)
 	return NULL;
 }
 
-/*
- * 'object' is expected to be a value, so object - 1 is its key. Find
- * the next key who's parent matches the parent of object - 1. The
- * token preceeding this next key will mark the end of 'object'.
- */
-static int find_object_tokens(struct json_iter *iter, jsmntok_t *object)
+static int find_parent_tokens(struct json_iter *iter, jsmntok_t *token)
 {
-	jsmntok_t *next = next_key_in_parent(iter, object - 1);
+	jsmntok_t *next = next_token_in_parent(iter, token);
 
-	/* End of token list */
 	if (!next)
 		next = ITER_END(iter);
 
-	return next - object - 1;
+	return next - token;
 }
 
 static void iter_recurse(struct json_iter *iter, jsmntok_t *token,
@@ -92,18 +87,29 @@ static void iter_recurse(struct json_iter *iter, jsmntok_t *token,
 
 	child->contents = c;
 	child->start = token - c->tokens;
+	child->current = child->start;
 
 	/*
 	* For objects iterating all tokens with the object as the parent
 	* parent should give the total number of tokens for this object.
 	*
+	* For arrays we want to count the tokens inside the array itself. We
+	* cannot simply count until we reach a different parent than the array
+	* due to the possibility of nested objects. Instead we find the next
+	* token with the same parent as the array (the next key in the object).
+	* This offset will include both the arrays key, and the array itself,
+	* hence subtracting 2.
+	*
 	* For strings/primitives the value is always going to one token which
 	* will not be iteratable. Because of this the count is set to zero to
 	* disallow any iteration on this child iterator.
 	*/
 	if (token->type == JSMN_OBJECT)
-		child->count = find_object_tokens(iter, token);
-	else
+		child->count = find_parent_tokens(iter, token);
+	else if (token->type == JSMN_ARRAY) {
+		child->count = find_parent_tokens(iter, token - 1) - 2;
+		child->array = true;
+	} else
 		child->count = 0;
 }
 
@@ -176,6 +182,7 @@ static void assign_arg(void *data, void *user_data)
 		break;
 	case JSON_OBJECT:
 	case JSON_PRIMITIVE:
+	case JSON_ARRAY:
 		iter_val = arg->value;
 
 		if (!arg->v)
@@ -223,6 +230,7 @@ bool json_iter_parse(struct json_iter *iter, enum json_type type, ...)
 		case JSON_STRING:
 		case JSON_OBJECT:
 		case JSON_PRIMITIVE:
+		case JSON_ARRAY:
 			break;
 		default:
 			goto error;
@@ -252,7 +260,7 @@ bool json_iter_parse(struct json_iter *iter, enum json_type type, ...)
 				break;
 			}
 
-			next = next_key_in_parent(iter, next);
+			next = next_token_in_parent(iter, next);
 			if (!next)
 				break;
 		}
@@ -287,7 +295,7 @@ static bool iter_get_primitive_data(struct json_iter *iter, void **ptr,
 					size_t *len)
 {
 	struct json_contents *c = iter->contents;
-	jsmntok_t *t = c->tokens + iter->start;
+	jsmntok_t *t = c->tokens + iter->current;
 
 	if (t->type != JSMN_PRIMITIVE)
 		return false;
@@ -392,3 +400,31 @@ bool json_iter_get_null(struct json_iter *iter)
 
 	return false;
 }
+
+enum json_type json_iter_get_type(struct json_iter *iter)
+{
+	struct json_contents *c = iter->contents;
+	jsmntok_t *t = c->tokens + iter->current;
+
+	return (enum json_type) t->type;
+}
+
+bool json_iter_next(struct json_iter *iter)
+{
+	struct json_contents *c = iter->contents;
+
+	/* For now only allow json_iter_next() on arrays */
+	if (!iter->array)
+		return false;
+
+	if (c->tokens + iter->current + 1 > ITER_END(iter))
+		return false;
+
+	iter->current++;
+
+	/* TODO: Add support for nested array iteration */
+	if ((c->tokens + iter->current)->type == JSMN_ARRAY)
+		return false;
+
+	return true;
+}
diff --git a/src/json.h b/src/json.h
index 9f00a9d5..75ac9853 100644
--- a/src/json.h
+++ b/src/json.h
@@ -42,6 +42,8 @@ struct json_iter {
 	struct json_contents *contents;
 	int start;
 	int count;
+	int current;
+	bool array : 1;
 };
 
 #define JSON_MANDATORY(key, type, out) \
@@ -92,3 +94,6 @@ bool json_iter_get_int(struct json_iter *iter, int *i);
 bool json_iter_get_uint(struct json_iter *iter, unsigned int *i);
 bool json_iter_get_boolean(struct json_iter *iter, bool *b);
 bool json_iter_get_null(struct json_iter *iter);
+
+enum json_type json_iter_get_type(struct json_iter *iter);
+bool json_iter_next(struct json_iter *iter);
-- 
2.31.1

^ permalink raw reply related

* [PATCH 4/8] json: increase default token size to 60
From: James Prestwood @ 2022-01-05 18:46 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

---
 src/json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/json.c b/src/json.c
index 879d43be..4e4c004e 100644
--- a/src/json.c
+++ b/src/json.c
@@ -33,7 +33,7 @@
 #include "shared/jsmn.h"
 
 /* Max number of tokens supported. Increase if larger objects are expected */
-#define JSON_DEFAULT_TOKENS 30
+#define JSON_DEFAULT_TOKENS 60
 
 #define TOK_LEN(token) (token)->end - (token)->start
 #define TOK_PTR(json, token) (void *)((json) + (token)->start)
-- 
2.31.1

^ permalink raw reply related

* [PATCH 5/8] unit: add test for json arrays
From: James Prestwood @ 2022-01-05 18:46 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 4131 bytes --]

---
 unit/test-json.c | 113 ++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 92 insertions(+), 21 deletions(-)

diff --git a/unit/test-json.c b/unit/test-json.c
index fe8f756f..1a7daaff 100644
--- a/unit/test-json.c
+++ b/unit/test-json.c
@@ -75,26 +75,6 @@ static void test_json_escaped_unicode(const void *data)
 	json_contents_free(c);
 }
 
-/*
- * Tests that unsupported types will not parse
- */
-static void test_json_unsupported_types(const void *data)
-{
-	/*
-	 * Valid JSON objects but currently unsupported types
-	 */
-	char arrays[] = "{\"test\":[1, 2, 3, 4]}";
-
-	struct json_iter iter;
-	struct json_contents *c = json_contents_new(arrays, strlen(arrays));
-
-	json_iter_init(&iter, c);
-	assert(!json_iter_parse(&iter,
-				JSON_MANDATORY("test", JSON_ARRAY, NULL),
-				JSON_UNDEFINED));
-	json_contents_free(c);
-}
-
 /*
  * Basic test string values and nested objects
  */
@@ -325,6 +305,97 @@ static void test_json_primitives(const void *data)
 	json_contents_free(c);
 }
 
+static void test_json_arrays(const void *data)
+{
+	unsigned int ui;
+	int i;
+	bool b;
+	int count;
+	char json[] = "{\"uint_array\":[1, 2, 3, 4, 5, 6],"
+			"\"int_array\":[-1, -2, -3, -4, -5, -6],"
+			"\"bool_array\":[true, false, true, false],"
+			"\"null_array\":[null, null, null, null],"
+			"\"mixed_array\":[1, -1, true, false, null]}";
+
+	struct json_iter iter;
+	struct json_iter i_array, ui_array, b_array, n_array, m_array;
+	struct json_contents *c = json_contents_new(json, strlen(json));
+
+	json_iter_init(&iter, c);
+	assert(json_iter_parse(&iter,
+			JSON_MANDATORY("mixed_array", JSON_ARRAY, &m_array),
+			JSON_MANDATORY("null_array", JSON_ARRAY, &n_array),
+			JSON_MANDATORY("bool_array", JSON_ARRAY, &b_array),
+			JSON_MANDATORY("int_array", JSON_ARRAY, &i_array),
+			JSON_MANDATORY("uint_array", JSON_ARRAY, &ui_array),
+			JSON_UNDEFINED));
+
+	count = 1;
+
+	while (json_iter_next(&ui_array)) {
+		assert(json_iter_get_type(&ui_array) == JSON_PRIMITIVE);
+		assert(json_iter_get_uint(&ui_array, &ui));
+		assert(ui == (unsigned int) count);
+		count++;
+	}
+
+	count = -1;
+
+	while (json_iter_next(&i_array)) {
+		assert(json_iter_get_type(&i_array) == JSON_PRIMITIVE);
+		assert(json_iter_get_int(&i_array, &i));
+		assert(i == count);
+		count--;
+	}
+
+	count = 0;
+
+	while (json_iter_next(&b_array)) {
+		assert(json_iter_get_type(&b_array) == JSON_PRIMITIVE);
+		assert(json_iter_get_boolean(&b_array, &b));
+		assert(b == count % 2 ? false : true);
+		count++;
+	}
+
+	count = 0;
+
+	while (json_iter_next(&n_array)) {
+		assert(json_iter_get_type(&n_array) == JSON_PRIMITIVE);
+		assert(json_iter_get_null(&n_array));
+		count++;
+	}
+
+	assert(count == 4);
+
+	count = 0;
+
+	while (json_iter_next(&m_array)) {
+		assert(json_iter_get_type(&m_array) == JSON_PRIMITIVE);
+
+		switch (count) {
+		case 0:
+			assert(json_iter_get_uint(&m_array, &ui));
+			assert(ui == 1);
+			break;
+		case 1:
+			assert(json_iter_get_int(&m_array, &i));
+			assert(i == -1);
+			break;
+		case 2:
+		case 3:
+			assert(json_iter_get_boolean(&m_array, &b));
+			assert(b == count % 2 ? false : true);
+			break;
+		case 4:
+			assert(json_iter_get_null(&m_array));
+			break;
+		}
+
+		count++;
+	}
+
+	json_contents_free(c);
+}
 
 int main(int argc, char *argv[])
 {
@@ -333,11 +404,11 @@ int main(int argc, char *argv[])
 	l_test_add("json unicode", test_json_unicode, NULL);
 	l_test_add("json escaped unicode", test_json_escaped_unicode, NULL);
 	l_test_add("json nested objects", test_json, NULL);
-	l_test_add("json unsupported types", test_json_unsupported_types, NULL);
 	l_test_add("json empty objects", test_json_empty_objects, NULL);
 	l_test_add("json parse out of order", test_json_out_of_order, NULL);
 	l_test_add("json larger object", test_json_larger_object, NULL);
 	l_test_add("json test primitives", test_json_primitives, NULL);
+	l_test_add("json test arrays", test_json_arrays, NULL);
 
 	return l_test_run();
 }
-- 
2.31.1

^ permalink raw reply related

* [PATCH 6/8] json: support arrays of objects
From: James Prestwood @ 2022-01-05 18:46 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 2731 bytes --]

---
 src/json.c | 39 +++++++++++++++++++++++++++++++++++++--
 src/json.h |  2 ++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/json.c b/src/json.c
index 4e4c004e..d38d884e 100644
--- a/src/json.c
+++ b/src/json.c
@@ -401,6 +401,21 @@ bool json_iter_get_null(struct json_iter *iter)
 	return false;
 }
 
+bool json_iter_get_container(struct json_iter *iter,
+				struct json_iter *container)
+{
+	struct json_contents *c = iter->contents;
+	jsmntok_t *t = c->tokens + iter->current;
+
+	/* TODO: Add nested array support */
+	if (t->type != JSMN_OBJECT)
+		return false;
+
+	iter_recurse(iter, t, container);
+
+	return true;
+}
+
 enum json_type json_iter_get_type(struct json_iter *iter)
 {
 	struct json_contents *c = iter->contents;
@@ -412,15 +427,35 @@ enum json_type json_iter_get_type(struct json_iter *iter)
 bool json_iter_next(struct json_iter *iter)
 {
 	struct json_contents *c = iter->contents;
+	jsmntok_t *t = c->tokens + iter->current;
+	int inc = 1;
 
 	/* For now only allow json_iter_next() on arrays */
 	if (!iter->array)
 		return false;
 
-	if (c->tokens + iter->current + 1 > ITER_END(iter))
+	/*
+	 * If this is the initial iteration skip this and just increment
+	 * current by 1 since this iterator points to an array which needs to
+	 * be advanced to the first token in the array.
+	 *
+	 * In addition primitive types and empty object will have a size of 1,
+	 * so no special handling is needed there.
+	 *
+	 * For objects (and arrays in the future), 'current' needs to be
+	 * advanced by all objects child tokens plus the object token itself.
+	 * This check ensures:
+	 *    1. It is not the initial iteration
+	 *    2. This is an object
+	 *    3. The object is not empty
+	 */
+	if (iter->current != iter->start && t->type == JSMN_OBJECT && t->size)
+		inc = find_parent_tokens(iter, t) + 1;
+
+	if (c->tokens + iter->current + inc > ITER_END(iter))
 		return false;
 
-	iter->current++;
+	iter->current += inc;
 
 	/* TODO: Add support for nested array iteration */
 	if ((c->tokens + iter->current)->type == JSMN_ARRAY)
diff --git a/src/json.h b/src/json.h
index 75ac9853..c7993a5a 100644
--- a/src/json.h
+++ b/src/json.h
@@ -94,6 +94,8 @@ bool json_iter_get_int(struct json_iter *iter, int *i);
 bool json_iter_get_uint(struct json_iter *iter, unsigned int *i);
 bool json_iter_get_boolean(struct json_iter *iter, bool *b);
 bool json_iter_get_null(struct json_iter *iter);
+bool json_iter_get_container(struct json_iter *iter,
+				struct json_iter *container);
 
 enum json_type json_iter_get_type(struct json_iter *iter);
 bool json_iter_next(struct json_iter *iter);
-- 
2.31.1

^ permalink raw reply related

* [PATCH 7/8] unit: add arrays of objects test
From: James Prestwood @ 2022-01-05 18:46 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]

---
 unit/test-json.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/unit/test-json.c b/unit/test-json.c
index 1a7daaff..52e3f675 100644
--- a/unit/test-json.c
+++ b/unit/test-json.c
@@ -315,10 +315,12 @@ static void test_json_arrays(const void *data)
 			"\"int_array\":[-1, -2, -3, -4, -5, -6],"
 			"\"bool_array\":[true, false, true, false],"
 			"\"null_array\":[null, null, null, null],"
+			"\"obj_array\":[{}, {\"key\":\"value\", \"key2\":\"value2\"}],"
 			"\"mixed_array\":[1, -1, true, false, null]}";
 
 	struct json_iter iter;
-	struct json_iter i_array, ui_array, b_array, n_array, m_array;
+	struct json_iter i_array, ui_array, b_array, n_array,
+				m_array, obj_array;
 	struct json_contents *c = json_contents_new(json, strlen(json));
 
 	json_iter_init(&iter, c);
@@ -328,6 +330,7 @@ static void test_json_arrays(const void *data)
 			JSON_MANDATORY("bool_array", JSON_ARRAY, &b_array),
 			JSON_MANDATORY("int_array", JSON_ARRAY, &i_array),
 			JSON_MANDATORY("uint_array", JSON_ARRAY, &ui_array),
+			JSON_MANDATORY("obj_array", JSON_ARRAY, &obj_array),
 			JSON_UNDEFINED));
 
 	count = 1;
@@ -394,6 +397,30 @@ static void test_json_arrays(const void *data)
 		count++;
 	}
 
+	count = 0;
+
+	while (json_iter_next(&obj_array)) {
+		struct json_iter object;
+
+		assert(json_iter_get_type(&obj_array) == JSON_OBJECT);
+		assert(json_iter_get_container(&obj_array, &object));
+
+		switch (count) {
+		case 0:
+			assert(json_iter_parse(&object, JSON_UNDEFINED));
+			break;
+		case 1:
+			assert(json_iter_parse(&object,
+				JSON_MANDATORY("key", JSON_STRING, NULL),
+				JSON_UNDEFINED));
+			break;
+		}
+
+		count++;
+	}
+
+	assert(count == 2);
+
 	json_contents_free(c);
 }
 
-- 
2.31.1

^ permalink raw reply related

* [PATCH 8/8] unit: add test for nested arrays
From: James Prestwood @ 2022-01-05 18:46 UTC (permalink / raw)
  To: iwd 

[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

These are not yet supported, but test anyway to ensure iteration
does not work and doesn't result in any unexpected behavior.
---
 unit/test-json.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/unit/test-json.c b/unit/test-json.c
index 52e3f675..5ffd36ec 100644
--- a/unit/test-json.c
+++ b/unit/test-json.c
@@ -424,6 +424,27 @@ static void test_json_arrays(const void *data)
 	json_contents_free(c);
 }
 
+static void test_json_nested_arrays(const void *data)
+{
+	char json[] = "{\"array\":[[1, 2], [3, 4]]}";
+	int count = 0;
+	struct json_iter iter;
+	struct json_iter array;
+	struct json_contents *c = json_contents_new(json, strlen(json));
+
+	json_iter_init(&iter, c);
+	assert(json_iter_parse(&iter,
+			JSON_MANDATORY("array", JSON_ARRAY, &array),
+			JSON_UNDEFINED));
+
+	while (json_iter_next(&array))
+		count++;
+
+	assert(count == 0);
+
+	json_contents_free(c);
+}
+
 int main(int argc, char *argv[])
 {
 	l_test_init(&argc, &argv);
@@ -436,6 +457,7 @@ int main(int argc, char *argv[])
 	l_test_add("json larger object", test_json_larger_object, NULL);
 	l_test_add("json test primitives", test_json_primitives, NULL);
 	l_test_add("json test arrays", test_json_arrays, NULL);
+	l_test_add("json test nested arrays", test_json_nested_arrays, NULL);
 
 	return l_test_run();
 }
-- 
2.31.1

^ permalink raw reply related

* Re: [PATCH v2 net-next 2/7] net: dsa: merge all bools of struct dsa_port into a single u8
From: Florian Fainelli @ 2022-01-05 18:46 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev@vger.kernel.org, David S. Miller, Jakub Kicinski,
	Andrew Lunn, Vivien Didelot
In-Reply-To: <20220105183934.yxidfrcwcuirm7au@skbuf>

On 1/5/22 10:39 AM, Vladimir Oltean wrote:
> Hi Florian,
> 
> On Wed, Jan 05, 2022 at 10:30:54AM -0800, Florian Fainelli wrote:
>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Thanks a lot for the review.
> 
> I'm a bit on the fence on this patch and the other one for dsa_switch.
> The thing is that bit fields are not atomic in C89, so if we update any
> of the flags inside dp or ds concurrently (like dp->vlan_filtering),
> we're in trouble. Right now this isn't a problem, because most of the
> flags are set either during probe, or during ds->ops->setup, or are
> serialized by the rtnl_mutex in ways that are there to stay (switchdev
> notifiers). That's why I didn't say anything about it. But it may be a
> caveat to watch out for in the future. Do you think we need to do
> something about it? A lock would not be necessary, strictly speaking.

I would probably start with a comment that describes these pitfalls, I
wish we had a programmatic way to ensure that these flags would not be
set dynamically and outside of the probe/setup path but that won't
happen easily.

Should we be switching to a bitmask and bitmap helpers to be future proof?
-- 
Florian

^ permalink raw reply

* Re: [PATCH v2 1/5] RISC-V: larger and more consistent register set for 'info registers'
From: Alex Bennée @ 2022-01-05 18:21 UTC (permalink / raw)
  To: Schwarz, Konrad
  Cc: Bin Meng, Richard Henderson, Ralf Ramsauer, qemu-devel,
	Palmer Dabbelt, Alistair Francis
In-Reply-To: <9511f23e9cdf42609866bc597f87b97e@siemens.com>


"Schwarz, Konrad" <konrad.schwarz@siemens.com> writes:

>> -----Original Message-----
>> From: Richard Henderson <richard.henderson@linaro.org>
>> Sent: Tuesday, January 4, 2022 21:57
>> Subject: Re: [PATCH v2 1/5] RISC-V: larger and more consistent register set for 'info registers'
>> 
>> On 1/4/22 7:51 AM, Konrad Schwarz wrote:
>> >           static const int dump_csrs[] = {
>> > +
>> > +#  if 0
>> > +            CSR_USTATUS,
>> > +            CSR_UIE,
>> > +            CSR_UTVEC,
>> 
>> Adding huge sections of #if 0 code is not acceptable.
>
> I'm not sure on how to solve the dilemma of
>
> * transgressing on QEMUs coding guidelines on the one side
>   (large sections of commented out code)
>
> * having `info registers' output a huge swath of CSRs,
>   swamping the user and making the command impractical
>
> I feel that providing some control at compile
> time via `# if' conditional compilation is preferrable to just dumping
> everything.  I could of course only list the CSRs that
> are interesting to me, currently, but I thought it
> would be better to list (almost) all of them and give at least
> programmers an easy way to enable the blocks of CSRs
> that are of interest to them.
>
> Obviously, the best solution would be to extend the command to
> add a filter argument, similar to GDB's `info registers'
> (i.e. info registers XXX), but I don't know how to do that in QEMU and
> it would work differently from other target architectures.

This is a problem that needs solving not only for "info registers" but
also things like "-d cpu", gdbserver and (eventually) TCG plugins.

My (so far unrealised) vision is to have a architecture independent
sub-system that we can register (sic) registers. The frontends would
replace their existing qemu_log and gdbserver hooks with a group aware
registering function to the sub-system. For example:

  register_reg("x0", REG_CORE, get_gen_reg, set_gen_reg, offsetof(CPUARMState, xregs[0]))
  register_reg(ri->name, REG_SYSTEM, get_cpreg, set_cpreg, ri);

and so on. This would then provide a common point for the register value
consumers to request values and sets. So we could have options like:

  (hmp) info registers fpu
  -d cpu:pc
  qemu_plugin_get_regset("x0-x7");

and avoid having too much per-architecture special casing. I'd also like
to get rid of custom gdb XML generation in the frontends (e.g.
arm_gen_dynamic_svereg_xml) and make that common functionality.

> What would you suggest?

-- 
Alex Bennée


^ permalink raw reply

* Re: psi_trigger_poll() is completely broken
From: Linus Torvalds @ 2022-01-05 18:50 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Johannes Weiner, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Ingo Molnar, Hillf Danton, syzbot, linux-fsdevel,
	Linux Kernel Mailing List, syzkaller-bugs, Linux-MM
In-Reply-To: <YdW3WfHURBXRmn/6@sol.localdomain>

On Wed, Jan 5, 2022 at 7:21 AM Eric Biggers <ebiggers@kernel.org> wrote:
>
> [changed subject line to hopefully get people to stop ignoring this]
>
> Please see my message below where I explained the problem in detail.  Any
> response from the maintainers of kernel/sched/psi.c?  There are a lot of you:

Ok, this one is clearly a kernel/sched/psi.c bug, since the lifetime
isn't even maintained by the fiel reference.

I think the proper thing to do is to move the whole "get kref to
trigger pointer" in the open/close code, and keep the ref around that
way.

The natural thing to do would be to look up the trigger at open time,
save the pointer in seq->private, and release it at close time.

Sadly, right now the code actually uses that 'seq->private' as an
indirect rcu-pointer to the trigger data, instead of as the trigger
data itself. And that seems very much on purpose and inherent to that
'psi_write()' model, where it changes the trigger pointer very much on
purpose.

So I agree 100% - the PSI code is fundamentally broken. psi_write()
seems to be literally _designed_ to do the wrong thing.

I don't know who - if anybody - uses this. My preference would be to
just disable the completely broken poll support.

Another alternative is to just make 'psi_write()' return -EBUSY if
there are existing poll waiters (ie t->event_wait not being empty.  At
least then the open file would keep the kref to the trigger.

That would require that 'psi_trigger_replace()' serialize with the
waitqueue lock (easy), but all callers would also have to check the
return value of it

The cgroup code does

        psi_trigger_replace(&of->priv, NULL);

in the release function, but I guess that might work since at release
time there shouldn't be any pending polls anyway.

But it would also mean that anybody who can open the file for reading
(so that they can poll it) would be able to keep people from changing
it.

But yes, I think that unless we get some reply from the PSI
maintainers, we will have to just disable polling entirely.

I hope there are no users that would break, but considering that the
current code is clearly too broken to live, this may be one of those
"we have no choice" cases.

                         Linus

^ permalink raw reply

* Re: [PATCH] t/README: fix typo
From: Marc Strapetz @ 2022-01-05 16:47 UTC (permalink / raw)
  To: Johannes Schindelin, Marc Strapetz via GitGitGadget; +Cc: git
In-Reply-To: <nycvar.QRO.7.76.6.2201051701120.7076@tvgsbejvaqbjf.bet>

Hi Dscho,

On 05/01/2022 17:22, Johannes Schindelin wrote:
>> @@ -466,7 +466,7 @@ explicitly providing repositories when accessing submodule objects is
>>   complete or needs to be abandoned for whatever reason (in which case the
>>   migrated codepaths still retain their performance benefits).
>>
>> -GIT_TEST_REQUIRE_PREREQ=<list> allows specifying a space speparated list of
>> +GIT_TEST_REQUIRE_PREREQ=<list> allows specifying a space separated list of
> 
> Good find!
> 
> I'm curious, how did you find it? If it was a spell checker, did it also

I found it by plain reading :) as I had troubles to get a test working.

 > find the "dotsh" typo in the same file (it should be "dots", I think)?

I wouldn't have noticed that, but I agree that it should be 
"test_name_without_dots".

-Marc

^ permalink raw reply

* Re: [PATCH v3] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem
From: kernel test robot @ 2022-01-05 18:51 UTC (permalink / raw)
  To: kbuild-all
In-Reply-To: <1641395025-7922-1-git-send-email-quic_charante@quicinc.com>

[-- Attachment #1: Type: text/plain, Size: 2318 bytes --]

Hi Charan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on hnaz-mm/master]

url:    https://github.com/0day-ci/linux/commits/Charan-Teja-Reddy/mm-shmem-implement-POSIX_FADV_-WILL-DONT-NEED-for-shmem/20220105-230604
base:   https://github.com/hnaz/linux-mm master
config: nds32-allnoconfig (https://download.01.org/0day-ci/archive/20220106/202201060232.K03lKwTH-lkp(a)intel.com/config)
compiler: nds32le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6bdb2636187d2f6cb78d6cdc05f2b7e0b79c750a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Charan-Teja-Reddy/mm-shmem-implement-POSIX_FADV_-WILL-DONT-NEED-for-shmem/20220105-230604
        git checkout 6bdb2636187d2f6cb78d6cdc05f2b7e0b79c750a
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> mm/shmem.c:4000:27: error: 'shmem_fadvise' undeclared here (not in a function); did you mean 'shmem_file'?
    4000 |         .fadvise        = shmem_fadvise,
         |                           ^~~~~~~~~~~~~
         |                           shmem_file


vim +4000 mm/shmem.c

  3987	
  3988	static const struct file_operations shmem_file_operations = {
  3989		.mmap		= shmem_mmap,
  3990		.get_unmapped_area = shmem_get_unmapped_area,
  3991	#ifdef CONFIG_TMPFS
  3992		.llseek		= shmem_file_llseek,
  3993		.read_iter	= shmem_file_read_iter,
  3994		.write_iter	= generic_file_write_iter,
  3995		.fsync		= noop_fsync,
  3996		.splice_read	= generic_file_splice_read,
  3997		.splice_write	= iter_file_splice_write,
  3998		.fallocate	= shmem_fallocate,
  3999	#endif
> 4000		.fadvise	= shmem_fadvise,
  4001	};
  4002	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply

* Re: [PATCH] media: atmel: atmel-isc: Fix PM disable depth imbalance in atmel_isc_probe
From: kernel test robot @ 2022-01-05 18:52 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17458 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220105111056.4662-1-linmq006@gmail.com>
References: <20220105111056.4662-1-linmq006@gmail.com>
TO: Miaoqian Lin <linmq006@gmail.com>
CC: linmq006(a)gmail.com
CC: Eugen Hristev <eugen.hristev@microchip.com>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
CC: Nicolas Ferre <nicolas.ferre@microchip.com>
CC: Alexandre Belloni <alexandre.belloni@bootlin.com>
CC: Ludovic Desroches <ludovic.desroches@microchip.com>
CC: Hans Verkuil <hverkuil@xs4all.nl>
CC: linux-arm-kernel(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org

Hi Miaoqian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on media-tree/master]
[also build test WARNING on v5.16-rc8 next-20220105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Miaoqian-Lin/media-atmel-atmel-isc-Fix-PM-disable-depth-imbalance-in-atmel_isc_probe/20220105-191228
base:   git://linuxtv.org/media_tree.git master
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: alpha-randconfig-s031-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060215.P1FTGS2p-lkp(a)intel.com/config)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/f116d8f81c642486900c9589a7c10d137d7eb0a2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Miaoqian-Lin/media-atmel-atmel-isc-Fix-PM-disable-depth-imbalance-in-atmel_isc_probe/20220105-191228
        git checkout f116d8f81c642486900c9589a7c10d137d7eb0a2
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/media/platform/atmel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/media/platform/atmel/atmel-sama5d2-isc.c:562:1: sparse: sparse: unused label 'disable_pm_runtime'

vim +/disable_pm_runtime +562 drivers/media/platform/atmel/atmel-sama5d2-isc.c

0a0e265515db76 Eugen Hristev    2019-06-12  380  
0a0e265515db76 Eugen Hristev    2019-06-12  381  static int atmel_isc_probe(struct platform_device *pdev)
0a0e265515db76 Eugen Hristev    2019-06-12  382  {
0a0e265515db76 Eugen Hristev    2019-06-12  383  	struct device *dev = &pdev->dev;
0a0e265515db76 Eugen Hristev    2019-06-12  384  	struct isc_device *isc;
0a0e265515db76 Eugen Hristev    2019-06-12  385  	struct resource *res;
0a0e265515db76 Eugen Hristev    2019-06-12  386  	void __iomem *io_base;
0a0e265515db76 Eugen Hristev    2019-06-12  387  	struct isc_subdev_entity *subdev_entity;
0a0e265515db76 Eugen Hristev    2019-06-12  388  	int irq;
0a0e265515db76 Eugen Hristev    2019-06-12  389  	int ret;
d51470069eb169 Eugen Hristev    2021-04-13  390  	u32 ver;
0a0e265515db76 Eugen Hristev    2019-06-12  391  
0a0e265515db76 Eugen Hristev    2019-06-12  392  	isc = devm_kzalloc(dev, sizeof(*isc), GFP_KERNEL);
0a0e265515db76 Eugen Hristev    2019-06-12  393  	if (!isc)
0a0e265515db76 Eugen Hristev    2019-06-12  394  		return -ENOMEM;
0a0e265515db76 Eugen Hristev    2019-06-12  395  
0a0e265515db76 Eugen Hristev    2019-06-12  396  	platform_set_drvdata(pdev, isc);
0a0e265515db76 Eugen Hristev    2019-06-12  397  	isc->dev = dev;
0a0e265515db76 Eugen Hristev    2019-06-12  398  
0a0e265515db76 Eugen Hristev    2019-06-12  399  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
0a0e265515db76 Eugen Hristev    2019-06-12  400  	io_base = devm_ioremap_resource(dev, res);
0a0e265515db76 Eugen Hristev    2019-06-12  401  	if (IS_ERR(io_base))
0a0e265515db76 Eugen Hristev    2019-06-12  402  		return PTR_ERR(io_base);
0a0e265515db76 Eugen Hristev    2019-06-12  403  
0a0e265515db76 Eugen Hristev    2019-06-12  404  	isc->regmap = devm_regmap_init_mmio(dev, io_base, &isc_regmap_config);
0a0e265515db76 Eugen Hristev    2019-06-12  405  	if (IS_ERR(isc->regmap)) {
0a0e265515db76 Eugen Hristev    2019-06-12  406  		ret = PTR_ERR(isc->regmap);
0a0e265515db76 Eugen Hristev    2019-06-12  407  		dev_err(dev, "failed to init register map: %d\n", ret);
0a0e265515db76 Eugen Hristev    2019-06-12  408  		return ret;
0a0e265515db76 Eugen Hristev    2019-06-12  409  	}
0a0e265515db76 Eugen Hristev    2019-06-12  410  
0a0e265515db76 Eugen Hristev    2019-06-12  411  	irq = platform_get_irq(pdev, 0);
97299a3035328d Stephen Boyd     2019-07-30  412  	if (irq < 0)
97299a3035328d Stephen Boyd     2019-07-30  413  		return irq;
0a0e265515db76 Eugen Hristev    2019-06-12  414  
0a0e265515db76 Eugen Hristev    2019-06-12  415  	ret = devm_request_irq(dev, irq, isc_interrupt, 0,
d5475b3c901a00 Eugen Hristev    2021-04-13  416  			       "atmel-sama5d2-isc", isc);
0a0e265515db76 Eugen Hristev    2019-06-12  417  	if (ret < 0) {
0a0e265515db76 Eugen Hristev    2019-06-12  418  		dev_err(dev, "can't register ISR for IRQ %u (ret=%i)\n",
0a0e265515db76 Eugen Hristev    2019-06-12  419  			irq, ret);
0a0e265515db76 Eugen Hristev    2019-06-12  420  		return ret;
0a0e265515db76 Eugen Hristev    2019-06-12  421  	}
0a0e265515db76 Eugen Hristev    2019-06-12  422  
f84bc784fa614a Eugen Hristev    2021-04-13  423  	isc->gamma_table = isc_sama5d2_gamma_table;
f84bc784fa614a Eugen Hristev    2021-04-13  424  	isc->gamma_max = 2;
f84bc784fa614a Eugen Hristev    2021-04-13  425  
f794bc16a52da7 Eugen Hristev    2021-04-13  426  	isc->max_width = ISC_SAMA5D2_MAX_SUPPORT_WIDTH;
f794bc16a52da7 Eugen Hristev    2021-04-13  427  	isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT;
f794bc16a52da7 Eugen Hristev    2021-04-13  428  
883285556388af Eugen Hristev    2021-04-13  429  	isc->config_dpc = isc_sama5d2_config_dpc;
2ede3975c0a853 Eugen Hristev    2021-04-13  430  	isc->config_csc = isc_sama5d2_config_csc;
d3b2ee5478c856 Eugen Hristev    2021-04-13  431  	isc->config_cbc = isc_sama5d2_config_cbc;
2873f85bd318bf Eugen Hristev    2021-04-13  432  	isc->config_cc = isc_sama5d2_config_cc;
e48848a6af150e Eugen Hristev    2021-04-13  433  	isc->config_gam = isc_sama5d2_config_gam;
ef9b7779688b2d Eugen Hristev    2021-04-13  434  	isc->config_rlp = isc_sama5d2_config_rlp;
8f1b451c87ee05 Eugen Hristev    2021-04-13  435  	isc->config_ctrls = isc_sama5d2_config_ctrls;
2ede3975c0a853 Eugen Hristev    2021-04-13  436  
049a38fc9681b3 Eugen Hristev    2021-04-13  437  	isc->adapt_pipeline = isc_sama5d2_adapt_pipeline;
049a38fc9681b3 Eugen Hristev    2021-04-13  438  
ffeeb01d11397b Eugen Hristev    2021-04-13  439  	isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
4fc9e8a775d4b3 Eugen Hristev    2021-04-13  440  	isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
87b62b6d55dd78 Eugen Hristev    2021-04-13  441  	isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET;
87b62b6d55dd78 Eugen Hristev    2021-04-13  442  	isc->offsets.sub420 = ISC_SAMA5D2_SUB420_OFFSET;
40ee17d1b41ccc Eugen Hristev    2021-04-13  443  	isc->offsets.rlp = ISC_SAMA5D2_RLP_OFFSET;
1a3ac5d51541b6 Eugen Hristev    2021-04-13  444  	isc->offsets.his = ISC_SAMA5D2_HIS_OFFSET;
e891009857716e Eugen Hristev    2021-04-13  445  	isc->offsets.dma = ISC_SAMA5D2_DMA_OFFSET;
d51470069eb169 Eugen Hristev    2021-04-13  446  	isc->offsets.version = ISC_SAMA5D2_VERSION_OFFSET;
629de518e6f3b8 Eugen Hristev    2021-04-13  447  	isc->offsets.his_entry = ISC_SAMA5D2_HIS_ENTRY_OFFSET;
ffeeb01d11397b Eugen Hristev    2021-04-13  448  
415dbe4efafa29 Eugen Hristev    2021-04-13  449  	isc->controller_formats = sama5d2_controller_formats;
415dbe4efafa29 Eugen Hristev    2021-04-13  450  	isc->controller_formats_size = ARRAY_SIZE(sama5d2_controller_formats);
415dbe4efafa29 Eugen Hristev    2021-04-13  451  	isc->formats_list = sama5d2_formats_list;
415dbe4efafa29 Eugen Hristev    2021-04-13  452  	isc->formats_list_size = ARRAY_SIZE(sama5d2_formats_list);
415dbe4efafa29 Eugen Hristev    2021-04-13  453  
cd5af39467bdc7 Eugen Hristev    2021-04-13  454  	/* sama5d2-isc - 8 bits per beat */
cd5af39467bdc7 Eugen Hristev    2021-04-13  455  	isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8;
cd5af39467bdc7 Eugen Hristev    2021-04-13  456  
d7f26849ed7cc8 Eugen Hristev    2021-09-13  457  	/* sama5d2-isc : ISPCK is required and mandatory */
d7f26849ed7cc8 Eugen Hristev    2021-09-13  458  	isc->ispck_required = true;
d7f26849ed7cc8 Eugen Hristev    2021-09-13  459  
0a0e265515db76 Eugen Hristev    2019-06-12  460  	ret = isc_pipeline_init(isc);
0a0e265515db76 Eugen Hristev    2019-06-12  461  	if (ret)
0a0e265515db76 Eugen Hristev    2019-06-12  462  		return ret;
0a0e265515db76 Eugen Hristev    2019-06-12  463  
0a0e265515db76 Eugen Hristev    2019-06-12  464  	isc->hclock = devm_clk_get(dev, "hclock");
0a0e265515db76 Eugen Hristev    2019-06-12  465  	if (IS_ERR(isc->hclock)) {
0a0e265515db76 Eugen Hristev    2019-06-12  466  		ret = PTR_ERR(isc->hclock);
0a0e265515db76 Eugen Hristev    2019-06-12  467  		dev_err(dev, "failed to get hclock: %d\n", ret);
0a0e265515db76 Eugen Hristev    2019-06-12  468  		return ret;
0a0e265515db76 Eugen Hristev    2019-06-12  469  	}
0a0e265515db76 Eugen Hristev    2019-06-12  470  
0a0e265515db76 Eugen Hristev    2019-06-12  471  	ret = clk_prepare_enable(isc->hclock);
0a0e265515db76 Eugen Hristev    2019-06-12  472  	if (ret) {
0a0e265515db76 Eugen Hristev    2019-06-12  473  		dev_err(dev, "failed to enable hclock: %d\n", ret);
0a0e265515db76 Eugen Hristev    2019-06-12  474  		return ret;
0a0e265515db76 Eugen Hristev    2019-06-12  475  	}
0a0e265515db76 Eugen Hristev    2019-06-12  476  
0a0e265515db76 Eugen Hristev    2019-06-12  477  	ret = isc_clk_init(isc);
0a0e265515db76 Eugen Hristev    2019-06-12  478  	if (ret) {
0a0e265515db76 Eugen Hristev    2019-06-12  479  		dev_err(dev, "failed to init isc clock: %d\n", ret);
0a0e265515db76 Eugen Hristev    2019-06-12  480  		goto unprepare_hclk;
0a0e265515db76 Eugen Hristev    2019-06-12  481  	}
0a0e265515db76 Eugen Hristev    2019-06-12  482  	ret = v4l2_device_register(dev, &isc->v4l2_dev);
0a0e265515db76 Eugen Hristev    2019-06-12  483  	if (ret) {
0a0e265515db76 Eugen Hristev    2019-06-12  484  		dev_err(dev, "unable to register v4l2 device.\n");
0a0e265515db76 Eugen Hristev    2019-06-12  485  		goto unprepare_clk;
0a0e265515db76 Eugen Hristev    2019-06-12  486  	}
0a0e265515db76 Eugen Hristev    2019-06-12  487  
0a0e265515db76 Eugen Hristev    2019-06-12  488  	ret = isc_parse_dt(dev, isc);
0a0e265515db76 Eugen Hristev    2019-06-12  489  	if (ret) {
0a0e265515db76 Eugen Hristev    2019-06-12  490  		dev_err(dev, "fail to parse device tree\n");
0a0e265515db76 Eugen Hristev    2019-06-12  491  		goto unregister_v4l2_device;
0a0e265515db76 Eugen Hristev    2019-06-12  492  	}
0a0e265515db76 Eugen Hristev    2019-06-12  493  
0a0e265515db76 Eugen Hristev    2019-06-12  494  	if (list_empty(&isc->subdev_entities)) {
0a0e265515db76 Eugen Hristev    2019-06-12  495  		dev_err(dev, "no subdev found\n");
0a0e265515db76 Eugen Hristev    2019-06-12  496  		ret = -ENODEV;
0a0e265515db76 Eugen Hristev    2019-06-12  497  		goto unregister_v4l2_device;
0a0e265515db76 Eugen Hristev    2019-06-12  498  	}
0a0e265515db76 Eugen Hristev    2019-06-12  499  
0a0e265515db76 Eugen Hristev    2019-06-12  500  	list_for_each_entry(subdev_entity, &isc->subdev_entities, list) {
d6701f13bd0747 Ezequiel Garcia  2021-01-18  501  		struct v4l2_async_subdev *asd;
3c8c153914812a Sakari Ailus     2021-03-05  502  		struct fwnode_handle *fwnode =
3c8c153914812a Sakari Ailus     2021-03-05  503  			of_fwnode_handle(subdev_entity->epn);
d6701f13bd0747 Ezequiel Garcia  2021-01-18  504  
3c8c153914812a Sakari Ailus     2021-03-05  505  		v4l2_async_nf_init(&subdev_entity->notifier);
0a0e265515db76 Eugen Hristev    2019-06-12  506  
3c8c153914812a Sakari Ailus     2021-03-05  507  		asd = v4l2_async_nf_add_fwnode_remote(&subdev_entity->notifier,
3c8c153914812a Sakari Ailus     2021-03-05  508  						      fwnode,
b01edcbd409cf7 Laurent Pinchart 2021-01-18  509  						      struct v4l2_async_subdev);
d6701f13bd0747 Ezequiel Garcia  2021-01-18  510  
d6701f13bd0747 Ezequiel Garcia  2021-01-18  511  		of_node_put(subdev_entity->epn);
d6701f13bd0747 Ezequiel Garcia  2021-01-18  512  		subdev_entity->epn = NULL;
d6701f13bd0747 Ezequiel Garcia  2021-01-18  513  
d6701f13bd0747 Ezequiel Garcia  2021-01-18  514  		if (IS_ERR(asd)) {
d6701f13bd0747 Ezequiel Garcia  2021-01-18  515  			ret = PTR_ERR(asd);
0a0e265515db76 Eugen Hristev    2019-06-12  516  			goto cleanup_subdev;
0a0e265515db76 Eugen Hristev    2019-06-12  517  		}
0a0e265515db76 Eugen Hristev    2019-06-12  518  
0a0e265515db76 Eugen Hristev    2019-06-12  519  		subdev_entity->notifier.ops = &isc_async_ops;
0a0e265515db76 Eugen Hristev    2019-06-12  520  
3c8c153914812a Sakari Ailus     2021-03-05  521  		ret = v4l2_async_nf_register(&isc->v4l2_dev,
0a0e265515db76 Eugen Hristev    2019-06-12  522  					     &subdev_entity->notifier);
0a0e265515db76 Eugen Hristev    2019-06-12  523  		if (ret) {
0a0e265515db76 Eugen Hristev    2019-06-12  524  			dev_err(dev, "fail to register async notifier\n");
0a0e265515db76 Eugen Hristev    2019-06-12  525  			goto cleanup_subdev;
0a0e265515db76 Eugen Hristev    2019-06-12  526  		}
0a0e265515db76 Eugen Hristev    2019-06-12  527  
0a0e265515db76 Eugen Hristev    2019-06-12  528  		if (video_is_registered(&isc->video_dev))
0a0e265515db76 Eugen Hristev    2019-06-12  529  			break;
0a0e265515db76 Eugen Hristev    2019-06-12  530  	}
0a0e265515db76 Eugen Hristev    2019-06-12  531  
0a0e265515db76 Eugen Hristev    2019-06-12  532  	pm_runtime_set_active(dev);
0a0e265515db76 Eugen Hristev    2019-06-12  533  	pm_runtime_enable(dev);
0a0e265515db76 Eugen Hristev    2019-06-12  534  	pm_request_idle(dev);
0a0e265515db76 Eugen Hristev    2019-06-12  535  
d7f26849ed7cc8 Eugen Hristev    2021-09-13  536  	isc->ispck = isc->isc_clks[ISC_ISPCK].clk;
d7f26849ed7cc8 Eugen Hristev    2021-09-13  537  
d7f26849ed7cc8 Eugen Hristev    2021-09-13  538  	ret = clk_prepare_enable(isc->ispck);
d7f26849ed7cc8 Eugen Hristev    2021-09-13  539  	if (ret) {
d7f26849ed7cc8 Eugen Hristev    2021-09-13  540  		dev_err(dev, "failed to enable ispck: %d\n", ret);
d7f26849ed7cc8 Eugen Hristev    2021-09-13  541  		goto cleanup_subdev;
d7f26849ed7cc8 Eugen Hristev    2021-09-13  542  	}
d7f26849ed7cc8 Eugen Hristev    2021-09-13  543  
d7f26849ed7cc8 Eugen Hristev    2021-09-13  544  	/* ispck should be greater or equal to hclock */
d7f26849ed7cc8 Eugen Hristev    2021-09-13  545  	ret = clk_set_rate(isc->ispck, clk_get_rate(isc->hclock));
d7f26849ed7cc8 Eugen Hristev    2021-09-13  546  	if (ret) {
d7f26849ed7cc8 Eugen Hristev    2021-09-13  547  		dev_err(dev, "failed to set ispck rate: %d\n", ret);
d7f26849ed7cc8 Eugen Hristev    2021-09-13  548  		goto unprepare_clk;
d7f26849ed7cc8 Eugen Hristev    2021-09-13  549  	}
d7f26849ed7cc8 Eugen Hristev    2021-09-13  550  
d51470069eb169 Eugen Hristev    2021-04-13  551  	regmap_read(isc->regmap, ISC_VERSION + isc->offsets.version, &ver);
d51470069eb169 Eugen Hristev    2021-04-13  552  	dev_info(dev, "Microchip ISC version %x\n", ver);
d51470069eb169 Eugen Hristev    2021-04-13  553  
0a0e265515db76 Eugen Hristev    2019-06-12  554  	return 0;
0a0e265515db76 Eugen Hristev    2019-06-12  555  
d7f26849ed7cc8 Eugen Hristev    2021-09-13  556  unprepare_clk:
d7f26849ed7cc8 Eugen Hristev    2021-09-13  557  	clk_disable_unprepare(isc->ispck);
d7f26849ed7cc8 Eugen Hristev    2021-09-13  558  
0a0e265515db76 Eugen Hristev    2019-06-12  559  cleanup_subdev:
0a0e265515db76 Eugen Hristev    2019-06-12  560  	isc_subdev_cleanup(isc);
0a0e265515db76 Eugen Hristev    2019-06-12  561  
f116d8f81c6424 Miaoqian Lin     2022-01-05 @562  disable_pm_runtime:
f116d8f81c6424 Miaoqian Lin     2022-01-05  563  	pm_runtime_disable(dev);
f116d8f81c6424 Miaoqian Lin     2022-01-05  564  
0a0e265515db76 Eugen Hristev    2019-06-12  565  unregister_v4l2_device:
0a0e265515db76 Eugen Hristev    2019-06-12  566  	v4l2_device_unregister(&isc->v4l2_dev);
0a0e265515db76 Eugen Hristev    2019-06-12  567  
0a0e265515db76 Eugen Hristev    2019-06-12  568  unprepare_hclk:
0a0e265515db76 Eugen Hristev    2019-06-12  569  	clk_disable_unprepare(isc->hclock);
0a0e265515db76 Eugen Hristev    2019-06-12  570  
0a0e265515db76 Eugen Hristev    2019-06-12  571  	isc_clk_cleanup(isc);
0a0e265515db76 Eugen Hristev    2019-06-12  572  
0a0e265515db76 Eugen Hristev    2019-06-12  573  	return ret;
0a0e265515db76 Eugen Hristev    2019-06-12  574  }
0a0e265515db76 Eugen Hristev    2019-06-12  575  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply

* Re: [PATCH v2 4/5] RISC-V: Typed CSRs in gdbserver
From: Alex Bennée @ 2022-01-05 18:43 UTC (permalink / raw)
  To: Konrad Schwarz
  Cc: Palmer Dabbelt, Bin Meng, Alistair Francis, Ralf Ramsauer,
	qemu-devel
In-Reply-To: <79194a3cf9e3bd1df41401eeee901055b8702c7b.1641309725.git.konrad.schwarz@siemens.com>


Konrad Schwarz <konrad.schwarz@siemens.com> writes:

> GDB target descriptions support typed registers;
> such that `info register X' displays not only the hex value of
> register `X', but also the individual bitfields the register
> comprises (if any), using textual labels if possible.
>
> This patch includes type information for GDB for
> a large subset of the RISC-V Control and Status Registers (CSRs).
>
> Signed-off-by: Konrad Schwarz <konrad.schwarz@siemens.com>
<snip>

Not withstanding my general comments (wish) to eventually get rid of
per-arch XML generation:

>  static int riscv_gen_dynamic_csr_xml(CPUState *cs, int base_reg)
>  {
>      RISCVCPU *cpu = RISCV_CPU(cs);
> @@ -163,21 +167,33 @@ static int riscv_gen_dynamic_csr_xml(CPUState *cs, int base_reg)
>      riscv_csr_predicate_fn predicate;
>      int bitsize = 16 << env->misa_mxl_max;
>      int i;
> +    riscv_csr_operations *csr_op;
> +    struct riscv_gdb_csr_tg const *csr_tg;
>  
>      g_string_printf(s, "<?xml version=\"1.0\"?>");
>      g_string_append_printf(s, "<!DOCTYPE feature SYSTEM \"gdb-target.dtd\">");
>      g_string_append_printf(s, "<feature>      name=\"org.gnu.gdb.riscv.csr\">");

With these changes does it still match the org.gnu.gdb.riscv.csr
register description in gdb? Previously for custom XML I've used the
org.qemu.ARCH.REGS form to distinguish between something GDB expects and
something we invented (changed since 797920b952ea).

>  
> -    for (i = 0; i < CSR_TABLE_SIZE; i++) {
> -        predicate = csr_ops[i].predicate;
> +    g_string_append(s, riscv_gdb_csr_types);
> +
> +    for (i = 0, csr_op = csr_ops, csr_tg = riscv_gdb_csr_type_group;
> +            i < CSR_TABLE_SIZE; ++csr_op, ++csr_tg, ++i) {
> +        predicate = csr_op->predicate;
>          if (predicate && (predicate(env, i) == RISCV_EXCP_NONE)) {
> -            if (csr_ops[i].name) {
> -                g_string_append_printf(s, "<reg name=\"%s\"", csr_ops[i].name);
> +            if (csr_op->name) {
> +                g_string_append_printf(s, "<reg name=\"%s\"", csr_op->name);
>              } else {
>                  g_string_append_printf(s, "<reg name=\"csr%03x\"", i);
>              }
>              g_string_append_printf(s, " bitsize=\"%d\"", bitsize);
> -            g_string_append_printf(s, " regnum=\"%d\"/>", base_reg + i);
> +            g_string_append_printf(s, " regnum=\"%d\"", base_reg + i);
> +            if (csr_tg->gdb_type) {
> +                g_string_append_printf(s, " type=\"%s\"", csr_tg->gdb_type);
> +            }
> +            if (csr_tg->gdb_group) {
> +                g_string_append_printf(s, " group=\"%s\"", csr_tg->gdb_group);
> +            }
> +            g_string_append(s, " />\n");
>          }
>      }
<snip>

-- 
Alex Bennée


^ permalink raw reply

* Re: [PATCH v3] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem
From: kernel test robot @ 2022-01-05 18:51 UTC (permalink / raw)
  To: Charan Teja Reddy, hughd, akpm, willy, vbabka, rientjes, mhocko,
	surenb, shakeelb, linux-mm
  Cc: kbuild-all, linux-kernel
In-Reply-To: <1641395025-7922-1-git-send-email-quic_charante@quicinc.com>

Hi Charan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on hnaz-mm/master]

url:    https://github.com/0day-ci/linux/commits/Charan-Teja-Reddy/mm-shmem-implement-POSIX_FADV_-WILL-DONT-NEED-for-shmem/20220105-230604
base:   https://github.com/hnaz/linux-mm master
config: nds32-allnoconfig (https://download.01.org/0day-ci/archive/20220106/202201060232.K03lKwTH-lkp@intel.com/config)
compiler: nds32le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6bdb2636187d2f6cb78d6cdc05f2b7e0b79c750a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Charan-Teja-Reddy/mm-shmem-implement-POSIX_FADV_-WILL-DONT-NEED-for-shmem/20220105-230604
        git checkout 6bdb2636187d2f6cb78d6cdc05f2b7e0b79c750a
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> mm/shmem.c:4000:27: error: 'shmem_fadvise' undeclared here (not in a function); did you mean 'shmem_file'?
    4000 |         .fadvise        = shmem_fadvise,
         |                           ^~~~~~~~~~~~~
         |                           shmem_file


vim +4000 mm/shmem.c

  3987	
  3988	static const struct file_operations shmem_file_operations = {
  3989		.mmap		= shmem_mmap,
  3990		.get_unmapped_area = shmem_get_unmapped_area,
  3991	#ifdef CONFIG_TMPFS
  3992		.llseek		= shmem_file_llseek,
  3993		.read_iter	= shmem_file_read_iter,
  3994		.write_iter	= generic_file_write_iter,
  3995		.fsync		= noop_fsync,
  3996		.splice_read	= generic_file_splice_read,
  3997		.splice_write	= iter_file_splice_write,
  3998		.fallocate	= shmem_fallocate,
  3999	#endif
> 4000		.fadvise	= shmem_fadvise,
  4001	};
  4002	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


^ permalink raw reply

* Re: [PATCH v9 09/10] xfs: Implement ->notify_failure() for XFS
From: Darrick J. Wong @ 2022-01-05 18:53 UTC (permalink / raw)
  To: Shiyang Ruan
  Cc: linux-kernel, linux-xfs, nvdimm, linux-mm, linux-fsdevel,
	dan.j.williams, david, hch, jane.chu
In-Reply-To: <20211226143439.3985960-10-ruansy.fnst@fujitsu.com>

On Sun, Dec 26, 2021 at 10:34:38PM +0800, Shiyang Ruan wrote:
> Introduce xfs_notify_failure.c to handle failure related works, such as
> implement ->notify_failure(), register/unregister dax holder in xfs, and
> so on.
> 
> If the rmap feature of XFS enabled, we can query it to find files and
> metadata which are associated with the corrupt data.  For now all we do
> is kill processes with that file mapped into their address spaces, but
> future patches could actually do something about corrupt metadata.
> 
> After that, the memory failure needs to notify the processes who are
> using those files.
> 
> Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
> ---
>  fs/xfs/Makefile             |   1 +
>  fs/xfs/xfs_buf.c            |  15 +++
>  fs/xfs/xfs_fsops.c          |   3 +
>  fs/xfs/xfs_mount.h          |   1 +
>  fs/xfs/xfs_notify_failure.c | 189 ++++++++++++++++++++++++++++++++++++
>  fs/xfs/xfs_notify_failure.h |  10 ++
>  6 files changed, 219 insertions(+)
>  create mode 100644 fs/xfs/xfs_notify_failure.c
>  create mode 100644 fs/xfs/xfs_notify_failure.h
> 
> diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
> index 04611a1068b4..389970b3e13b 100644
> --- a/fs/xfs/Makefile
> +++ b/fs/xfs/Makefile
> @@ -84,6 +84,7 @@ xfs-y				+= xfs_aops.o \
>  				   xfs_message.o \
>  				   xfs_mount.o \
>  				   xfs_mru_cache.o \
> +				   xfs_notify_failure.o \
>  				   xfs_pwork.o \
>  				   xfs_reflink.o \
>  				   xfs_stats.o \
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index bbb0fbd34e64..d0df7604fa9e 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -19,6 +19,7 @@
>  #include "xfs_errortag.h"
>  #include "xfs_error.h"
>  #include "xfs_ag.h"
> +#include "xfs_notify_failure.h"
>  
>  static struct kmem_cache *xfs_buf_cache;
>  
> @@ -1892,6 +1893,8 @@ xfs_free_buftarg(
>  	list_lru_destroy(&btp->bt_lru);
>  
>  	blkdev_issue_flush(btp->bt_bdev);
> +	if (btp->bt_daxdev)
> +		dax_unregister_holder(btp->bt_daxdev);
>  	fs_put_dax(btp->bt_daxdev);
>  
>  	kmem_free(btp);
> @@ -1946,6 +1949,18 @@ xfs_alloc_buftarg(
>  	btp->bt_dev =  bdev->bd_dev;
>  	btp->bt_bdev = bdev;
>  	btp->bt_daxdev = fs_dax_get_by_bdev(bdev, &btp->bt_dax_part_off);
> +	if (btp->bt_daxdev) {
> +		dax_write_lock(btp->bt_daxdev);
> +		if (dax_get_holder(btp->bt_daxdev)) {
> +			dax_write_unlock(btp->bt_daxdev);
> +			xfs_err(mp, "DAX device already in use?!");
> +			goto error_free;
> +		}
> +
> +		dax_register_holder(btp->bt_daxdev, mp,
> +				&xfs_dax_holder_operations);
> +		dax_write_unlock(btp->bt_daxdev);
> +	}
>  
>  	/*
>  	 * Buffer IO error rate limiting. Limit it to no more than 10 messages
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index 33e26690a8c4..d4d36c5bef11 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -542,6 +542,9 @@ xfs_do_force_shutdown(
>  	} else if (flags & SHUTDOWN_CORRUPT_INCORE) {
>  		tag = XFS_PTAG_SHUTDOWN_CORRUPT;
>  		why = "Corruption of in-memory data";
> +	} else if (flags & SHUTDOWN_CORRUPT_ONDISK) {
> +		tag = XFS_PTAG_SHUTDOWN_CORRUPT;
> +		why = "Corruption of on-disk metadata";
>  	} else {
>  		tag = XFS_PTAG_SHUTDOWN_IOERROR;
>  		why = "Metadata I/O Error";
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index 00720a02e761..47ff4ac53c4c 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -435,6 +435,7 @@ void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
>  #define SHUTDOWN_LOG_IO_ERROR	0x0002	/* write attempt to the log failed */
>  #define SHUTDOWN_FORCE_UMOUNT	0x0004	/* shutdown from a forced unmount */
>  #define SHUTDOWN_CORRUPT_INCORE	0x0008	/* corrupt in-memory data structures */
> +#define SHUTDOWN_CORRUPT_ONDISK	0x0010  /* corrupt metadata on device */
>  
>  #define XFS_SHUTDOWN_STRINGS \
>  	{ SHUTDOWN_META_IO_ERROR,	"metadata_io" }, \
> diff --git a/fs/xfs/xfs_notify_failure.c b/fs/xfs/xfs_notify_failure.c
> new file mode 100644
> index 000000000000..a87bd08365f4
> --- /dev/null
> +++ b/fs/xfs/xfs_notify_failure.c
> @@ -0,0 +1,189 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2021 Fujitsu.  All Rights Reserved.
> + */
> +
> +#include "xfs.h"
> +#include "xfs_shared.h"
> +#include "xfs_format.h"
> +#include "xfs_log_format.h"
> +#include "xfs_trans_resv.h"
> +#include "xfs_mount.h"
> +#include "xfs_alloc.h"
> +#include "xfs_bit.h"
> +#include "xfs_btree.h"
> +#include "xfs_inode.h"
> +#include "xfs_icache.h"
> +#include "xfs_rmap.h"
> +#include "xfs_rmap_btree.h"
> +#include "xfs_rtalloc.h"
> +#include "xfs_trans.h"
> +
> +#include <linux/mm.h>
> +#include <linux/dax.h>
> +
> +struct failure_info {
> +	xfs_agblock_t		startblock;
> +	xfs_filblks_t		blockcount;
> +	int			mf_flags;

Why is blockcount a 64-bit quantity, when the failure information is
dealt with on a per-AG basis?  I think "xfs_extlen_t blockcount" should
be large enough here.  (I'll get back to this further down.)

> +};
> +
> +static pgoff_t
> +xfs_failure_pgoff(
> +	struct xfs_mount		*mp,
> +	const struct xfs_rmap_irec	*rec,
> +	const struct failure_info	*notify)
> +{
> +	uint64_t pos = rec->rm_offset;

Nit: indenting ^^^^^ here.

> +
> +	if (notify->startblock > rec->rm_startblock)
> +		pos += XFS_FSB_TO_B(mp,
> +				notify->startblock - rec->rm_startblock);
> +	return pos >> PAGE_SHIFT;
> +}
> +
> +static unsigned long
> +xfs_failure_pgcnt(
> +	struct xfs_mount		*mp,
> +	const struct xfs_rmap_irec	*rec,
> +	const struct failure_info	*notify)
> +{
> +	xfs_agblock_t start_rec = rec->rm_startblock;
> +	xfs_agblock_t end_rec = rec->rm_startblock + rec->rm_blockcount;
> +	xfs_agblock_t start_notify = notify->startblock;
> +	xfs_agblock_t end_notify = notify->startblock + notify->blockcount;
> +	xfs_agblock_t start_cross = max(start_rec, start_notify);
> +	xfs_agblock_t end_cross = min(end_rec, end_notify);

Indenting and rather more local variables than we need?

static unsigned long
xfs_failure_pgcnt(
	struct xfs_mount		*mp,
	const struct xfs_rmap_irec	*rec,
	const struct failure_info	*notify)
{
	xfs_agblock_t			end_rec;
	xfs_agblock_t			end_notify;
	xfs_agblock_t			start_cross;
	xfs_agblock_t			end_cross;

	start_cross = max(rec->rm_startblock, notify->startblock);

	end_rec = rec->rm_startblock + rec->rm_blockcount;
	end_notify = notify->startblock + notify->blockcount;
	end_cross = min(end_rec, end_notify);

	return XFS_FSB_TO_B(mp, end_cross - start_cross) >> PAGE_SHIFT;
}

> +
> +	return XFS_FSB_TO_B(mp, end_cross - start_cross) >> PAGE_SHIFT;
> +}
> +
> +static int
> +xfs_dax_failure_fn(
> +	struct xfs_btree_cur		*cur,
> +	const struct xfs_rmap_irec	*rec,
> +	void				*data)
> +{
> +	struct xfs_mount		*mp = cur->bc_mp;
> +	struct xfs_inode		*ip;
> +	struct address_space		*mapping;
> +	struct failure_info		*notify = data;
> +	int				error = 0;
> +
> +	if (XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) ||
> +	    (rec->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK))) {
> +		/* TODO check and try to fix metadata */
> +		xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
> +		return -EFSCORRUPTED;
> +	}
> +
> +	/* Get files that incore, filter out others that are not in use. */
> +	error = xfs_iget(mp, cur->bc_tp, rec->rm_owner, XFS_IGET_INCORE,
> +			 0, &ip);
> +	/* Continue the rmap query if the inode isn't incore */
> +	if (error == -ENODATA)
> +		return 0;
> +	if (error)
> +		return error;
> +
> +	mapping = VFS_I(ip)->i_mapping;
> +	if (IS_ENABLED(CONFIG_MEMORY_FAILURE)) {

Is there a situation where we can receive media failure notices from DAX
but CONFIG_MEMORY_FAILURE is not enabled?  (I think the answer is yes?)

> +		pgoff_t off = xfs_failure_pgoff(mp, rec, notify);
> +		unsigned long cnt = xfs_failure_pgcnt(mp, rec, notify);
> +
> +		error = mf_dax_kill_procs(mapping, off, cnt, notify->mf_flags);
> +	}

If so, then we ought to do /something/ besides silently dropping the
error, right?  Even if that something is rudely shutting down the fs,
like we do for attr/bmbt mappings above?

What I'm getting at is that I think this function should be:

#if IS_ENABLED(CONFIG_MEMORY_FAILURE)
static int
xfs_dax_failure_fn(
	struct xfs_btree_cur		*cur,
	const struct xfs_rmap_irec	*rec,
	void				*data)
{
	/* shut down if attr/bmbt record like above */

	error = xfs_iget(...);
	if (error == -ENODATA)
		return 0;
	if (error)
		return error;

	off = xfs_failure_pgoff(mp, rec, notify);
	cnt = xfs_failure_pgcnt(mp, rec, notify);

	error = mf_dax_kill_procs(mapping, off, cnt, notify->mf_flags);
	xfs_irele(ip);
	return error;
}
#else
static int
xfs_dax_failure_fn(
	struct xfs_btree_cur		*cur,
	const struct xfs_rmap_irec	*rec,
	void				*data)
{
	/* No other option besides shutting down the fs. */
	xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
	return -EFSCORRUPTED;
}
#endif /* CONFIG_MEMORY_FAILURE */

> +	/* TODO try to fix data */
> +	xfs_irele(ip);
> +
> +	return error;
> +}
> +
> +static int
> +xfs_dax_notify_ddev_failure(
> +	struct xfs_mount	*mp,
> +	xfs_daddr_t		daddr,
> +	xfs_daddr_t		bblen,
> +	int			mf_flags)
> +{
> +	struct xfs_trans	*tp = NULL;
> +	struct xfs_btree_cur	*cur = NULL;
> +	struct xfs_buf		*agf_bp = NULL;
> +	struct failure_info	notify = { .mf_flags = mf_flags };
> +	int			error = 0;
> +	xfs_fsblock_t		fsbno = XFS_DADDR_TO_FSB(mp, daddr);
> +	xfs_agnumber_t		agno = XFS_FSB_TO_AGNO(mp, fsbno);
> +	xfs_fsblock_t		end_fsbno = XFS_DADDR_TO_FSB(mp, daddr + bblen);
> +	xfs_agnumber_t		end_agno = XFS_FSB_TO_AGNO(mp, end_fsbno);
> +
> +	error = xfs_trans_alloc_empty(mp, &tp);
> +	if (error)
> +		return error;
> +
> +	for (; agno <= end_agno; agno++) {
> +		struct xfs_rmap_irec	ri_low = { };
> +		struct xfs_rmap_irec	ri_high;
> +
> +		notify.startblock = XFS_FSB_TO_AGBNO(mp, fsbno);
> +		notify.blockcount = XFS_BB_TO_FSB(mp, bblen);

This isn't correct.  This sets notify.blockcount to the fsbcount of the
entire failed area, but it sets notify.startblock either to the start
of the failed area OR the start of some AG within the failed area.

If the failed area was blocks 80-119 and each AG is 100 blocks, then
this means we'll probe AG 0 (blocks 0-99) with notify spanning 80-119.
Those last 20 blocks are outside AG 0, but the rmap query range won't
return anything outside that range, so it doesn't really matter.

Next time through the loop, though, we're dealing with AG 1 (blocks
100-199).  Now notify spans blocks 100-139, because bblen hasn't been
updated!  If there's a file with an extent that maps blocks 115-125 and
a process that has only block 124 mmap'd, we'll kill that process
incorrectly because of the accounting error.

> +
> +		error = xfs_alloc_read_agf(mp, tp, agno, 0, &agf_bp);
> +		if (error)
> +			break;
> +
> +		cur = xfs_rmapbt_init_cursor(mp, tp, agf_bp, agf_bp->b_pag);
> +
> +		memset(&ri_high, 0xFF, sizeof(ri_high));
> +		ri_low.rm_startblock = XFS_FSB_TO_AGBNO(mp, fsbno);
> +		if (agno == end_agno)
> +			ri_high.rm_startblock = XFS_FSB_TO_AGBNO(mp, end_fsbno);

I think what you really want is to set notify.blockcount to
min(agf_length, ri_high.rm_startblock).  That also means that
notify.blockcount can be xfs_extlen_t, which is the norm for per-AG
extent operations.

> +
> +		error = xfs_rmap_query_range(cur, &ri_low, &ri_high,
> +				xfs_dax_failure_fn, &notify);
> +		xfs_btree_del_cursor(cur, error);
> +		xfs_trans_brelse(tp, agf_bp);
> +		if (error)
> +			break;
> +
> +		fsbno = XFS_AGB_TO_FSB(mp, agno + 1, 0);
> +	}
> +
> +	xfs_trans_cancel(tp);
> +	return error;
> +}
> +
> +static int
> +xfs_dax_notify_failure(
> +	struct dax_device	*dax_dev,
> +	u64			offset,
> +	u64			len,
> +	int			mf_flags)
> +{
> +	struct xfs_mount	*mp = dax_get_holder(dax_dev);
> +
> +	if (mp->m_rtdev_targp && mp->m_rtdev_targp->bt_daxdev == dax_dev) {
> +		xfs_warn(mp,
> +			 "notify_failure() not supported on realtime device!");
> +		return -EOPNOTSUPP;
> +	}
> +
> +	if (mp->m_logdev_targp && mp->m_logdev_targp->bt_daxdev == dax_dev &&
> +	    mp->m_logdev_targp != mp->m_ddev_targp) {

Technically speaking, if offset/len are beyond mp->m_sb.sb_logblocks
then we can return 0 since the log isn't using the failed part of the
external log.

Buuuut there are a lot of subtleties to the log, so maybe we (that is,
one of the more experienced xfs people) should implement a generic
handler for the log that will DTRT.

> +		xfs_err(mp, "ondisk log corrupt, shutting down fs!");
> +		xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
> +		return -EFSCORRUPTED;
> +	}
> +
> +	if (!xfs_has_rmapbt(mp)) {
> +		xfs_warn(mp, "notify_failure() needs rmapbt enabled!");
> +		return -EOPNOTSUPP;
> +	}
> +
> +	offset -= mp->m_ddev_targp->bt_dax_part_off;

Don't we need to check offset/len to make sure they're still within the
boundaries of the data device?

--D

> +	return xfs_dax_notify_ddev_failure(mp, BTOBB(offset), BTOBB(len),
> +			mf_flags);
> +}
> +
> +const struct dax_holder_operations xfs_dax_holder_operations = {
> +	.notify_failure		= xfs_dax_notify_failure,
> +};
> diff --git a/fs/xfs/xfs_notify_failure.h b/fs/xfs/xfs_notify_failure.h
> new file mode 100644
> index 000000000000..f40cb315e7ce
> --- /dev/null
> +++ b/fs/xfs/xfs_notify_failure.h
> @@ -0,0 +1,10 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2021 Fujitsu.  All Rights Reserved.
> + */
> +#ifndef __XFS_NOTIFY_FAILURE_H__
> +#define __XFS_NOTIFY_FAILURE_H__
> +
> +extern const struct dax_holder_operations xfs_dax_holder_operations;
> +
> +#endif  /* __XFS_NOTIFY_FAILURE_H__ */
> -- 
> 2.34.1
> 
> 
> 

^ permalink raw reply

* Re: [PATCH v8 19/40] KVM: SVM: Update the SEV-ES save area mapping
From: Venu Busireddy @ 2022-01-05 18:54 UTC (permalink / raw)
  To: Brijesh Singh
  Cc: x86, linux-kernel, kvm, linux-efi, platform-driver-x86,
	linux-coco, linux-mm, Thomas Gleixner, Ingo Molnar, Joerg Roedel,
	Tom Lendacky, H. Peter Anvin, Ard Biesheuvel, Paolo Bonzini,
	Sean Christopherson, Vitaly Kuznetsov, Jim Mattson,
	Andy Lutomirski, Dave Hansen, Sergio Lopez, Peter Gonda,
	Peter Zijlstra, Srinivas Pandruvada, David Rientjes, Dov Murik,
	Tobin Feldman-Fitzthum, Borislav Petkov, Michael Roth,
	Vlastimil Babka, Kirill A . Shutemov, Andi Kleen,
	Dr . David Alan Gilbert, tony.luck, marcorr,
	sathyanarayanan.kuppuswamy
In-Reply-To: <20211210154332.11526-20-brijesh.singh@amd.com>

On 2021-12-10 09:43:11 -0600, Brijesh Singh wrote:
> From: Tom Lendacky <thomas.lendacky@amd.com>
> 
> This is the final step in defining the multiple save areas to keep them
> separate and ensuring proper operation amongst the different types of
> guests. Update the SEV-ES/SEV-SNP save area to match the APM. This save
> area will be used for the upcoming SEV-SNP AP Creation NAE event support.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>

Reviewed-by: Venu Busireddy <venu.busireddy@oracle.com>

> ---
>  arch/x86/include/asm/svm.h | 66 +++++++++++++++++++++++++++++---------
>  1 file changed, 50 insertions(+), 16 deletions(-)
> 

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.