All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: reserve extra bus number resource for hotplug bridge
@ 2012-07-02  4:49 Taku Izumi
  2012-07-02 20:51 ` Yinghai Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Taku Izumi @ 2012-07-02  4:49 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas; +Cc: Kenji Kaneshige, Yinghai Lu, Jiang Liu


Currently I/O ports and I/O memory resources are reserved for
hotplug bridges and we can tune their size by using hpiosize
and hpmemsize boot option. 

This patch extends feature so that we can reserve additional 
bus number resources for hotplug bridges and tune it by 
using "hpbussize" option.

This patch also adds missing document for "hpiosize" and
"hpmemsize" option.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
---
 Documentation/kernel-parameters.txt |   10 ++++++++++
 drivers/pci/pci.c                   |    6 +++++-
 drivers/pci/probe.c                 |    4 ++++
 include/linux/pci.h                 |    1 +
 4 files changed, 20 insertions(+), 1 deletion(-)

Index: linux/drivers/pci/pci.c
===================================================================
--- linux.orig/drivers/pci/pci.c
+++ linux/drivers/pci/pci.c
@@ -74,9 +74,11 @@ unsigned long pci_cardbus_mem_size = DEF
 
 #define DEFAULT_HOTPLUG_IO_SIZE		(256)
 #define DEFAULT_HOTPLUG_MEM_SIZE	(2*1024*1024)
-/* pci=hpmemsize=nnM,hpiosize=nn can override this */
+#define DEFAULT_HOTPLUG_BUS_SIZE	(0)
+/* pci=hpmemsize=nnM,hpiosize=nn,hpbussize=n can override this */
 unsigned long pci_hotplug_io_size  = DEFAULT_HOTPLUG_IO_SIZE;
 unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
+unsigned int pci_hotplug_bus_size = DEFAULT_HOTPLUG_BUS_SIZE;
 
 enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF;
 
@@ -3826,6 +3828,8 @@ static int __init pci_setup(char *str)
 				pci_hotplug_io_size = memparse(str + 9, &str);
 			} else if (!strncmp(str, "hpmemsize=", 10)) {
 				pci_hotplug_mem_size = memparse(str + 10, &str);
+			} else if (!strncmp(str, "hpbussize=", 10)) {
+				pci_hotplug_bus_size = memparse(str + 10, &str);
 			} else if (!strncmp(str, "pcie_bus_tune_off", 17)) {
 				pcie_bus_config = PCIE_BUS_TUNE_OFF;
 			} else if (!strncmp(str, "pcie_bus_safe", 13)) {
Index: linux/drivers/pci/probe.c
===================================================================
--- linux.orig/drivers/pci/probe.c
+++ linux/drivers/pci/probe.c
@@ -865,6 +865,10 @@ int __devinit pci_scan_bridge(struct pci
 		/*
 		 * Set the subordinate bus number to its real value.
 		 */
+		if (dev->is_hotplug_bridge) {
+			if (max + pci_hotplug_bus_size < child->busn_res.end)
+				max += pci_hotplug_bus_size;
+		}
 		pci_bus_update_busn_res_end(child, max);
 		pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
 	}
Index: linux/include/linux/pci.h
===================================================================
--- linux.orig/include/linux/pci.h
+++ linux/include/linux/pci.h
@@ -1517,6 +1517,7 @@ extern u8 pci_cache_line_size;
 
 extern unsigned long pci_hotplug_io_size;
 extern unsigned long pci_hotplug_mem_size;
+extern unsigned int pci_hotplug_bus_size;
 
 /* Architecture specific versions may override these (weak) */
 int pcibios_add_platform_entries(struct pci_dev *dev);
Index: linux/Documentation/kernel-parameters.txt
===================================================================
--- linux.orig/Documentation/kernel-parameters.txt
+++ linux/Documentation/kernel-parameters.txt
@@ -2138,6 +2138,16 @@ bytes respectively. Such letter suffixes
 		cbmemsize=nn[KMG]	The fixed amount of bus space which is
 				reserved for the CardBus bridge's memory
 				window. The default value is 64 megabytes.
+		hpiosize	The fixed amount of bus space which is
+				reserved for hotplug bridge's IO window.
+				The default value is 256 bytes.
+		hpmemsize	The fixed amount of bus space which is
+				reserved for hotplug bridge's memory window.
+				The default value is 2 megabytes.
+		hpbussize	The fixed amount of bus space which is
+				reserved for hotplug bridge's additional bus
+				number resources.
+				The default value is 0.
 		resource_alignment=
 				Format:
 				[<order of align>@][<domain>:]<bus>:<slot>.<func>[; ...]


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

* Re: [PATCH] pci: reserve extra bus number resource for hotplug bridge
  2012-07-02  4:49 [PATCH] pci: reserve extra bus number resource for hotplug bridge Taku Izumi
@ 2012-07-02 20:51 ` Yinghai Lu
  2012-07-03  8:33   ` Taku Izumi
  2012-07-04  3:15 ` [PATCH 1/2] pci: add missing document for hpiosize and hpmemsize option Taku Izumi
  2012-07-04  3:16 ` [PATCH 2/2] pci: reserve extra bus resource for hotplug bridge Taku Izumi
  2 siblings, 1 reply; 9+ messages in thread
From: Yinghai Lu @ 2012-07-02 20:51 UTC (permalink / raw)
  To: Taku Izumi; +Cc: linux-pci, Bjorn Helgaas, Kenji Kaneshige, Jiang Liu

On Sun, Jul 1, 2012 at 9:49 PM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
>
> Currently I/O ports and I/O memory resources are reserved for
> hotplug bridges and we can tune their size by using hpiosize
> and hpmemsize boot option.
>
> This patch extends feature so that we can reserve additional
> bus number resources for hotplug bridges and tune it by
> using "hpbussize" option.
>
> This patch also adds missing document for "hpiosize" and
> "hpmemsize" option.
>
> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> ---
>  Documentation/kernel-parameters.txt |   10 ++++++++++
>  drivers/pci/pci.c                   |    6 +++++-
>  drivers/pci/probe.c                 |    4 ++++
>  include/linux/pci.h                 |    1 +
>  4 files changed, 20 insertions(+), 1 deletion(-)
>
> Index: linux/drivers/pci/pci.c
> ===================================================================
> --- linux.orig/drivers/pci/pci.c
> +++ linux/drivers/pci/pci.c
> @@ -74,9 +74,11 @@ unsigned long pci_cardbus_mem_size = DEF
>
>  #define DEFAULT_HOTPLUG_IO_SIZE                (256)
>  #define DEFAULT_HOTPLUG_MEM_SIZE       (2*1024*1024)
> -/* pci=hpmemsize=nnM,hpiosize=nn can override this */
> +#define DEFAULT_HOTPLUG_BUS_SIZE       (0)
> +/* pci=hpmemsize=nnM,hpiosize=nn,hpbussize=n can override this */
>  unsigned long pci_hotplug_io_size  = DEFAULT_HOTPLUG_IO_SIZE;
>  unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
> +unsigned int pci_hotplug_bus_size = DEFAULT_HOTPLUG_BUS_SIZE;
>
>  enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF;
>
> @@ -3826,6 +3828,8 @@ static int __init pci_setup(char *str)
>                                 pci_hotplug_io_size = memparse(str + 9, &str);
>                         } else if (!strncmp(str, "hpmemsize=", 10)) {
>                                 pci_hotplug_mem_size = memparse(str + 10, &str);
> +                       } else if (!strncmp(str, "hpbussize=", 10)) {
> +                               pci_hotplug_bus_size = memparse(str + 10, &str);
>                         } else if (!strncmp(str, "pcie_bus_tune_off", 17)) {
>                                 pcie_bus_config = PCIE_BUS_TUNE_OFF;
>                         } else if (!strncmp(str, "pcie_bus_safe", 13)) {
> Index: linux/drivers/pci/probe.c
> ===================================================================
> --- linux.orig/drivers/pci/probe.c
> +++ linux/drivers/pci/probe.c
> @@ -865,6 +865,10 @@ int __devinit pci_scan_bridge(struct pci
>                 /*
>                  * Set the subordinate bus number to its real value.
>                  */
> +               if (dev->is_hotplug_bridge) {
> +                       if (max + pci_hotplug_bus_size < child->busn_res.end)
> +                               max += pci_hotplug_bus_size;
> +               }
>                 pci_bus_update_busn_res_end(child, max);
>                 pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
>         }
> Index: linux/include/linux/pci.h
> ===================================================================
> --- linux.orig/include/linux/pci.h
> +++ linux/include/linux/pci.h
> @@ -1517,6 +1517,7 @@ extern u8 pci_cache_line_size;
>
>  extern unsigned long pci_hotplug_io_size;
>  extern unsigned long pci_hotplug_mem_size;
> +extern unsigned int pci_hotplug_bus_size;
>
>  /* Architecture specific versions may override these (weak) */
>  int pcibios_add_platform_entries(struct pci_dev *dev);
> Index: linux/Documentation/kernel-parameters.txt
> ===================================================================
> --- linux.orig/Documentation/kernel-parameters.txt
> +++ linux/Documentation/kernel-parameters.txt
> @@ -2138,6 +2138,16 @@ bytes respectively. Such letter suffixes
>                 cbmemsize=nn[KMG]       The fixed amount of bus space which is
>                                 reserved for the CardBus bridge's memory
>                                 window. The default value is 64 megabytes.
> +               hpiosize        The fixed amount of bus space which is
> +                               reserved for hotplug bridge's IO window.
> +                               The default value is 256 bytes.
> +               hpmemsize       The fixed amount of bus space which is
> +                               reserved for hotplug bridge's memory window.
> +                               The default value is 2 megabytes.
> +               hpbussize       The fixed amount of bus space which is
> +                               reserved for hotplug bridge's additional bus
> +                               number resources.
> +                               The default value is 0.

at lease the patch should be split to two patches
1. one for hpiosize/hpmemsize paramater doc
2. one for new hpbussize

but we really should avoid adding those parameters if we can do that
automatically.

if you have test case, please check if busn_alloc branch would
increase the bus range automatically.

git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git
for-pci-busn-alloc


Thanks

Yinghai

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

* Re: [PATCH] pci: reserve extra bus number resource for hotplug bridge
  2012-07-02 20:51 ` Yinghai Lu
