public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vfio: mdev: make mdev_bus_type const
@ 2024-02-08 20:02 Ricardo B. Marliere
  2024-02-09 10:32 ` Greg Kroah-Hartman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ricardo B. Marliere @ 2024-02-08 20:02 UTC (permalink / raw)
  To: Kirti Wankhede, Alex Williamson
  Cc: kvm, linux-kernel, Greg Kroah-Hartman, Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type,
move the mdev_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 drivers/vfio/mdev/mdev_driver.c  | 2 +-
 drivers/vfio/mdev/mdev_private.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/mdev/mdev_driver.c b/drivers/vfio/mdev/mdev_driver.c
index 7825d83a55f8..b98322966b3e 100644
--- a/drivers/vfio/mdev/mdev_driver.c
+++ b/drivers/vfio/mdev/mdev_driver.c
@@ -40,7 +40,7 @@ static int mdev_match(struct device *dev, struct device_driver *drv)
 	return 0;
 }
 
-struct bus_type mdev_bus_type = {
+const struct bus_type mdev_bus_type = {
 	.name		= "mdev",
 	.probe		= mdev_probe,
 	.remove		= mdev_remove,
diff --git a/drivers/vfio/mdev/mdev_private.h b/drivers/vfio/mdev/mdev_private.h
index af457b27f607..63a1316b08b7 100644
--- a/drivers/vfio/mdev/mdev_private.h
+++ b/drivers/vfio/mdev/mdev_private.h
@@ -13,7 +13,7 @@
 int  mdev_bus_register(void);
 void mdev_bus_unregister(void);
 
-extern struct bus_type mdev_bus_type;
+extern const struct bus_type mdev_bus_type;
 extern const struct attribute_group *mdev_device_groups[];
 
 #define to_mdev_type_attr(_attr)	\

---
base-commit: 78f70c02bdbccb5e9b0b0c728185d4aeb7044ace
change-id: 20240208-bus_cleanup-vfio-75a6180b5efe

Best regards,
-- 
Ricardo B. Marliere <ricardo@marliere.net>


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

* Re: [PATCH] vfio: mdev: make mdev_bus_type const
  2024-02-08 20:02 [PATCH] vfio: mdev: make mdev_bus_type const Ricardo B. Marliere
@ 2024-02-09 10:32 ` Greg Kroah-Hartman
  2024-02-12 13:44 ` Jason Gunthorpe
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2024-02-09 10:32 UTC (permalink / raw)
  To: Ricardo B. Marliere; +Cc: Kirti Wankhede, Alex Williamson, kvm, linux-kernel

On Thu, Feb 08, 2024 at 05:02:04PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the mdev_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
>  drivers/vfio/mdev/mdev_driver.c  | 2 +-
>  drivers/vfio/mdev/mdev_private.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] vfio: mdev: make mdev_bus_type const
  2024-02-08 20:02 [PATCH] vfio: mdev: make mdev_bus_type const Ricardo B. Marliere
  2024-02-09 10:32 ` Greg Kroah-Hartman
