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

Re: [Xen-devel] Help with test_and_clear_bit on events



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.