2012-05-14 01:55:51

by Wei Yang

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Mon, Apr 23, 2012 at 03:46:03PM -0400, Don Dutile wrote:
>On 04/22/2012 11:52 AM, Richard Yang wrote:
>>All,
>>
>>I am reading the pci_scan_bridge() and not sure what will happen in
>>following situation.
>>
>>Suppose the kernel is not passed the pci=assign-busses.
>>
>>Below is a picture about the pci system.
>>
>> +-------+
>> | | root bridge(0,255)
>> +---+---+
>> | Bus 0
>> -----+-----------+------------------------------+--
>> | |
>> | |
>> | |
>> +----+----+ +-----+-----+
>> | | B1(1,15) | |B2(16,28)
>> +----+----+ +-----+-----+
>> | Bus 1 | Bus 16
>> -----+----------------------- ----------+----------------
>> |
>> +----+----+
>> | | B3
>> +---------+
>>
>>Suppose B1 and B2 works fine with the BIOS, which get the right bus
>>number and range.
>>
>>B3 does not works fine with the BIOS, which doesn't get the bus number.
>>
>>So in pci_scan_bridge(), B3 will be met in the second pass and get bus
>>number 16?
>
Yinghai,

Take my original question.

B3 doesn't get the bus number, which its parent doesn't have free bus
number and there is no gap between B1 and B2.

So in this case, the probe_resource() can't find bus number for B3.
Then cause pci_bridge_probe_busn_res() return non-zero.

Then B3 couldn't work fine?

--
Richard Yang
Help you, Help me


2012-05-14 05:40:50

by Yinghai Lu

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Sun, May 13, 2012 at 6:55 PM, Richard Yang
<[email protected]> wrote:
> On Mon, Apr 23, 2012 at 03:46:03PM -0400, Don Dutile wrote:
>>On 04/22/2012 11:52 AM, Richard Yang wrote:
>>>All,
>>>
>>>I am reading the pci_scan_bridge() and not sure what will happen in
>>>following situation.
>>>
>>>Suppose the kernel is not passed the pci=assign-busses.
>>>
>>>Below is a picture about the pci system.
>>>
>>> ? ? ? ? ? ? ? ? ? ?+-------+
>>> ? ? ? ? ? ? ? ? ? ?| ? ? ? | root bridge(0,255)
>>> ? ? ? ? ? ? ? ? ? ?+---+---+
>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? ?Bus 0
>>> ? ? ? -----+-----------+------------------------------+--
>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>> ? ? ? | ? ? ? ? | ?B1(1,15) ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? |B2(16,28)
>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>> ? ? ? ? ? ?| ?Bus 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?Bus 16
>>> ? ? ? -----+----------------------- ? ? ? ? ----------+----------------
>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
>>> ? ? ? ? ? ? ? ? ? ? ? ?+----+----+
>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? | B3
>>> ? ? ? ? ? ? ? ? ? ? ? ?+---------+
>>>
>>>Suppose B1 and B2 works fine with the BIOS, which get the right bus
>>>number and range.
>>>
>>>B3 does not works fine with the BIOS, which doesn't get the bus number.
>>>
>>>So in pci_scan_bridge(), B3 will be met in the second pass and get bus
>>>number 16?
>>
> Yinghai,
>
> Take my original question.
>
> B3 doesn't get the bus number, which its parent doesn't have free bus
> number and there is no gap between B1 and B2.
>
> So in this case, the probe_resource() can't find bus number for B3.
> Then cause pci_bridge_probe_busn_res() return non-zero.
>
> Then B3 couldn't work fine?

B3 is on Bus 1? B3 is the one of bridges on Bus1?

if B3 is only bridge on Bus1, it probe_resource should return [2,15]
at first, and then scan B3.

Yinghai

2012-05-14 06:46:24