@ 2012-07-03  8:33   ` Taku Izumi
  2012-07-03 18:16     ` Yinghai Lu
  0 siblings, 1 reply; 9+ messages in thread
From: Taku Izumi @ 2012-07-03  8:33 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: linux-pci, Bjorn Helgaas, Kenji Kaneshige, Jiang Liu


Hi Yinghai,
Thank you for your comment.

On Mon, 2 Jul 2012 13:51:59 -0700
Yinghai Lu <yinghai@kernel.org> wrote:

> On Sun, Jul 1, 2012 at 9:49 PM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
> >
> > Currently I/O ports and I/O memory resources are reserved for
> > hotplug bridges and we can tune their size by using hpiosize
> > and hpmemsize boot option.
> >
> > This patch extends feature so that we can reserve additional
> > bus number resources for hotplug bridges and tune it by
> > using "hpbussize" option.
> >
> > This patch also adds missing document for "hpiosize" and
> > "hpmemsize" option.
> >
> > Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> > ---
> >  Documentation/kernel-parameters.txt |   10 ++++++++++
> >  drivers/pci/pci.c                   |    6 +++++-
> >  drivers/pci/probe.c                 |    4 ++++
> >  include/linux/pci.h                 |    1 +
> >  4 files changed, 20 insertions(+), 1 deletion(-)
> >
> > Index: linux/drivers/pci/pci.c
> > ===================================================================
> > --- linux.orig/drivers/pci/pci.c
> > +++ linux/drivers/pci/pci.c
> > @@ -74,9 +74,11 @@ unsigned long pci_cardbus_mem_size = DEF
> >
> >  #define DEFAULT_HOTPLUG_IO_SIZE                (256)
> >  #define DEFAULT_HOTPLUG_MEM_SIZE       (2*1024*1024)
> > -/* pci=hpmemsize=nnM,hpiosize=nn can override this */
> > +#define DEFAULT_HOTPLUG_BUS_SIZE       (0)
> > +/* pci=hpmemsize=nnM,hpiosize=nn,hpbussize=n can override this */
> >  unsigned long pci_hotplug_io_size  = DEFAULT_HOTPLUG_IO_SIZE;
> >  unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
> > +unsigned int pci_hotplug_bus_size = DEFAULT_HOTPLUG_BUS_SIZE;
> >
> >  enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF;
> >
> > @@ -3826,6 +3828,8 @@ static int __init pci_setup(char *str)
> >                                 pci_hotplug_io_size = memparse(str + 9, &str);
> >                         } else if (!strncmp(str, "hpmemsize=", 10)) {
> >                                 pci_hotplug_mem_size = memparse(str + 10, &str);
> > +                       } else if (!strncmp(str, "hpbussize=", 10)) {
> > +                               pci_hotplug_bus_size = memparse(str + 10, &str);
> >                         } else if (!strncmp(str, "pcie_bus_tune_off", 17)) {
> >                                 pcie_bus_config = PCIE_BUS_TUNE_OFF;
> >                         } else if (!strncmp(str, "pcie_bus_safe", 13)) {
> > Index: linux/drivers/pci/probe.c
> > ===================================================================
> > --- linux.orig/drivers/pci/probe.c
> > +++ linux/drivers/pci/probe.c
> > @@ -865,6 +865,10 @@ int __devinit pci_scan_bridge(struct pci
> >                 /*
> >                  * Set the subordinate bus number to its real value.
> >                  */
> > +               if (dev->is_hotplug_bridge) {
> > +                       if (max + pci_hotplug_bus_size < child->busn_res.end)
> > +                               max += pci_hotplug_bus_size;
> > +               }
> >                 pci_bus_update_busn_res_end(child, max);
> >                 pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
> >         }
> > Index: linux/include/linux/pci.h
> > ===================================================================
> > --- linux.orig/include/linux/pci.h
> > +++ linux/include/linux/pci.h
> > @@ -1517,6 +1517,7 @@ extern u8 pci_cache_line_size;
> >
> >  extern unsigned long pci_hotplug_io_size;
> >  extern unsigned long pci_hotplug_mem_size;
> > +extern unsigned int pci_hotplug_bus_size;
> >
> >  /* Architecture specific versions may override these (weak) */
> >  int pcibios_add_platform_entries(struct pci_dev *dev);
> > Index: linux/Documentation/kernel-parameters.txt
> > ===================================================================
> > --- linux.orig/Documentation/kernel-parameters.txt
> > +++ linux/Documentation/kernel-parameters.txt
> > @@ -2138,6 +2138,16 @@ bytes respectively. Such letter suffixes
> >                 cbmemsize=nn[KMG]       The fixed amount of bus space which is
> >                                 reserved for the CardBus bridge's memory
> >                                 window. The default value is 64 megabytes.
> > +               hpiosize        The fixed amount of bus space which is
> > +                               reserved for hotplug bridge's IO window.
> > +                               The default value is 256 bytes.
> > +               hpmemsize       The fixed amount of bus space which is
> > +                               reserved for hotplug bridge's memory window.
> > +                               The default value is 2 megabytes.
> > +               hpbussize       The fixed amount of bus space which is
> > +                               reserved for hotplug bridge's additional bus
> > +                               number resources.
> > +                               The default value is 0.
> 
> at lease the patch should be split to two patches
> 1. one for hpiosize/hpmemsize paramater doc
> 2. one for new hpbussize

  I'll sprit this into two parts.

> but we really should avoid adding those parameters if we can do that
> automatically.

  I don't think this feature conflicts with your feature.
  Even if we can reallocate bus number automatically, I'd like to
  avoid that situation preferably, so I'd like to keep bus number 
  resource for hotplug bridge in advance.

  Can't you agree with me?

> if you have test case, please check if busn_alloc branch would
> increase the bus range automatically.
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git
> for-pci-busn-alloc
> 
> 
> Thanks
> 
> Yinghai
> 

Best regards,
Taku Izumi


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

* Re: [PATCH] pci: reserve extra bus number resource for hotplug bridge
  2012-07-03  8:33   ` Taku Izumi
@ 2012-07-03 18:16     ` Yinghai Lu
  2012-07-04  3:13       ` Taku Izumi
  0 siblings, 1 reply; 9+ messages in thread
From: Yinghai Lu @ 2012-07-03 18:16 UTC (permalink / raw)
  To: Taku Izumi; +Cc: linux-pci, Bjorn Helgaas, Kenji Kaneshige, Jiang Liu

On Tue, Jul 3, 2012 at 1:33 AM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
>
> Hi Yinghai,
> Thank you for your comment.
>
> On Mon, 2 Jul 2012 13:51:59 -0700
> Yinghai Lu <yinghai@kernel.org> wrote:
>
>> On Sun, Jul 1, 2012 at 9:49 PM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
>> >
>> > Currently I/O ports and I/O memory resources are reserved for
>> > hotplug bridges and we can tune their size by using hpiosize
>> > and hpmemsize boot option.
>> >
>> > This patch extends feature so that we can reserve additional
>> > bus number resources for hotplug bridges and tune it by
>> > using "hpbussize" option.
>> >
>> > This patch also adds missing document for "hpiosize" and
>> > "hpmemsize" option.
>> >
>> > Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
>> > ---
>> >  Documentation/kernel-parameters.txt |   10 ++++++++++
>> >  drivers/pci/pci.c                   |    6 +++++-
>> >  drivers/pci/probe.c                 |    4 ++++
>> >  include/linux/pci.h                 |    1 +
>> >  4 files changed, 20 insertions(+), 1 deletion(-)
>> >
>> > Index: linux/drivers/pci/pci.c
>> > ===================================================================
>> > --- linux.orig/drivers/pci/pci.c
>> > +++ linux/drivers/pci/pci.c
>> > Index: linux/drivers/pci/probe.c
>> > ===================================================================
>> > --- linux.orig/drivers/pci/probe.c
>> > +++ linux/drivers/pci/probe.c
>> > @@ -865,6 +865,10 @@ int __devinit pci_scan_bridge(struct pci
>> >                 /*
>> >                  * Set the subordinate bus number to its real value.
>> >                  */
>> > +               if (dev->is_hotplug_bridge) {
>> > +                       if (max + pci_hotplug_bus_size < child->busn_res.end)
>> > +                               max += pci_hotplug_bus_size;
>> > +               }
>> >                 pci_bus_update_busn_res_end(child, max);
>> >                 pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
...
>   I don't think this feature conflicts with your feature.
>   Even if we can reallocate bus number automatically, I'd like to
>   avoid that situation preferably, so I'd like to keep bus number
>   resource for hotplug bridge in advance.
>
>   Can't you agree with me?
>

that add may not be safe, before busn_alloc patchset, that
busn_res.end should be 0xff.
so you add extra bus range that could overlap other bridge.

after busn_alloc patchset:

                /*
                 * Set the subordinate bus number to its real value.
                 */
                if (dev->is_hotplug_bridge && child->busn_res.end > max &&
                   (max - child->busn_res.start) < HOTPLUG_BRIDGE_RESERVE_BUSNR)
                        max = min_t(int, child->busn_res.start +
                                         HOTPLUG_BRIDGE_RESERVE_BUSNR,
                                    child->busn_res.end);
                shrink_size = (int)child->busn_res.end - max;
                pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
                pci_bus_update_busn_res_end(child, max);

and it will try to shrink less to preserve more space for later usage.
now

#define HOTPLUG_BRIDGE_RESERVE_BUSNR 8

so I assume that you want that value to be changeable via command line?

Thanks

Yinghai

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

* Re: [PATCH] pci: reserve extra bus number resource for hotplug bridge
  2012-07-03 18:16     ` Yinghai Lu
@ 2012-07-04  3:13       ` Taku Izumi
  0 siblings, 0 replies; 9+ messages in thread
From: Taku Izumi @ 2012-07-04  3:13 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: linux-pci, Bjorn Helgaas, Kenji Kaneshige, Jiang Liu

On Tue, 3 Jul 2012 11:16:45 -0700
Yinghai Lu <yinghai@kernel.org> wrote:

> On Tue, Jul 3, 2012 at 1:33 AM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
> >
> > Hi Yinghai,
> > Thank you for your comment.
> >
> > On Mon, 2 Jul 2012 13:51:59 -0700
> > Yinghai Lu <yinghai@kernel.org> wrote:
> >
> >> On Sun, Jul 1, 2012 at 9:49 PM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
> >> >
> >> > Currently I/O ports and I/O memory resources are reserved for
> >> > hotplug bridges and we can tune their size by using hpiosize
> >> > and hpmemsize boot option.
> >> >
> >> > This patch extends feature so that we can reserve additional
> >> > bus number resources for hotplug bridges and tune it by
> >> > using "hpbussize" option.
> >> >
> >> > This patch also adds missing document for "hpiosize" and
> >> > "hpmemsize" option.
> >> >
> >> > Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> >> > ---
> >> >  Documentation/kernel-parameters.txt |   10 ++++++++++
> >> >  drivers/pci/pci.c                   |    6 +++++-
> >> >  drivers/pci/probe.c                 |    4 ++++
> >> >  include/linux/pci.h                 |    1 +
> >> >  4 files changed, 20 insertions(+), 1 deletion(-)
> >> >
> >> > Index: linux/drivers/pci/pci.c
> >> > ===================================================================
> >> > --- linux.orig/drivers/pci/pci.c
> >> > +++ linux/drivers/pci/pci.c
> >> > Index: linux/drivers/pci/probe.c
> >> > ===================================================================
> >> > --- linux.orig/drivers/pci/probe.c
> >> > +++ linux/drivers/pci/probe.c
> >> > @@ -865,6 +865,10 @@ int __devinit pci_scan_bridge(struct pci
> >> >                 /*
> >> >                  * Set the subordinate bus number to its real value.
> >> >                  */
> >> > +               if (dev->is_hotplug_bridge) {
> >> > +                       if (max + pci_hotplug_bus_size < child->busn_res.end)
> >> > +                               max += pci_hotplug_bus_size;
> >> > +               }
> >> >                 pci_bus_update_busn_res_end(child, max);
> >> >                 pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
> ...
> >   I don't think this feature conflicts with your feature.
> >   Even if we can reallocate bus number automatically, I'd like to
> >   avoid that situation preferably, so I'd like to keep bus number
> >   resource for hotplug bridge in advance.
> >
> >   Can't you agree with me?
> >
> 
> that add may not be safe, before busn_alloc patchset, that
> busn_res.end should be 0xff.
> so you add extra bus range that could overlap other bridge.
> 
> after busn_alloc patchset:
> 
>                 /*
>                  * Set the subordinate bus number to its real value.
>                  */
>                 if (dev->is_hotplug_bridge && child->busn_res.end > max &&
>                    (max - child->busn_res.start) < HOTPLUG_BRIDGE_RESERVE_BUSNR)
>                         max = min_t(int, child->busn_res.start +
>                                          HOTPLUG_BRIDGE_RESERVE_BUSNR,
>                                     child->busn_res.end);
>                 shrink_size = (int)child->busn_res.end - max;
>                 pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
>                 pci_bus_update_busn_res_end(child, max);
> 
> and it will try to shrink less to preserve more space for later usage.
> now
> 
> #define HOTPLUG_BRIDGE_RESERVE_BUSNR 8
> 
> so I assume that you want that value to be changeable via command line?

 Yes. After busn_alloc patchset is merged, "hpbussize" option should work 
 as you said.

-- 
Taku Izumi <izumi.taku@jp.fujitsu.com>


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

* [PATCH 1/2] pci: add missing document for hpiosize and hpmemsize option
  2012-07-02  4:49 [PATCH] pci: reserve extra bus number resource for hotplug bridge Taku Izumi
  2012-07-02 20:51 ` Yinghai Lu
@ 2012-07-04  3:15 ` Taku Izumi
  2012-07-04  3:16 ` [PATCH 2/2] pci: reserve extra bus resource for hotplug bridge Taku Izumi
  2 siblings, 0 replies; 9+ messages in thread
From: Taku Izumi @ 2012-07-04  3:15 UTC (permalink / raw)
  To: Taku Izumi
  Cc: linux-pci, Bjorn Helgaas, Kenji Kaneshige, Yinghai Lu, Jiang Liu


This patch adds missinc document for "hpiosize" and "hpmemsize"
option.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
---
 Documentation/kernel-parameters.txt |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux/Documentation/kernel-parameters.txt
===================================================================
--- linux.orig/Documentation/kernel-parameters.txt	2012-06-26 14:37:24.000000000 +0900
+++ linux/Documentation/kernel-parameters.txt	2012-07-04 10:00:58.822901307 +0900
@@ -2168,6 +2168,12 @@ bytes respectively. Such letter suffixes
 		cbmemsize=nn[KMG]	The fixed amount of bus space which is
 				reserved for the CardBus bridge's memory
 				window. The default value is 64 megabytes.
+		hpiosize	The fixed amount of bus space which is
+				reserved for hotplug bridge's IO window.
+				The default value is 256 bytes.
+		hpmemsize	The fixed amount of bus space which is
+				reserved for hotplug bridge's memory window.
+				The default value is 2 megabytes.
 		resource_alignment=
 				Format:
 				[<order of align>@][<domain>:]<bus>:<slot>.<func>[; ...]


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

* [PATCH 2/2] pci: reserve extra bus resource for hotplug bridge
  2012-07-02  4:49 [PATCH] pci: reserve extra bus number resource for hotplug bridge Taku Izumi
  2012-07-02 20:51 ` Yinghai Lu
  2012-07-04  3:15 ` [PATCH 1/2] pci: add missing document for hpiosize and hpmemsize option Taku Izumi
@ 2012-07-04  3:16 ` Taku Izumi
  2012-07-04  4:06   ` Yinghai Lu
  2 siblings, 1 reply; 9+ messages in thread
From: Taku Izumi @ 2012-07-04  3:16 UTC (permalink / raw)
  To: Taku Izumi
  Cc: linux-pci, Bjorn Helgaas, Kenji Kaneshige, Yinghai Lu, Jiang Liu


Currently I/O ports and I/O memory resources are reserved for
hotplug bridges and we can tune their size by using hpiosize
and hpmemsize boot option. 

This patch extends feature so that we can reserve additional 
bus number resources for hotplug bridges and tune it by 
using "hpbussize" option.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
---
 Documentation/kernel-parameters.txt |    4 ++++
 drivers/pci/pci.c                   |    6 +++++-
 drivers/pci/probe.c                 |    4 ++++
 include/linux/pci.h                 |    1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

Index: linux/drivers/pci/pci.c
===================================================================
--- linux.orig/drivers/pci/pci.c	2012-06-26 14:37:22.000000000 +0900
+++ linux/drivers/pci/pci.c	2012-07-04 10:00:50.708002757 +0900
@@ -74,9 +74,11 @@ unsigned long pci_cardbus_mem_size = DEF
 
 #define DEFAULT_HOTPLUG_IO_SIZE		(256)
 #define DEFAULT_HOTPLUG_MEM_SIZE	(2*1024*1024)
-/* pci=hpmemsize=nnM,hpiosize=nn can override this */
+#define DEFAULT_HOTPLUG_BUS_SIZE	(0)
+/* pci=hpmemsize=nnM,hpiosize=nn,hpbussize=n can override this */
 unsigned long pci_hotplug_io_size  = DEFAULT_HOTPLUG_IO_SIZE;
 unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
+unsigned int pci_hotplug_bus_size = DEFAULT_HOTPLUG_BUS_SIZE;
 
 enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF;
 
@@ -4022,6 +4024,8 @@ static int __init pci_setup(char *str)
 				pci_hotplug_io_size = memparse(str + 9, &str);
 			} else if (!strncmp(str, "hpmemsize=", 10)) {
 				pci_hotplug_mem_size = memparse(str + 10, &str);
+			} else if (!strncmp(str, "hpbussize=", 10)) {
+				pci_hotplug_bus_size = memparse(str + 10, &str);
 			} else if (!strncmp(str, "pcie_bus_tune_off", 17)) {
 				pcie_bus_config = PCIE_BUS_TUNE_OFF;
 			} else if (!strncmp(str, "pcie_bus_safe", 13)) {
Index: linux/drivers/pci/probe.c
===================================================================
--- linux.orig/drivers/pci/probe.c	2012-06-26 14:37:22.000000000 +0900
+++ linux/drivers/pci/probe.c	2012-07-04 10:00:50.718002632 +0900
@@ -867,6 +867,10 @@ int __devinit pci_scan_bridge(struct pci
 		/*
 		 * Set the subordinate bus number to its real value.
 		 */
+		if (dev->is_hotplug_bridge) {
+			if (max + pci_hotplug_bus_size < child->busn_res.end)
+				max += pci_hotplug_bus_size;
+		}
 		pci_bus_update_busn_res_end(child, max);
 		pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
 	}
Index: linux/include/linux/pci.h
===================================================================
--- linux.orig/include/linux/pci.h	2012-07-04 09:59:43.321845252 +0900
+++ linux/include/linux/pci.h	2012-07-04 10:00:50.725002545 +0900
@@ -1573,6 +1573,7 @@ extern u8 pci_cache_line_size;
 
 extern unsigned long pci_hotplug_io_size;
 extern unsigned long pci_hotplug_mem_size;
+extern unsigned int pci_hotplug_bus_size;
 
 /* Architecture specific versions may override these (weak) */
 int pcibios_add_platform_entries(struct pci_dev *dev);
Index: linux/Documentation/kernel-parameters.txt
===================================================================
--- linux.orig/Documentation/kernel-parameters.txt	2012-07-04 10:00:34.401206673 +0900
+++ linux/Documentation/kernel-parameters.txt	2012-07-04 10:00:50.729002493 +0900
@@ -2174,6 +2174,10 @@ bytes respectively. Such letter suffixes
 		hpmemsize	The fixed amount of bus space which is
 				reserved for hotplug bridge's memory window.
 				The default value is 2 megabytes.
+		hpbussize	The fixed amount of bus space which is
+				reserved for hotplug bridge's additional bus
+				number resources.
+				The default value is 0.
 		resource_alignment=
 				Format:
 				[<order of align>@][<domain>:]<bus>:<slot>.<func>[; ...]


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

* Re: [PATCH 2/2] pci: reserve extra bus resource for hotplug bridge
  2012-07-04  3:16 ` [PATCH 2/2] pci: reserve extra bus resource for hotplug bridge Taku Izumi
@ 2012-07-04  4:06   ` Yinghai Lu
  2012-07-06 11:30     ` Taku Izumi
  0 siblings, 1 reply; 9+ messages in thread
From: Yinghai Lu @ 2012-07-04  4:06 UTC (permalink / raw)
  To: Taku Izumi; +Cc: linux-pci, Bjorn Helgaas, Kenji Kaneshige, Jiang Liu

On Tue, Jul 3, 2012 at 8:16 PM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
>
> Currently I/O ports and I/O memory resources are reserved for
> hotplug bridges and we can tune their size by using hpiosize
> and hpmemsize boot option.
>
> This patch extends feature so that we can reserve additional
> bus number resources for hotplug bridges and tune it by
> using "hpbussize" option.
>
> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> ---
>  Documentation/kernel-parameters.txt |    4 ++++
>  drivers/pci/pci.c                   |    6 +++++-
>  drivers/pci/probe.c                 |    4 ++++
>  include/linux/pci.h                 |    1 +
>  4 files changed, 14 insertions(+), 1 deletion(-)
>
> Index: linux/drivers/pci/pci.c
> ===================================================================
> --- linux.orig/drivers/pci/pci.c        2012-06-26 14:37:22.000000000 +0900
> +++ linux/drivers/pci/pci.c     2012-07-04 10:00:50.708002757 +0900
> @@ -74,9 +74,11 @@ unsigned long pci_cardbus_mem_size = DEF
>
>  #define DEFAULT_HOTPLUG_IO_SIZE                (256)
>  #define DEFAULT_HOTPLUG_MEM_SIZE       (2*1024*1024)
> -/* pci=hpmemsize=nnM,hpiosize=nn can override this */
> +#define DEFAULT_HOTPLUG_BUS_SIZE       (0)
> +/* pci=hpmemsize=nnM,hpiosize=nn,hpbussize=n can override this */
>  unsigned long pci_hotplug_io_size  = DEFAULT_HOTPLUG_IO_SIZE;
>  unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
> +unsigned int pci_hotplug_bus_size = DEFAULT_HOTPLUG_BUS_SIZE;
>
>  enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF;
>
> @@ -4022,6 +4024,8 @@ static int __init pci_setup(char *str)
>                                 pci_hotplug_io_size = memparse(str + 9, &str);
>                         } else if (!strncmp(str, "hpmemsize=", 10)) {
>                                 pci_hotplug_mem_size = memparse(str + 10, &str);
> +                       } else if (!strncmp(str, "hpbussize=", 10)) {
> +                               pci_hotplug_bus_size = memparse(str + 10, &str);
>                         } else if (!strncmp(str, "pcie_bus_tune_off", 17)) {
>                                 pcie_bus_config = PCIE_BUS_TUNE_OFF;
>                         } else if (!strncmp(str, "pcie_bus_safe", 13)) {
> Index: linux/drivers/pci/probe.c
> ===================================================================
> --- linux.orig/drivers/pci/probe.c      2012-06-26 14:37:22.000000000 +0900
> +++ linux/drivers/pci/probe.c   2012-07-04 10:00:50.718002632 +0900
> @@ -867,6 +867,10 @@ int __devinit pci_scan_bridge(struct pci
>                 /*
>                  * Set the subordinate bus number to its real value.
>                  */
> +               if (dev->is_hotplug_bridge) {
> +                       if (max + pci_hotplug_bus_size < child->busn_res.end)
> +                               max += pci_hotplug_bus_size;
> +               }

again, that adding is not safe.

please drop this one now.

or you can prepare one against busn_alloc and I put new version in the
busn_alloc branch.

Thanks

Yinghai

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

* Re: [PATCH 2/2] pci: reserve extra bus resource for hotplug bridge
  2012-07-04  4:06   ` Yinghai Lu
@ 2012-07-06 11:30     ` Taku Izumi
  0 siblings, 0 replies; 9+ messages in thread
From: Taku Izumi @ 2012-07-06 11:30 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: linux-pci, Bjorn Helgaas, Kenji Kaneshige, Jiang Liu

On Tue, 3 Jul 2012 21:06:53 -0700
Yinghai Lu <yinghai@kernel.org> wrote:

> On Tue, Jul 3, 2012 at 8:16 PM, Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
> >
> > Currently I/O ports and I/O memory resources are reserved for
> > hotplug bridges and we can tune their size by using hpiosize
> > and hpmemsize boot option.
> >
> > This patch extends feature so that we can reserve additional
> > bus number resources for hotplug bridges and tune it by
> > using "hpbussize" option.
> >
> > Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> > ---
> >  Documentation/kernel-parameters.txt |    4 ++++
> >  drivers/pci/pci.c                   |    6 +++++-
> >  drivers/pci/probe.c                 |    4 ++++
> >  include/linux/pci.h                 |    1 +
> >  4 files changed, 14 insertions(+), 1 deletion(-)
> >
> > Index: linux/drivers/pci/pci.c
> > ===================================================================
> > --- linux.orig/drivers/pci/pci.c        2012-06-26 14:37:22.000000000 +0900
> > +++ linux/drivers/pci/pci.c     2012-07-04 10:00:50.708002757 +0900
> > @@ -74,9 +74,11 @@ unsigned long pci_cardbus_mem_size = DEF
> >
> >  #define DEFAULT_HOTPLUG_IO_SIZE                (256)
> >  #define DEFAULT_HOTPLUG_MEM_SIZE       (2*1024*1024)
> > -/* pci=hpmemsize=nnM,hpiosize=nn can override this */
> > +#define DEFAULT_HOTPLUG_BUS_SIZE       (0)
> > +/* pci=hpmemsize=nnM,hpiosize=nn,hpbussize=n can override this */
> >  unsigned long pci_hotplug_io_size  = DEFAULT_HOTPLUG_IO_SIZE;
> >  unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE;
> > +unsigned int pci_hotplug_bus_size = DEFAULT_HOTPLUG_BUS_SIZE;
> >
> >  enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_TUNE_OFF;
> >
> > @@ -4022,6 +4024,8 @@ static int __init pci_setup(char *str)
> >                                 pci_hotplug_io_size = memparse(str + 9, &str);
> >                         } else if (!strncmp(str, "hpmemsize=", 10)) {
> >                                 pci_hotplug_mem_size = memparse(str + 10, &str);
> > +                       } else if (!strncmp(str, "hpbussize=", 10)) {
> > +                               pci_hotplug_bus_size = memparse(str + 10, &str);
> >                         } else if (!strncmp(str, "pcie_bus_tune_off", 17)) {
> >                                 pcie_bus_config = PCIE_BUS_TUNE_OFF;
> >                         } else if (!strncmp(str, "pcie_bus_safe", 13)) {
> > Index: linux/drivers/pci/probe.c
> > ===================================================================
> > --- linux.orig/drivers/pci/probe.c      2012-06-26 14:37:22.000000000 +0900
> > +++ linux/drivers/pci/probe.c   2012-07-04 10:00:50.718002632 +0900
> > @@ -867,6 +867,10 @@ int __devinit pci_scan_bridge(struct pci
> >                 /*
> >                  * Set the subordinate bus number to its real value.
> >                  */
> > +               if (dev->is_hotplug_bridge) {
> > +                       if (max + pci_hotplug_bus_size < child->busn_res.end)
> > +                               max += pci_hotplug_bus_size;
> > +               }
> 
> again, that adding is not safe.
> 
> please drop this one now.
>
> or you can prepare one against busn_alloc and I put new version in the
> busn_alloc branch.

 OK, I'll do it. 


Best regards,
Taku Izumi <izumi.taku@jp.fujitsu.com>


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

end of thread, other threads:[~2012-07-06 11:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-02  4:49 [PATCH] pci: reserve extra bus number resource for hotplug bridge Taku Izumi
2012-07-02 20:51 ` Yinghai Lu
2012-07-03  8:33   ` Taku Izumi
2012-07-03 18:16     ` Yinghai Lu
2012-07-04  3:13       ` Taku Izumi
2012-07-04  3:15 ` [PATCH 1/2] pci: add missing document for hpiosize and hpmemsize option Taku Izumi
2012-07-04  3:16 ` [PATCH 2/2] pci: reserve extra bus resource for hotplug bridge Taku Izumi
2012-07-04  4:06   ` Yinghai Lu
2012-07-06 11:30     ` Taku Izumi

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.