Skip to contentSkip to conversation

Question about event channels and masking event channels

DISCUSSION Rick 2 participants 2 messages Feb 14, 2005

lore
Share & tools
lore

Rick

author
#0 lore raw

Hello,

There is something I do not undestand about the event handling mechanism in xenolinux.
XenoLinux can listen for 1024 events (0 to 1023). The shared_info_t structure records the pending and the masking of events using the following bit vectors:
=================================================
u32 evtchn_pending[32];
u32 evtchn_pending_sel;
u32 evtchn_mask[32];
=================================================

Next, I am looking at the function mask_evtchn() in the file evtchn.h
=================================================
static inline void mask_evtchn(int port)

{
    shared_info_t *s = HYPERVISOR_shared_info;
    synch_set_bit(port, &s->evtchn_mask[0]);
}

=================================================

Why do we only focus on evtchn_mask[0] ?
I thought that Port would be a number between 0 to 1023 and masking the correct bit would be done with something like that:
synch_set_bit(port%32, &s->evtchn_mask[port/32]);

Is it the case that one can only mask out the first 8 bits in evtchn_mask[0] ?

Thanks
Rick

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

#1 lore raw

I'm guessing that sync_set_bit requires a bit number, and a pointer to a bit array of some type.

The &s->evtchn_mask[0] is effectively the same as s->evtchn_mask, however it results in a different pointer type (only really important for the compiler).

So synch_set_bit is passed a pointer to the array, so that it an perform the appropriate operation (I'm guessing again) synchronised.

Scott.

Quoted 30 lines · Rick

Hello,

There is something I do not undestand about the event handling
mechanism in xenolinux.
XenoLinux can listen for 1024 events (0 to 1023). The shared_info_t
structure records the pending and the masking of events using the
following bit vectors:
=================================================
u32 evtchn_pending[32]; u32 evtchn_pending_sel; u32 evtchn_mask[32]; =================================================

Next, I am looking at the function mask_evtchn() in the file evtchn.h
=================================================
static inline void mask_evtchn(int port)

{
   shared_info_t *s = HYPERVISOR_shared_info;
   synch_set_bit(port, &s->evtchn_mask[0]);
}

=================================================

Why do we only focus on evtchn_mask[0] ?
I thought that Port would be a number between 0 to 1023 and masking the correct bit would be done with something like that:
synch_set_bit(port%32, &s->evtchn_mask[port/32]);

Is it the case that one can only mask out the first 8 bits in evtchn_mask[0] ?

Thanks
Rick

Quoted 12 lines

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xen-devel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click