@ 2024-02-12 13:44 ` Jason Gunthorpe
  2024-02-12 17:35 ` Kirti Wankhede
  2024-02-22 21:37 ` Alex Williamson
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2024-02-12 13:44 UTC (permalink / raw)
  To: Ricardo B. Marliere
  Cc: Kirti Wankhede, Alex Williamson, kvm, linux-kernel,
	Greg Kroah-Hartman

On Thu, Feb 08, 2024 at 05:02:04PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the mdev_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
>  drivers/vfio/mdev/mdev_driver.c  | 2 +-
>  drivers/vfio/mdev/mdev_private.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

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

* RE: [PATCH] vfio: mdev: make mdev_bus_type const
  2024-02-08 20:02 [PATCH] vfio: mdev: make mdev_bus_type const Ricardo B. Marliere
  2024-02-09 10:32 ` Greg Kroah-Hartman
  2024-02-12 13:44 ` Jason Gunthorpe
@ 2024-02-12 17:35 ` Kirti Wankhede
  2024-02-22 21:37 ` Alex Williamson
  3 siblings, 0 replies; 5+ messages in thread
From: Kirti Wankhede @ 2024-02-12 17:35 UTC (permalink / raw)
  To: Ricardo B. Marliere, Alex Williamson
  Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman


> -----Original Message-----
> From: Ricardo B. Marliere <ricardo@marliere.net>
> Sent: Friday, February 9, 2024 1:32 AM
> To: Kirti Wankhede <kwankhede@nvidia.com>; Alex Williamson
> <alex.williamson@redhat.com>
> Cc: kvm@vger.kernel.org; linux-kernel@vger.kernel.org; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Ricardo B. Marliere <ricardo@marliere.net>
> Subject: [PATCH] vfio: mdev: make mdev_bus_type const
> 
> Now that the driver core can properly handle constant struct bus_type,
> move the mdev_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com> 


> ---
>  drivers/vfio/mdev/mdev_driver.c  | 2 +-
>  drivers/vfio/mdev/mdev_private.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vfio/mdev/mdev_driver.c b/drivers/vfio/mdev/mdev_driver.c
> index 7825d83a55f8..b98322966b3e 100644
> --- a/drivers/vfio/mdev/mdev_driver.c
> +++ b/drivers/vfio/mdev/mdev_driver.c
> @@ -40,7 +40,7 @@ static int mdev_match(struct device *dev, struct
> device_driver *drv)
>  	return 0;
>  }
> 
> -struct bus_type mdev_bus_type = {
> +const struct bus_type mdev_bus_type = {
>  	.name		= "mdev",
>  	.probe		= mdev_probe,
>  	.remove		= mdev_remove,
> diff --git a/drivers/vfio/mdev/mdev_private.h
> b/drivers/vfio/mdev/mdev_private.h
> index af457b27f607..63a1316b08b7 100644
> --- a/drivers/vfio/mdev/mdev_private.h
> +++ b/drivers/vfio/mdev/mdev_private.h
> @@ -13,7 +13,7 @@
>  int  mdev_bus_register(void);
>  void mdev_bus_unregister(void);
> 
> -extern struct bus_type mdev_bus_type;
> +extern const struct bus_type mdev_bus_type;
>  extern const struct attribute_group *mdev_device_groups[];
> 
>  #define to_mdev_type_attr(_attr)	\
> 
> ---
> base-commit: 78f70c02bdbccb5e9b0b0c728185d4aeb7044ace
> change-id: 20240208-bus_cleanup-vfio-75a6180b5efe
> 
> Best regards,
> --
> Ricardo B. Marliere <ricardo@marliere.net>


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

* Re: [PATCH] vfio: mdev: make mdev_bus_type const
  2024-02-08 20:02 [PATCH] vfio: mdev: make mdev_bus_type const Ricardo B. Marliere
                   ` (2 preceding siblings ...)
  2024-02-12 17:35 ` Kirti Wankhede
@ 2024-02-22 21:37 ` Alex Williamson
  3 siblings, 0 replies; 5+ messages in thread
From: Alex Williamson @ 2024-02-22 21:37 UTC (permalink / raw)
  To: Ricardo B. Marliere; +Cc: Kirti Wankhede, kvm, linux-kernel, Greg Kroah-Hartman

On Thu, 08 Feb 2024 17:02:04 -0300
"Ricardo B. Marliere" <ricardo@marliere.net> wrote:

> Now that the driver core can properly handle constant struct bus_type,
> move the mdev_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
>  drivers/vfio/mdev/mdev_driver.c  | 2 +-
>  drivers/vfio/mdev/mdev_private.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vfio/mdev/mdev_driver.c b/drivers/vfio/mdev/mdev_driver.c
> index 7825d83a55f8..b98322966b3e 100644
> --- a/drivers/vfio/mdev/mdev_driver.c
> +++ b/drivers/vfio/mdev/mdev_driver.c
> @@ -40,7 +40,7 @@ static int mdev_match(struct device *dev, struct device_driver *drv)
>  	return 0;
>  }
>  
> -struct bus_type mdev_bus_type = {
> +const struct bus_type mdev_bus_type = {
>  	.name		= "mdev",
>  	.probe		= mdev_probe,
>  	.remove		= mdev_remove,
> diff --git a/drivers/vfio/mdev/mdev_private.h b/drivers/vfio/mdev/mdev_private.h
> index af457b27f607..63a1316b08b7 100644
> --- a/drivers/vfio/mdev/mdev_private.h
> +++ b/drivers/vfio/mdev/mdev_private.h
> @@ -13,7 +13,7 @@
>  int  mdev_bus_register(void);
>  void mdev_bus_unregister(void);
>  
> -extern struct bus_type mdev_bus_type;
> +extern const struct bus_type mdev_bus_type;
>  extern const struct attribute_group *mdev_device_groups[];
>  
>  #define to_mdev_type_attr(_attr)	\
> 
> ---
> base-commit: 78f70c02bdbccb5e9b0b0c728185d4aeb7044ace
> change-id: 20240208-bus_cleanup-vfio-75a6180b5efe
> 
> Best regards,

Applied to vfio next branch for v6.9.  Thanks,

Alex


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

end of thread, other threads:[~2024-02-22 21:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08 20:02 [PATCH] vfio: mdev: make mdev_bus_type const Ricardo B. Marliere
2024-02-09 10:32 ` Greg Kroah-Hartman
2024-02-12 13:44 ` Jason Gunthorpe
2024-02-12 17:35 ` Kirti Wankhede
2024-02-22 21:37 ` Alex Williamson

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