by Wei Yang

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Sun, May 13, 2012 at 10:40:41PM -0700, Yinghai Lu wrote:
>On Sun, May 13, 2012 at 6:55 PM, Richard Yang
><[email protected]> wrote:
>> On Mon, Apr 23, 2012 at 03:46:03PM -0400, Don Dutile wrote:
>>>On 04/22/2012 11:52 AM, Richard Yang wrote:
>>>>All,
>>>>
>>>>I am reading the pci_scan_bridge() and not sure what will happen in
>>>>following situation.
>>>>
>>>>Suppose the kernel is not passed the pci=assign-busses.
>>>>
>>>>Below is a picture about the pci system.
>>>>
>>>> ? ? ? ? ? ? ? ? ? ?+-------+
>>>> ? ? ? ? ? ? ? ? ? ?| ? ? ? | root bridge(0,255)
>>>> ? ? ? ? ? ? ? ? ? ?+---+---+
>>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? ?Bus 0
>>>> ? ? ? -----+-----------+------------------------------+--
>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>>> ? ? ? | ? ? ? ? | ?B1(1,15) ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? |B2(16,28)
>>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>>> ? ? ? ? ? ?| ?Bus 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?Bus 16
>>>> ? ? ? -----+----------------------- ? ? ? ? ----------+----------------
>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
>>>> ? ? ? ? ? ? ? ? ? ? ? ?+----+----+
>>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? | B3
>>>> ? ? ? ? ? ? ? ? ? ? ? ?+---------+
>>>>
>>>>Suppose B1 and B2 works fine with the BIOS, which get the right bus
>>>>number and range.
>>>>
>>>>B3 does not works fine with the BIOS, which doesn't get the bus number.
>>>>
>>>>So in pci_scan_bridge(), B3 will be met in the second pass and get bus
>>>>number 16?
>>>
>> Yinghai,
>>
>> Take my original question.
>>
>> B3 doesn't get the bus number, which its parent doesn't have free bus
>> number and there is no gap between B1 and B2.
>>
>> So in this case, the probe_resource() can't find bus number for B3.
>> Then cause pci_bridge_probe_busn_res() return non-zero.
>>
>> Then B3 couldn't work fine?
>
>B3 is on Bus 1? B3 is the one of bridges on Bus1?
No, I omit other bridges on Bus#1.
They will occupy bus number 2-15, which is calculated by BIOS and set to
bridge's configuration space.
>
>if B3 is only bridge on Bus1, it probe_resource should return [2,15]
>at first, and then scan B3.
>
>Yinghai

--
Richard Yang
Help you, Help me

2012-05-15 17:32:48

by Yinghai Lu

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Sun, May 13, 2012 at 11:46 PM, Richard Yang
<[email protected]> wrote:
> On Sun, May 13, 2012 at 10:40:41PM -0700, Yinghai Lu wrote:
>>On Sun, May 13, 2012 at 6:55 PM, Richard Yang
>><[email protected]> wrote:
>>> On Mon, Apr 23, 2012 at 03:46:03PM -0400, Don Dutile wrote:
>>>>On 04/22/2012 11:52 AM, Richard Yang wrote:
>>>>>All,
>>>>>
>>>>>I am reading the pci_scan_bridge() and not sure what will happen in
>>>>>following situation.
>>>>>
>>>>>Suppose the kernel is not passed the pci=assign-busses.
>>>>>
>>>>>Below is a picture about the pci system.
>>>>>
>>>>> ? ? ? ? ? ? ? ? ? ?+-------+
>>>>> ? ? ? ? ? ? ? ? ? ?| ? ? ? | root bridge(0,255)
>>>>> ? ? ? ? ? ? ? ? ? ?+---+---+
>>>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? ?Bus 0
>>>>> ? ? ? -----+-----------+------------------------------+--
>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>>>> ? ? ? | ? ? ? ? | ?B1(1,15) ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? |B2(16,28)
>>>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>>>> ? ? ? ? ? ?| ?Bus 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?Bus 16
>>>>> ? ? ? -----+----------------------- ? ? ? ? ----------+----------------
>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
>>>>> ? ? ? ? ? ? ? ? ? ? ? ?+----+----+
>>>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? | B3
>>>>> ? ? ? ? ? ? ? ? ? ? ? ?+---------+
>>>>>
>>>>>Suppose B1 and B2 works fine with the BIOS, which get the right bus
>>>>>number and range.
>>>>>
>>>>>B3 does not works fine with the BIOS, which doesn't get the bus number.
>>>>>
>>> Take my original question.
>>>
>>> B3 doesn't get the bus number, which its parent doesn't have free bus
>>> number and there is no gap between B1 and B2.
>>>
>>> So in this case, the probe_resource() can't find bus number for B3.
>>> Then cause pci_bridge_probe_busn_res() return non-zero.
>>>
>>> Then B3 couldn't work fine?
>>
>>B3 is on Bus 1? B3 is the one of bridges on Bus1?
> No, ?I omit other bridges on Bus#1.
> They will occupy bus number 2-15, which is calculated by BIOS and set to
> bridge's configuration space.

with that new condition, probe_resource will return zero.

for those kind of case:
1. use echo 1 > /sys .../remove to remove devices under Bridge2.
2. use setpci to change bus register of bridge2 to move high to make
more space for bridge 1.
3. rescan bridge 1 and bridge 2.

Yinghai

2012-05-16 01:18:44

by Wei Yang

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Tue, May 15, 2012 at 10:32:46AM -0700, Yinghai Lu wrote:
>On Sun, May 13, 2012 at 11:46 PM, Richard Yang
><[email protected]> wrote:
>> On Sun, May 13, 2012 at 10:40:41PM -0700, Yinghai Lu wrote:
>>>On Sun, May 13, 2012 at 6:55 PM, Richard Yang
>>><[email protected]> wrote:
>>>> On Mon, Apr 23, 2012 at 03:46:03PM -0400, Don Dutile wrote:
>>>>>On 04/22/2012 11:52 AM, Richard Yang wrote:
>>>>>>All,
>>>>>>
>>>>>>I am reading the pci_scan_bridge() and not sure what will happen in
>>>>>>following situation.
>>>>>>
>>>>>>Suppose the kernel is not passed the pci=assign-busses.
>>>>>>
>>>>>>Below is a picture about the pci system.
>>>>>>
>>>>>> ? ? ? ? ? ? ? ? ? ?+-------+
>>>>>> ? ? ? ? ? ? ? ? ? ?| ? ? ? | root bridge(0,255)
>>>>>> ? ? ? ? ? ? ? ? ? ?+---+---+
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? ?Bus 0
>>>>>> ? ? ? -----+-----------+------------------------------+--
>>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>>>>> ? ? ? | ? ? ? ? | ?B1(1,15) ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? |B2(16,28)
>>>>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>>>>> ? ? ? ? ? ?| ?Bus 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?Bus 16
>>>>>> ? ? ? -----+----------------------- ? ? ? ? ----------+----------------
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ?+----+----+
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? | B3
>>>>>> ? ? ? ? ? ? ? ? ? ? ? ?+---------+
>>>>>>
>>>>>>Suppose B1 and B2 works fine with the BIOS, which get the right bus
>>>>>>number and range.
>>>>>>
>>>>>>B3 does not works fine with the BIOS, which doesn't get the bus number.
>>>>>>
>>>> Take my original question.
>>>>
>>>> B3 doesn't get the bus number, which its parent doesn't have free bus
>>>> number and there is no gap between B1 and B2.
>>>>
>>>> So in this case, the probe_resource() can't find bus number for B3.
>>>> Then cause pci_bridge_probe_busn_res() return non-zero.
>>>>
>>>> Then B3 couldn't work fine?
>>>
>>>B3 is on Bus 1? B3 is the one of bridges on Bus1?
>> No, ?I omit other bridges on Bus#1.
>> They will occupy bus number 2-15, which is calculated by BIOS and set to
>> bridge's configuration space.
>
>with that new condition, probe_resource will return zero.
>
>for those kind of case:
>1. use echo 1 > /sys .../remove to remove devices under Bridge2.
>2. use setpci to change bus register of bridge2 to move high to make
>more space for bridge 1.
>3. rescan bridge 1 and bridge 2.
So these steps is done after boot up and user find B3 doesn't work?
>
>Yinghai

