linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] UIO: make maximum memory and port regions configurable
@ 2020-03-07  8:10 Qiang Su
  2020-03-18 11:33 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Qiang Su @ 2020-03-07  8:10 UTC (permalink / raw)
  To: gregkh, suqiang4; +Cc: linux-kernel

Now each uio device can only support 5 memory regions and
5 port regions. It is far from enough for some big system.
On the other hand, the hard-coded style is not flexible.

Consider the marco is used as array index, so a range for
the config is set in menuconfig. The range is set as 1 to 512.
The default value is still set as 5 to keep consistent with
current code.

Signed-off-by: Qiang Su <suqiang4@huawei.com>
Reported-by: kbuild test robot <lkp@intel.com>
---
Changes since v1:
- also make port regions configurable in menuconfig.
- fix kbuild errors.
---
 drivers/uio/Kconfig        | 18 ++++++++++++++++++
 include/linux/uio_driver.h |  4 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 202ee81cfc2b..cee7d93cfea2 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -165,4 +165,22 @@ config UIO_HV_GENERIC
 	  to network and storage devices from userspace.
 
 	  If you compile this as a module, it will be called uio_hv_generic.
+
+config MAX_UIO_MAPS
+	depends on UIO
+	int "Maximum of memory nodes each uio device support(1-512)"
+	range 1 512
+	default 5
+	help
+	  make the max number of memory regions in uio device configurable.
+
+config MAX_UIO_PORT_REGIONS
+	depends on UIO
+	int "Maximum of port regions each uio device support(1-512)"
+	range 1 512
+	default 5
+	help
+	  make the max number of port regions in uio device configurable.
+
+
 endif
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 01081c4726c0..5dc60088834c 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -44,7 +44,7 @@ struct uio_mem {
 	struct uio_map		*map;
 };
 
-#define MAX_UIO_MAPS	5
+#define MAX_UIO_MAPS	CONFIG_MAX_UIO_MAPS
 
 struct uio_portio;
 
@@ -64,7 +64,7 @@ struct uio_port {
 	struct uio_portio	*portio;
 };
 
-#define MAX_UIO_PORT_REGIONS	5
+#define MAX_UIO_PORT_REGIONS	CONFIG_MAX_UIO_PORT_REGIONS
 
 struct uio_device {
         struct module           *owner;
-- 
2.12.3


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

* Re: [PATCH V2] UIO: make maximum memory and port regions configurable
  2020-03-07  8:10 [PATCH V2] UIO: make maximum memory and port regions configurable Qiang Su
@ 2020-03-18 11:33 ` Greg KH
  2020-03-19  3:11   ` suqiang (C)
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2020-03-18 11:33 UTC (permalink / raw)
  To: Qiang Su; +Cc: linux-kernel

On Sat, Mar 07, 2020 at 04:10:08PM +0800, Qiang Su wrote:
> Now each uio device can only support 5 memory regions and
> 5 port regions. It is far from enough for some big system.
> On the other hand, the hard-coded style is not flexible.
> 
> Consider the marco is used as array index, so a range for
> the config is set in menuconfig. The range is set as 1 to 512.
> The default value is still set as 5 to keep consistent with
> current code.
> 
> Signed-off-by: Qiang Su <suqiang4@huawei.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> ---
> Changes since v1:
> - also make port regions configurable in menuconfig.
> - fix kbuild errors.
> ---
>  drivers/uio/Kconfig        | 18 ++++++++++++++++++
>  include/linux/uio_driver.h |  4 ++--
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
> index 202ee81cfc2b..cee7d93cfea2 100644
> --- a/drivers/uio/Kconfig
> +++ b/drivers/uio/Kconfig
> @@ -165,4 +165,22 @@ config UIO_HV_GENERIC
>  	  to network and storage devices from userspace.
>  
>  	  If you compile this as a module, it will be called uio_hv_generic.
> +
> +config MAX_UIO_MAPS
> +	depends on UIO
> +	int "Maximum of memory nodes each uio device support(1-512)"
> +	range 1 512
> +	default 5
> +	help
> +	  make the max number of memory regions in uio device configurable.
> +
> +config MAX_UIO_PORT_REGIONS
> +	depends on UIO
> +	int "Maximum of port regions each uio device support(1-512)"
> +	range 1 512
> +	default 5
> +	help
> +	  make the max number of port regions in uio device configurable.


Can you provide a lot more information in these help texts?  Explain why
you would ever want to change these values, and that if you do not
understand, just take the default ones.

Or, better yet, can we just make these values dynamic and grow as needed
by the system?  Why are they "fixed"?

thanks,

greg k-h

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

* RE: [PATCH V2] UIO: make maximum memory and port regions configurable
  2020-03-18 11:33 ` Greg KH
@ 2020-03-19  3:11   ` suqiang (C)
  2020-03-19  7:18     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: suqiang (C) @ 2020-03-19  3:11 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, Liyou (leeyou, RTOS)

Dear Greg,
Thanks a lot for suggestion. I will add more information in these help texts and send PATCH V3 soon.
Furthermore, of cause it is better to make these values dynamic and grow as needed by the system. A possible way is to manage memory and port resource by a dynamic list instead of a static array.
But it costs more time to design and implement a better scheme. I will try it later and push patchs when it's finished.
This patch is a temporary way better than nothing, and I hope it could be accept.

thanks,
Qiang Su

-----Original Message-----
From: Greg KH [mailto:gregkh@linuxfoundation.org] 
Sent: Wednesday, March 18, 2020 7:34 PM
To: suqiang (C) <suqiang4@huawei.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] UIO: make maximum memory and port regions configurable

