NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
* [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices
@ 2022-02-28  9:49 Zhenguo Yao
  2022-02-28 17:36 ` kernel test robot
  2022-03-23  2:01 ` Dan Williams
  0 siblings, 2 replies; 4+ messages in thread
From: Zhenguo Yao @ 2022-02-28  9:49 UTC (permalink / raw)
  To: dan.j.williams, vishal.l.verma, dave.jiang
  Cc: nvdimm, yaozhenguo, linux-kernel, Zhenguo Yao

device_dax driver always match dax devices by default. The other
drivers only match devices by dax_id. There are situations which
need kmem drvier match all the dax device at boot time. So
adding a parameter to support this function.

Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com>
---
 drivers/dax/device.c | 3 +++
 drivers/dax/kmem.c   | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index dd8222a..a974cc1 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -452,6 +452,7 @@ int dev_dax_probe(struct dev_dax *dev_dax)
 }
 EXPORT_SYMBOL_GPL(dev_dax_probe);
 
+unsigned int match = 1;
 static struct dax_device_driver device_dax_driver = {
 	.probe = dev_dax_probe,
 	/* all probe actions are unwound by devm, so .remove isn't necessary */
@@ -460,6 +461,7 @@ int dev_dax_probe(struct dev_dax *dev_dax)
 
 static int __init dax_init(void)
 {
+	device_dax_driver.match_always = match;
 	return dax_driver_register(&device_dax_driver);
 }
 
@@ -468,6 +470,7 @@ static void __exit dax_exit(void)
 	dax_driver_unregister(&device_dax_driver);
 }
 
+module_param(match, uint, 0644);
 MODULE_AUTHOR("Intel Corporation");
 MODULE_LICENSE("GPL v2");
 module_init(dax_init);
diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
index a376220..41ba713 100644
--- a/drivers/dax/kmem.c
+++ b/drivers/dax/kmem.c
@@ -214,9 +214,11 @@ static void dev_dax_kmem_remove(struct dev_dax *dev_dax)
 }
 #endif /* CONFIG_MEMORY_HOTREMOVE */
 
+unsigned int match;
 static struct dax_device_driver device_dax_kmem_driver = {
 	.probe = dev_dax_kmem_probe,
 	.remove = dev_dax_kmem_remove,
+	.match_always = 0,
 };
 
 static int __init dax_kmem_init(void)
@@ -228,6 +230,7 @@ static int __init dax_kmem_init(void)
 	if (!kmem_name)
 		return -ENOMEM;
 
+	device_dax_kmem_driver.match_always = match;
 	rc = dax_driver_register(&device_dax_kmem_driver);
 	if (rc)
 		kfree_const(kmem_name);
@@ -241,6 +244,7 @@ static void __exit dax_kmem_exit(void)
 		kfree_const(kmem_name);
 }
 
+module_param(match, uint, 0644);
 MODULE_AUTHOR("Intel Corporation");
 MODULE_LICENSE("GPL v2");
 module_init(dax_kmem_init);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices
  2022-02-28  9:49 [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices Zhenguo Yao
@ 2022-02-28 17:36 ` kernel test robot
  2022-03-23  2:01 ` Dan Williams
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-02-28 17:36 UTC (permalink / raw)
  To: Zhenguo Yao, dan.j.williams, vishal.l.verma, dave.jiang
  Cc: kbuild-all, nvdimm, yaozhenguo, linux-kernel, Zhenguo Yao

Hi Zhenguo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc6 next-20220225]
[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/Zhenguo-Yao/device-dax-Adding-match-parameter-to-select-which-driver-to-match-dax-devices/20220228-175040
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7e57714cd0ad2d5bb90e50b5096a0e671dec1ef3
config: arm64-randconfig-r006-20220227 (https://download.01.org/0day-ci/archive/20220301/202203010043.CdGByjRQ-lkp@intel.com/config)
compiler: aarch64-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/5be3350fe78893555785550e6fdf382715c2dca9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zhenguo-Yao/device-dax-Adding-match-parameter-to-select-which-driver-to-match-dax-devices/20220228-175040
        git checkout 5be3350fe78893555785550e6fdf382715c2dca9
        # 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=arm64 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 >>):

>> aarch64-linux-ld: drivers/dax/kmem.o:(.bss+0x10): multiple definition of `match'; drivers/dax/device.o:(.data+0xb8): first defined here

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices
  2022-02-28  9:49 [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices Zhenguo Yao
  2022-02-28 17:36 ` kernel test robot
@ 2022-03-23  2:01 ` Dan Williams
  2022-03-23  2:44   ` Zhenguo Yao
  1 sibling, 1 reply; 4+ messages in thread
From: Dan Williams @ 2022-03-23  2:01 UTC (permalink / raw)
  To: Zhenguo Yao
  Cc: Vishal L Verma, Dave Jiang, Linux NVDIMM, yaozhenguo,
	Linux Kernel Mailing List

On Mon, Feb 28, 2022 at 1:50 AM Zhenguo Yao <yaozhenguo1@gmail.com> wrote:
>
> device_dax driver always match dax devices by default. The other
> drivers only match devices by dax_id. There are situations which
> need kmem drvier match all the dax device at boot time. So
> adding a parameter to support this function.

What are the situations that happen at boot time that can't wait for
initramfs or userspace to move the device assignment?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices
  2022-03-23  2:01 ` Dan Williams
@ 2022-03-23  2:44   ` Zhenguo Yao
  0 siblings, 0 replies; 4+ messages in thread
From: Zhenguo Yao @ 2022-03-23  2:44 UTC (permalink / raw)
  To: Dan Williams
  Cc: Vishal L Verma, Dave Jiang, Linux NVDIMM,
	姚振国, Linux Kernel Mailing List

I thought about it carefully. Indeed, in my scenario(virtual machine which use
optane as DRAM), device assignment can be performed in userspace at very
early time after the system is started. This patch is not needed in my
scenario. Thank you for your reply.

Dan Williams <dan.j.williams@intel.com> 于2022年3月23日周三 10:01写道:
>
> On Mon, Feb 28, 2022 at 1:50 AM Zhenguo Yao <yaozhenguo1@gmail.com> wrote:
> >
> > device_dax driver always match dax devices by default. The other
> > drivers only match devices by dax_id. There are situations which
> > need kmem drvier match all the dax device at boot time. So
> > adding a parameter to support this function.
>
> What are the situations that happen at boot time that can't wait for
> initramfs or userspace to move the device assignment?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-23  2:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-28  9:49 [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices Zhenguo Yao
2022-02-28 17:36 ` kernel test robot
2022-03-23  2:01 ` Dan Williams
2022-03-23  2:44   ` Zhenguo Yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox