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

Re: [PATCH] fix ia64 breakage with PHYSDEVOP_pirq_eoi_mfn (was Re: [Xen-

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [PATCH] fix ia64 breakage with PHYSDEVOP_pirq_eoi_mfn (was Re: [Xen-devel] [PATCH 2/2] linux/x86: use shared page indicating the need for an EOI notification)
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Wed, 10 Dec 2008 13:08:24 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 09 Dec 2008 20:09:13 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C56401D2.1FFE2%keir.fraser@xxxxxxxxxxxxx>
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: <493E5C91.76E4.0078.0@xxxxxxxxxx> <C56401D2.1FFE2%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6i
On Tue, Dec 09, 2008 at 11:06:58AM +0000, Keir Fraser wrote:
> On 09/12/2008 10:54, "Jan Beulich" <jbeulich@xxxxxxxxxx> wrote:
> 
> >>>> Isaku Yamahata <yamahata@xxxxxxxxxxxxx> 09.12.08 11:43 >>>
> >> You are the first person to pass the kernel symbol address
> >> to virt_to_machine() in arch independent code.
> >> Is there any necessity to allocate pirq_needs_eoi statically?
> >> (except it did before)
> > 
> > Perhaps not - avoiding the possible allocation failure (-> BUG()) and the
> > extra indirection were the main reasons I kept it allocated statically.
> > 
> >> If no, can we allocate the pages for them dynamically?
> >> Then the issue will go away.
> > 
> > Indeed.
> 
> Yes please. Just do this and be done. It's a one-off start-of-day allocation
> which, if it fails, means you're screwed anyway.

Here is.

evtchn: allocate pirq_needs_eoi bitmap dynamically.

allocating pirq_needs_eoi statically causes an address conversion
issue between ia64 and x86 because ia64 kernel symbol address
doesn't lay in 1:1 mapping area which can't be apssed to virt_to_machine().
So allocate it dynamically to work around it.

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

diff --git a/drivers/xen/core/evtchn.c b/drivers/xen/core/evtchn.c
--- a/drivers/xen/core/evtchn.c
+++ b/drivers/xen/core/evtchn.c
@@ -31,6 +31,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/bootmem.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
@@ -755,8 +756,7 @@ static struct hw_interrupt_type dynirq_t
 
 /* Bitmap indicating which PIRQs require Xen to be notified on unmask. */
 static int pirq_eoi_does_unmask;
-static DECLARE_BITMAP(pirq_needs_eoi, ALIGN(NR_PIRQS, PAGE_SIZE * 8))
-       __attribute__ ((__section__(".bss.page_aligned"), 
__aligned__(PAGE_SIZE)));
+static unsigned long *pirq_needs_eoi;
 
 static void pirq_unmask_and_notify(unsigned int evtchn, unsigned int irq)
 {
@@ -1041,8 +1041,7 @@ void irq_resume(void)
        if (pirq_eoi_does_unmask) {
                struct physdev_pirq_eoi_gmfn eoi_gmfn;
 
-               eoi_gmfn.gmfn = arbitrary_virt_to_machine(pirq_needs_eoi)
-                       >> PAGE_SHIFT;
+               eoi_gmfn.gmfn = virt_to_machine(pirq_needs_eoi) >> PAGE_SHIFT;
                if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn))
                        BUG();
        }
@@ -1137,9 +1136,12 @@ void __init xen_init_IRQ(void)
 
        init_evtchn_cpu_bindings();
 
+       pirq_needs_eoi = alloc_bootmem_pages(PAGE_SIZE);
+       memset(pirq_needs_eoi, 0, PAGE_SIZE);
+       if (pirq_needs_eoi == NULL)
+               panic("failed to allocate a page for event channel.");
        BUG_ON(!bitmap_empty(pirq_needs_eoi, PAGE_SIZE * 8));
-       eoi_gmfn.gmfn = arbitrary_virt_to_machine(pirq_needs_eoi)
-               >> PAGE_SHIFT;
+       eoi_gmfn.gmfn = virt_to_machine(pirq_needs_eoi) >> PAGE_SHIFT;
        if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn) == 0)
                pirq_eoi_does_unmask = 1;
 


-- 
yamahata

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

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