WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: linux c/s 860

To: Jan Beulich <jbeulich@xxxxxxxxxx>
Subject: [Xen-devel] Re: linux c/s 860
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Thu, 16 Apr 2009 11:13:06 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 15 Apr 2009 19:13:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <49E6128C.76EA.0078.0@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <49E6128C.76EA.0078.0@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6i
On Wed, Apr 15, 2009 at 03:59:56PM +0100, Jan Beulich wrote:
> Other than its comment says, this c/s doesn't only subtract 1 from r_align, 
> but
> also extends the surrounding condition to include !r_align. If r_align is 
> zero,
> ALIGN(r_align, PAGE_SIZE) will be zero too, and hence in the end r_align
> will become ~0. What's the purpose of all that? Or am I missing something
> here? Or is the added condition perhaps just inverted?

Thank you for pointing out.
The alignment logic should be same as in th following list loop.
How about this patch?

linux: clean up of linux c/s 860

The fixing logic was somewhat confused and doesn't produce right result.
This patch cleans it up.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -245,11 +245,6 @@ pdev_sort_resources(struct pci_dev *dev,
                if (!(r->flags) || r->parent)
                        continue;
                
-               if (i < PCI_BRIDGE_RESOURCES && (r->flags & IORESOURCE_MEM) &&
-                   !r_align && reassigndev)
-                       /* -1 is compensation for +1 in the following calc. */
-                       r_align = ALIGN(r_align, PAGE_SIZE) - 1;
-
                if (!r_align) {
                        printk(KERN_WARNING "PCI: Ignore bogus resource %d "
                                "[%llx:%llx] of %s\n",
@@ -258,6 +253,11 @@ pdev_sort_resources(struct pci_dev *dev,
                        continue;
                }
                r_align = (i < PCI_BRIDGE_RESOURCES) ? r_align + 1 : r->start;
+
+               if (i < PCI_BRIDGE_RESOURCES && (r->flags & IORESOURCE_MEM) &&
+                   reassigndev)
+                       r_align = ALIGN(r_align, PAGE_SIZE);
+
                for (list = head; ; list = list->next) {
                        resource_size_t align = 0;
                        struct resource_list *ln = list->next;


-- 
yamahata

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>