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: [Xen-devel] Help with test_and_clear_bit on events

To: Daniel Castro <evil.dani@xxxxxxxxx>
Subject: Re: [Xen-devel] Help with test_and_clear_bit on events
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Tue, 4 Oct 2011 14:19:49 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 04 Oct 2011 06:20:28 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1317726163.21903.113.camel@xxxxxxxxxxxxxxxxxxxxxx>
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>
Organization: Citrix Systems, Inc.
References: <CAP2B85_LhqE9F53FAJ3ez3+GDichDTcWiau=x2zdftqGdcADag@xxxxxxxxxxxxxx> <1317726163.21903.113.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 2011-10-04 at 12:02 +0100, Ian Campbell wrote:
> On Tue, 2011-10-04 at 11:57 +0100, Daniel Castro wrote:
> > Hello List,
> > 
> > I have been trying for several days to be able to wait for events and
> > then continue execution based on the event received. My problem is in
> > the wait_ring function of xenbus.c
> > After debugging my test_and_clear_bit I corrected the error that
> > allows me to receive ONE event, but after that the bit is never set
> > again. My offset is always 2 (nr eq 2).
> > Please, can someone explain me how struct shared_info and these two
> > fields control the events that I can receive?
> > unsigned long evtchn_pending[sizeof(unsigned long) * 8];
> > unsigned long evtchn_mask[sizeof(unsigned long) * 8];
> > 
> > I print the whole array Bit by Bit and I do not see a difference after
> > the arrival of the event and before the arrival.
> > 
> > I also checked struct vcpu_info fields: u8 evtchn_upcall_pending and
> > u8 evtchn_upcall_mask to see if they are disabling the event delivery.
> > No changes before or after.
> 
> If git://github.com/evildani/seabios_patch.git master is up to date
> then:
>     shared_info = malloc_high(sizeof(shared_info));

Another bug here. sizeof(shared_info) is sizeof the pointer (i.e. 4),
not the data structure which it points to.

You could use sizeof(*shared_info) but actually you require a page size
and page aligned allocation so you should just use PAGE_SIZE.

If your allocation is not page aligned the shift to calculate gpfn will
effectively round down the address you wanted...

>     xatp.gpfn  = ((unsigned long)shared_info << PAGE_SHIFT);
> is wrong and you aren't registering the correct shared_info so you
> aren't actually looking at the right bits, the change in behaviour is
> just because you are now looking at different wrong bits.
> 
> You need ">>" not "<<" (consider the relation between addresses and page
> numbers...).
> 
> Ian.
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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