--
Richard Yang
Help you, Help me

2012-05-16 02:11:36

by Yinghai Lu

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Tue, May 15, 2012 at 6:18 PM, Richard Yang
<[email protected]> wrote:
> On Tue, May 15, 2012 at 10:32:46AM -0700, Yinghai Lu wrote:
>>>>>>On 04/22/2012 11:52 AM, Richard Yang wrote:
>>>>>>>All,
>>>>>>>
>>>>>>>I am reading the pci_scan_bridge() and not sure what will happen in
>>>>>>>following situation.
>>>>>>>
>>>>>>>Suppose the kernel is not passed the pci=assign-busses.
>>>>>>>
>>>>>>>Below is a picture about the pci system.
>>>>>>>
>>>>>>> ? ? ? ? ? ? ? ? ? ?+-------+
>>>>>>> ? ? ? ? ? ? ? ? ? ?| ? ? ? | root bridge(0,255)
>>>>>>> ? ? ? ? ? ? ? ? ? ?+---+---+
>>>>>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? ?Bus 0
>>>>>>> ? ? ? -----+-----------+------------------------------+--
>>>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>>>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>>>>>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>>>>>> ? ? ? | ? ? ? ? | ?B1(1,15) ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? |B2(16,28)
>>>>>>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>>>>>>> ? ? ? ? ? ?| ?Bus 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?Bus 16
>>>>>>> ? ? ? -----+----------------------- ? ? ? ? ----------+----------------
>>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
>>>>>>> ? ? ? ? ? ? ? ? ? ? ? ?+----+----+
>>>>>>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? | B3
>>>>>>> ? ? ? ? ? ? ? ? ? ? ? ?+---------+
>>>>>>>
>>>>>>>Suppose B1 and B2 works fine with the BIOS, which get the right bus
>>>>>>>number and range.
>>>>>>>
>>>>>>>B3 does not works fine with the BIOS, which doesn't get the bus number.
>>>>>>>
>>>>> Take my original question.
>>>>>
>>>>> B3 doesn't get the bus number, which its parent doesn't have free bus
>>>>> number and there is no gap between B1 and B2.
>>>>>
>>>>> So in this case, the probe_resource() can't find bus number for B3.
>>>>> Then cause pci_bridge_probe_busn_res() return non-zero.
>>>>>
>>>>> Then B3 couldn't work fine?
>>>>
>>>>B3 is on Bus 1? B3 is the one of bridges on Bus1?
>>> No, ?I omit other bridges on Bus#1.
>>> They will occupy bus number 2-15, which is calculated by BIOS and set to
>>> bridge's configuration space.
>>
>>with that new condition, probe_resource will return zero.
>>
>>for those kind of case:
>>1. use echo 1 > /sys .../remove to remove devices under Bridge2.
>>2. use setpci to change bus register of bridge2 to move high to make
>>more space for bridge 1.
>>3. rescan bridge 1 and bridge 2.
> So these steps is done after boot up and user find B3 doesn't work?

yes, after os is booted up.

Yinghai

2012-05-29 11:59:11

by Wei Yang

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Tue, May 15, 2012 at 07:11:34PM -0700, Yinghai Lu wrote:
>> So these steps is done after boot up and user find B3 doesn't work?
>
>yes, after os is booted up.
>
>Yinghai

Yinghai

I think about this issue again, this behavior of kernel will bring some
unconvenience to the user.

Do you think the kernel could handle this situation?
--
Richard Yang
Help you, Help me

2012-05-29 17:14:53

by Yinghai Lu

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Tue, May 29, 2012 at 4:59 AM, Richard Yang
<[email protected]> wrote:
>
> I think about this issue again, this behavior of kernel will bring some
> unconvenience to the user.
>
> Do you think the kernel could handle this situation?

in this extreme case, you may need user to do some comprise.

We should always try to use setting from BIOS if it is sane.

Yinghai

2012-06-04 13:35:38

