From: Richard Yang <weiyang@linux.vnet.ibm.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Richard Yang <weiyang@linux.vnet.ibm.com>,
Wei Yang <weiyang.kernel@gmail.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: One problem in reassign pci bus number?
Date: Fri, 4 May 2012 12:52:05 +0800 [thread overview]
Message-ID: <20120504045205.GA21624@richard> (raw)
In-Reply-To: <CAE9FiQUz2w815gU5vY5b0BPf+1pz_pafgzqVKizJC++z27RTaQ@mail.gmail.com>
On Thu, May 03, 2012 at 08:15:29PM -0700, Yinghai Lu wrote:
>>>
>>>I updated for-pci-busn-alloc branch with updating of probe_resource()...
>>>and removing bus->secondary and subordinate.
>>>
>> You mean you remove the bus->secondary field?
>> So the pci_bus->number hold the bus number?
>> I think this is a huge work.
>>>Please check if you can understand it ...
>>>
>>>http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=commitdiff;h=7de8df57b223d54af95ffe67f8da2dd39a265971
>> Some question:
>>
>> +static resource_size_t __find_res_top_free_size(struct resource *res,
>> + int skip_nr)
>> +{
>> + resource_size_t n_size;
>> + struct resource tmp_res;
>> +
>> + */
>> + * find out free number below res->end that we can use.
>> + * res->start to res->start + skip_nr - 1 can not be used.
>> + */
>> + n_size = resource_size(res);
>> + if (n_size <= skip_nr)
>> + return 0;
>> +
>> + n_size -= skip_nr;
>> + memset(&tmp_res, 0, sizeof(struct resource));
>> + while (n_size > 0) {
>> + int ret;
>> +
>> + ret = __allocate_resource(res, &tmp_res, n_size,
>> + res->end - n_size + skip_nr, res->end,
>> + 1, NULL, NULL, false);
>> + if (ret == 0) {
>> + __release_resource(&tmp_res);
>> + break;
>> + }
>> + n_size--;
>> + }
>> +
>> + return n_size;
>> +}
>> So this is trying to find out the biggest free space of res?
>> On the right side?
>>
>> For example we have , res like
>> 90-150
>> 105-140
>> The __find_res_top_free_size() will return 10 instead of 15.
>> So this is the design decision to find the right side free resouce not
>> the left side?
>
> __find_res_top_free_size() is called by probe_resource().
>
>probe_resource will return [91-104].
Hmm... I think the result is returned by this while loop.
+ while (n_size >= needed_size) {
+ ret = allocate_resource(b_res, busn_res, n_size,
+ b_res->start + skip_nr, b_res->end,
+ 1, NULL, NULL);
+ if (!ret)
+ return ret;
+ n_size--;
+ }
__find_res_top_free_size() is not called.
BTW, even if this value is returned by __find_res_top_free_size(), or
returned after this function is called, the purpose of the
__find_res_top_free_size() is to get the biggest free space under the
first parameter?
>
>Thanks
>
>Yinghai
--
Richard Yang
Help you, Help me
next prev parent reply other threads:[~2012-05-04 5:11 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20120410090306.GA7056@richard>
2012-04-22 15:52 ` One problem in reassign pci bus number? Richard Yang
2012-04-23 19:46 ` Don Dutile
2012-04-23 20:19 ` Yinghai Lu
2012-04-23 21:09 ` Don Dutile
2012-04-23 22:07 ` Yinghai Lu
2012-04-25 2:56 ` Don Dutile
2012-04-23 22:22 ` Yinghai Lu
2012-04-25 2:59 ` Don Dutile
2012-04-24 7:29 ` Richard Yang
2012-05-14 1:55 ` Richard Yang
2012-05-14 5:40 ` Yinghai Lu
2012-05-14 6:46 ` Richard Yang
2012-05-15 17:32 ` Yinghai Lu
2012-05-16 1:18 ` Richard Yang
2012-05-16 2:11 ` Yinghai Lu
2012-05-29 11:59 ` Richard Yang
2012-05-29 17:14 ` Yinghai Lu
2012-06-04 13:34 ` Richard Yang
2012-06-04 23:36 ` Yinghai Lu
2012-06-05 6:26 ` Richard Yang
2012-06-05 18:01 ` Yinghai Lu
2012-04-23 20:13 ` Yinghai Lu
2012-04-24 14:56 ` Wei Yang
2012-04-25 9:47 ` Wei Yang
2012-04-25 16:28 ` Yinghai Lu
2012-05-03 6:54 ` Richard Yang
2012-05-03 8:33 ` Yinghai Lu
2012-05-04 2:47 ` Richard Yang
2012-05-04 3:15 ` Yinghai Lu
2012-05-04 4:52 ` Richard Yang [this message]
2012-05-04 17:37 ` Yinghai Lu
2012-05-06 15:17 ` Richard Yang
2012-05-06 16:35 ` Yinghai Lu
2012-05-06 16:36 ` Yinghai Lu
2012-05-07 1:17 ` Richard Yang
2012-05-07 2:04 ` Yinghai Lu
2012-05-08 2:46 ` Richard Yang
2012-05-08 3:42 ` Yinghai Lu
2012-05-10 3:35 ` Richard Yang
2012-05-10 5:42 ` Yinghai Lu
2012-05-11 1:23 ` Richard Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120504045205.GA21624@richard \
--to=weiyang@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=weiyang.kernel@gmail.com \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).