On Sat, Mar 07, 2020 at 04:10:08PM +0800, Qiang Su wrote:
> Now each uio device can only support 5 memory regions and
> 5 port regions. It is far from enough for some big system.
> On the other hand, the hard-coded style is not flexible.
> 
> Consider the marco is used as array index, so a range for the config 
> is set in menuconfig. The range is set as 1 to 512.
> The default value is still set as 5 to keep consistent with current 
> code.
> 
> Signed-off-by: Qiang Su <suqiang4@huawei.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> ---
> Changes since v1:
> - also make port regions configurable in menuconfig.
> - fix kbuild errors.
> ---
>  drivers/uio/Kconfig        | 18 ++++++++++++++++++
>  include/linux/uio_driver.h |  4 ++--
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 
> 202ee81cfc2b..cee7d93cfea2 100644
> --- a/drivers/uio/Kconfig
> +++ b/drivers/uio/Kconfig
> @@ -165,4 +165,22 @@ config UIO_HV_GENERIC
>  	  to network and storage devices from userspace.
>  
>  	  If you compile this as a module, it will be called uio_hv_generic.
> +
> +config MAX_UIO_MAPS
> +	depends on UIO
> +	int "Maximum of memory nodes each uio device support(1-512)"
> +	range 1 512
> +	default 5
> +	help
> +	  make the max number of memory regions in uio device configurable.
> +
> +config MAX_UIO_PORT_REGIONS
> +	depends on UIO
> +	int "Maximum of port regions each uio device support(1-512)"
> +	range 1 512
> +	default 5
> +	help
> +	  make the max number of port regions in uio device configurable.


Can you provide a lot more information in these help texts?  Explain why you would ever want to change these values, and that if you do not understand, just take the default ones.

Or, better yet, can we just make these values dynamic and grow as needed by the system?  Why are they "fixed"?

thanks,

greg k-h

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

* Re: [PATCH V2] UIO: make maximum memory and port regions configurable
  2020-03-19  3:11   ` suqiang (C)
@ 2020-03-19  7:18     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-03-19  7:18 UTC (permalink / raw)
  To: suqiang (C); +Cc: linux-kernel, Liyou (leeyou, RTOS)

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://daringfireball.net/2007/07/on_top

On Thu, Mar 19, 2020 at 03:11:20AM +0000, suqiang (C) wrote:
> Dear Greg,
> Thanks a lot for suggestion. I will add more information in these help texts and send PATCH V3 soon.
> Furthermore, of cause it is better to make these values dynamic and grow as needed by the system. A possible way is to manage memory and port resource by a dynamic list instead of a static array.
> But it costs more time to design and implement a better scheme. I will try it later and push patchs when it's finished.
> This patch is a temporary way better than nothing, and I hope it could be accept.

No, please do it correctly, there is no rush here.  Moving from an array
to a list should not be that difficult.

thanks,

greg k-h

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

end of thread, other threads:[~2020-03-19  7:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-07  8:10 [PATCH V2] UIO: make maximum memory and port regions configurable Qiang Su
2020-03-18 11:33 ` Greg KH
2020-03-19  3:11   ` suqiang (C)
2020-03-19  7:18     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).