by Wei Yang

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Tue, May 29, 2012 at 10:14:51AM -0700, Yinghai Lu wrote:
>On Tue, May 29, 2012 at 4:59 AM, Richard Yang
><[email protected]> wrote:
>>
>> I think about this issue again, this behavior of kernel will bring some
>> unconvenience to the user.
>>
>> Do you think the kernel could handle this situation?
>
>in this extreme case, you may need user to do some comprise.
>
>We should always try to use setting from BIOS if it is sane.
>
>Yinghai
Yinghai

+-------+
| | root bridge(0,255)
+---+---+
| Bus 0
-----+-----------+------------------------------+--
| |
| |
| |
+----+----+ +-----+-----+
| | B1(1,15) | |B2(32,35)
+----+----+ +-----+-----+
| Bus 1 | Bus 32
-----+----------------------- -----------
|
+----+----+
| | B3
+---------+

I reread the current code, v3.4, in linus tree,
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
And I come up with another condition which will have a problem when
kernel is not given the parameter, pci=assign-busses.

Same condition as previous:
-------------------------------------------------------------------------------
B1 and B2 works fine with the BIOS and get the bus number assigned.
B3 is not probed by BIOS.

Difference between the previous example:
-------------------------------------------------------------------------------
In this case, B2 is assigned bus range (32, 35), which has a gap between
B1 number range (1, 15).

When kernel meets B3 in second pass, B3 will be assigned with bus number
16. Well, this time the bus number 16 doesn't overlap with bus number of
B2.

But, the pci_fixup_parent_subordinate_busnr() will not work since the
pci=assign-buses is not passed to kernel.

So B1's bus window is still (1,15) not (1,16).

BTW, is this also a extrem case?

--
Richard Yang
Help you, Help me

2012-06-04 23:36:35

by Yinghai Lu

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Mon, Jun 4, 2012 at 6:34 AM, Richard Yang <[email protected]> wrote:
> On Tue, May 29, 2012 at 10:14:51AM -0700, Yinghai Lu wrote:
>>On Tue, May 29, 2012 at 4:59 AM, Richard Yang
>><[email protected]> wrote:
>>>
>>> I think about this issue again, this behavior of kernel will bring some
>>> unconvenience to the user.
>>>
>>> Do you think the kernel could handle this situation?
>>
>>in this extreme case, you may need user to do some comprise.
>>
>>We should always try to use setting from BIOS if it is sane.
>>
>>Yinghai
> Yinghai
>
> ? ? ? ? ? ? ? ? ? ?+-------+
> ? ? ? ? ? ? ? ? ? ?| ? ? ? | root bridge(0,255)
> ? ? ? ? ? ? ? ? ? ?+---+---+
> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? ?Bus 0
> ? ? ? -----+-----------+------------------------------+--
> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
> ? ? ? | ? ? ? ? | ?B1(1,15) ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? |B2(32,35)
> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
> ? ? ? ? ? ?| ?Bus 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?Bus 32
> ? ? ? -----+----------------------- ? ? ? ? ? ? -----------
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
> ? ? ? ? ? ? ? ? ? ? ? ?+----+----+
> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? | B3
> ? ? ? ? ? ? ? ? ? ? ? ?+---------+
>
> I reread the current code, v3.4, in linus tree,
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> And I come up with another condition which will have a problem when
> kernel is not given the parameter, pci=assign-busses.
>
> Same condition as previous:
> -------------------------------------------------------------------------------
> B1 and B2 works fine with the BIOS and get the bus number assigned.
> B3 is not probed by BIOS.
>
> Difference between the previous example:
> -------------------------------------------------------------------------------
> In this case, B2 is assigned bus range (32, 35), which has a gap between
> B1 number range (1, 15).
>
> When kernel meets B3 in second pass, B3 will be assigned with bus number
> 16. Well, this time the bus number 16 doesn't overlap with bus number of
> B2.
>
> But, the pci_fixup_parent_subordinate_busnr() will not work since the
> pci=assign-buses is not passed to kernel.
>
> So B1's bus window is still (1,15) not (1,16).
>
> BTW, is this also a extrem case?

that should be handled by busn_alloc branch.

