Re: [PATCH 1/5] PCI : Calculate right add_size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  7 Dec 2011 00:53:00 -0800
Yinghai Lu <yinghai@xxxxxxxxxx> wrote:

> During debug one SRIOV enabled hotplug, found add_size is not passed properly.
> 
> the device have devices under two level bridges..
> 
>  +-[0000:80]-+-00.0-[81-8f]--
>  |           +-01.0-[90-9f]--
>  |           +-02.0-[a0-af]----00.0-[a1-a3]--+-02.0-[a2]--+-00.0  Oracle Corporation Device
>  |           |                               \-03.0-[a3]--+-00.0  Oracle Corporation Device
> 
> so later parent bridge will not try to add big range.
> [  557.455077] pci 0000:a0:00.0: BAR 14: assigned [mem 0xf9000000-0xf93fffff]
> [  557.461974] pci 0000:a0:00.0: BAR 15: assigned [mem 0xf6000000-0xf61fffff pref]
> [  557.469340] pci 0000:a1:02.0: BAR 14: assigned [mem 0xf9000000-0xf91fffff]
> [  557.476231] pci 0000:a1:02.0: BAR 15: assigned [mem 0xf6000000-0xf60fffff pref]
> [  557.483582] pci 0000:a1:03.0: BAR 14: assigned [mem 0xf9200000-0xf93fffff]
> [  557.490468] pci 0000:a1:03.0: BAR 15: assigned [mem 0xf6100000-0xf61fffff pref]
> [  557.497833] pci 0000:a1:03.0: BAR 14: can't assign mem (size 0x200000)
> [  557.504378] pci 0000:a1:03.0: failed to add optional resources res=[mem 0xf9200000-0xf93fffff]
> [  557.513026] pci 0000:a1:02.0: BAR 14: can't assign mem (size 0x200000)
> [  557.519578] pci 0000:a1:02.0: failed to add optional resources res=[mem 0xf9000000-0xf91fffff]
> 
> it turns out We did not calculate size1 properly.
> 
> static resource_size_t calculate_memsize(resource_size_t size,
>                 resource_size_t min_size,
>                 resource_size_t size1,
>                 resource_size_t old_size,
>                 resource_size_t align)
> {
>         if (size < min_size)
>                 size = min_size;
>         if (old_size == 1 )
>                 old_size = 0;
>         if (size < old_size)
>                 size = old_size;
>         size = ALIGN(size + size1, align);
>         return size;
> }
> 
> We should not pass add_size with min_size in calculate_memsize.
> that will make add_size not contribute final add_size.
> 
> Just pass add_size with size1 to calculate_memsize()
> 
> With this change, We should have chance to remove extra addon in pci_reassign_resource...

This one looks like a fairly standalone bug fix; it doesn't require
subtle changes in behavior from the later patches to work right does it?

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux