Resource: wrong resource window calculation
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAErSpo70k6UnhvvOMgQQxJ6BHZOwym=-jaPMvOukAaCr-B0+cQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAErSpo6bofeiAxeRo_RjXQSnwmcWrdymn0MK8H4_CwqwoeD1jg@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20110909113409.GE2416@ram-ThinkPad-T61
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20110913110646.GB2425@ram-ThinkPad-T61
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Resource: wrong resource window calculation
Resource: wrong resource window calculation
__find_resource() incorrectly returns a resource window which overlaps an existing allocated window. This happens when the parent's resource-window spans 0x00000000 to 0xffffffff and is entirely allocated to all its children resource-windows.
__find_resource() looks for gaps in resource allocation among the children resource windows. When it encounters the last child window it blindly tries the range next to one allocated to the last child. Since the last child's window ends at 0xffffffff the calculation overflows, leading the algorithm to believe that any window in the range 0x0000000 to 0xfffffff is available for allocation. This leads to a conflicting window allocation.
Michal Ludvig reported this issue seen on his platform. The following patch fixes the problem and has been verified by Michal. I believe this bug has been there for ages. It got exposed by git commit 2bbc6942273b5b3097bd265d82227bdd84b351b2
[PATCH] PCI : ability to relocate assigned pci-resources
--- kernel/resource.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
kernel/resource.c +6 -1
@@ -419,6 +419,9 @@ static int __find_resource(struct resource *root, struct resource *old,else tmp.end = root->end; +if (tmp.end < tmp.start) + goto next; +resource_clip (&tmp, constraint->min, constraint->max);arch_remove_reservations (&tmp);
@@ -436,8 +439,10 @@ static int __find_resource(struct resource *root, struct resource *old,return 0 ; } } -if (!this) + +next:if (!this || this->end == root->end)break ; +if (this != old) tmp.start = this->end +1 ; this = this->sibling;
Signature · 1 line
1.7.4.1
Quoted 14 lines · Ram Pai
Resource: wrong resource window calculation
__find_resource()incorrectly returns a resource window which overlaps an existing allocated window. This happens when the parent's resource-window spans0x00000000to0xffffffffand is entirely allocated to all its children resource-windows.
__find_resource()looks for gaps in resource allocation among the children resource windows. When it encounters the last child window it blindly tries the range next to one allocated to the last child. Since the last child's window ends at0xffffffffthe calculation overflows, leading the algorithm to believe that any window in the range0x0000000to0xfffffffis available for allocation. This leads to a conflicting window allocation.
Quoted 7 lines
Michal Ludvig reported this issue seen on his platform. The following patch fixes the problem and has been verified by Michal. I believe this bug has been there for ages. It got exposed by git commit
2bbc6942273b5b3097bd265d82227bdd84b351b2
[PATCH] PCI : ability to relocate assigned pci-resourcesSigned-off-by Ram Pai<[email protected]>
Works fine on top of 3.1.0-rc7 and solves the problem with my Jetway board.
Thanks Ram!
M.
Quoted 23 lines · Michal Ludvig
Quoted 14 lines · Ram Pai
Resource: wrong resource window calculation
__find_resource()incorrectly returns a resource window which overlaps an existing allocated window. This happens when the parent's resource-window spans0x00000000to0xffffffffand is entirely allocated to all its children resource-windows.
__find_resource()looks for gaps in resource allocation among the children resource windows. When it encounters the last child window it blindly tries the range next to one allocated to the last child. Since the last child's window ends at0xffffffffthe calculation overflows, leading the algorithm to believe that any window in the range0x0000000to0xfffffffis available for allocation. This leads to a conflicting window allocation.Quoted 7 lines
Michal Ludvig reported this issue seen on his platform. The following patch fixes the problem and has been verified by Michal. I believe this bug has been there for ages. It got exposed by git commit
2bbc6942273b5b3097bd265d82227bdd84b351b2
[PATCH] PCI : ability to relocate assigned pci-resourcesSigned-off-by Ram Pai<[email protected]>
Quoted 7 lines
Tested-by Michal Ludvig <[email protected]>Works fine on top of 3.1.0-rc7 and solves the problem with my Jetway board.
Thanks Ram!
M.
Linus,
Do you plan to take this patch for 3.1? It fixes a regression w.r.t 3.0
https://bugzilla.kernel.org/show_bug.cgi?id=42002 captures the bug report.
RP
Quoted 3 lines · Ram Pai
Do you plan to take this patch for 3.1? It fixes a regression w.r.t 3.0
https://bugzilla.kernel.org/show_bug.cgi?id=42002 captures the bug report.
It looks fine, but that bugzilla thing is currently useless. Do you have some other place with the symptoms, discussion etc? I didn't find the original report on lkml..
Linus
Quoted 7 lines · Linus Torvalds
Quoted 2 lines · Ram Pai
Do you plan to take this patch for 3.1? It fixes a regression w.r.t 3.0
https://bugzilla.kernel.org/show_bug.cgi?id=42002 captures the bug report.It looks fine, but that bugzilla thing is currently useless. Do you have some other place with the symptoms, discussion etc? I didn't find the original report on lkml..
Hi,
here is the thread from linux-pci@...
http://comments.gmane.org/gmane.linux.kernel.pci/11666
Michal
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Ram Pai
Do you plan to take this patch for 3.1? It fixes a regression w.r.t 3.0
https://bugzilla.kernel.org/show_bug.cgi?id=42002 captures the bug report.It looks fine, but that bugzilla thing is currently useless. Do you have some other place with the symptoms, discussion etc? I didn't find the original report on lkml..
It was initially reported by Michal Ludwig in the linux-pci mailing list. The following thread captures the discussion
http://comments.gmane.org/gmane.linux.kernel.pci/11666
RP