kernel will try to probe in [1,15] at first, and could extend B1 range
to [1, 31] if needed.

Thanks

Yinghai

2012-06-05 06:26:13

by Wei Yang

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Mon, Jun 04, 2012 at 04:36:33PM -0700, Yinghai Lu wrote:
>On Mon, Jun 4, 2012 at 6:34 AM, Richard Yang <[email protected]> wrote:
>> On Tue, May 29, 2012 at 10:14:51AM -0700, Yinghai Lu wrote:
>>>On Tue, May 29, 2012 at 4:59 AM, Richard Yang
>>><[email protected]> wrote:
>>>>
>>>> I think about this issue again, this behavior of kernel will bring some
>>>> unconvenience to the user.
>>>>
>>>> Do you think the kernel could handle this situation?
>>>
>>>in this extreme case, you may need user to do some comprise.
>>>
>>>We should always try to use setting from BIOS if it is sane.
>>>
>>>Yinghai
>> Yinghai
>>
>> ? ? ? ? ? ? ? ? ? ?+-------+
>> ? ? ? ? ? ? ? ? ? ?| ? ? ? | root bridge(0,255)
>> ? ? ? ? ? ? ? ? ? ?+---+---+
>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? ?Bus 0
>> ? ? ? -----+-----------+------------------------------+--
>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>> ? ? ? ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>> ? ? ? | ? ? ? ? | ?B1(1,15) ? ? ? ? ? ? ? ? ? ? | ? ? ? ? ? |B2(32,35)
>> ? ? ? +----+----+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? +-----+-----+
>> ? ? ? ? ? ?| ?Bus 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?Bus 32
>> ? ? ? -----+----------------------- ? ? ? ? ? ? -----------
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
>> ? ? ? ? ? ? ? ? ? ? ? ?+----+----+
>> ? ? ? ? ? ? ? ? ? ? ? ?| ? ? ? ? | B3
>> ? ? ? ? ? ? ? ? ? ? ? ?+---------+
>>
>> I reread the current code, v3.4, in linus tree,
>> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
>> And I come up with another condition which will have a problem when
>> kernel is not given the parameter, pci=assign-busses.
>>
>> Same condition as previous:
>> -------------------------------------------------------------------------------
>> B1 and B2 works fine with the BIOS and get the bus number assigned.
>> B3 is not probed by BIOS.
>>
>> Difference between the previous example:
>> -------------------------------------------------------------------------------
>> In this case, B2 is assigned bus range (32, 35), which has a gap between
>> B1 number range (1, 15).
>>
>> When kernel meets B3 in second pass, B3 will be assigned with bus number
>> 16. Well, this time the bus number 16 doesn't overlap with bus number of
>> B2.
>>
>> But, the pci_fixup_parent_subordinate_busnr() will not work since the
>> pci=assign-buses is not passed to kernel.
>>
>> So B1's bus window is still (1,15) not (1,16).
>>
>> BTW, is this also a extrem case?
>
>that should be handled by busn_alloc branch.
>
>kernel will try to probe in [1,15] at first, and could extend B1 range
>to [1, 31] if needed.
Hmm... when do you think this branch will be merged to the mainstream?
>
>Thanks
>
>Yinghai

--
Richard Yang
Help you, Help me

2012-06-05 18:01:30

by Yinghai Lu

[permalink] [raw]
Subject: Re: One problem in reassign pci bus number?

On Mon, Jun 4, 2012 at 11:26 PM, Richard Yang
<[email protected]> wrote:
> On Mon, Jun 04, 2012 at 04:36:33PM -0700, Yinghai Lu wrote:
>>
>>kernel will try to probe in [1,15] at first, and could extend B1 range
>>to [1, 31] if needed.
> Hmm... when do you think this branch will be merged to the mainstream?
>>

not sure. could be 3.7

Bjorn still think that probe_resource is too complicated.

So i still need to find some time to simplify it.
or need to route that attached patch through Andrew or get Ack from
Andrew or Linus.

Thanks

Yinghai


Attachments:
probe_resource_2.patch (5.91 kB)