Re: [PATCH v8 1/5] vfio/migration: Add debugfs to live migration driver
From: liulongfang
Date: Tue Mar 14 2023 - 07:31:49 EST
On 2023/3/14 17:32, liulongfang wrote:
> On 2023/3/11 1:12, Jason Gunthorpe wrote:
>> On Fri, Feb 17, 2023 at 04:48:27PM +0800, Longfang Liu wrote:
>>> +void vfio_vf_debugfs_init(struct vfio_device *vdev)
>>> +{
>>> + struct device *dev = &vdev->device;
>>> +
>>> + vdev->debug_root = debugfs_create_dir(dev_name(vdev->dev), vfio_debugfs_root);
>>> +
>>> + debugfs_create_devm_seqfile(dev, "migration_state", vdev->debug_root,
>>> + vfio_vf_state_read);
>>> +}
>>> +EXPORT_SYMBOL_GPL(vfio_vf_debugfs_init);
>>> +
>>> +void vfio_vf_debugfs_exit(struct vfio_device *vdev)
>>> +{
>>> + debugfs_remove_recursive(vdev->debug_root);
>>> +}
>>> +EXPORT_SYMBOL_GPL(vfio_vf_debugfs_exit);
>>> +
>>> +void vfio_debugfs_create_root(void)
>>> +{
>>> + vfio_debugfs_root = debugfs_create_dir("vfio", NULL);
>>> +}
>>> +EXPORT_SYMBOL_GPL(vfio_debugfs_create_root);
>>> +
>>> +void vfio_debugfs_remove_root(void)
>>> +{
>>> + debugfs_remove_recursive(vfio_debugfs_root);
>>> + vfio_debugfs_root = NULL;
>>> +}
>>> +EXPORT_SYMBOL_GPL(vfio_debugfs_remove_root);
>>
>> Why are these symbols exported?
>>
>
> If the export statement is not added, a compilation error will occur:
>
> ERROR: modpost: "vfio_vf_debugfs_init" [drivers/vfio/pci/hisilicon/hisi-acc-vfio-pci.ko] undefined!
> ERROR: modpost: "vfio_vf_debugfs_exit" [drivers/vfio/pci/hisilicon/hisi-acc-vfio-pci.ko] undefined!
> scripts/Makefile.modpost:126: recipe for target 'Module.symvers' failed
> make[1]: *** [Module.symvers] Error 1
>
The first two functions cannot remove the export statement,
but the latter two can be removed.
Thanks,
Longfang.
>
>> Jason
>>
>> .
> Thanks,
> Longfang
>
>>