Kai Huang
2012-Jan-19 09:02 UTC
[question] what''s the purpose of smp_send_event_check_mask?
Hi, I see cpu_raise_softirq calls smp_send_event_check_mask after setting softirq bit for target CPU if target CPU is not the current CPU. I thought smp_send_event_check_mask will send IPI to target CPU and then trigger target CPU to run pending irq, but seems smp_send_event_check_mask does nothing but jast ACK the IPI. So what''s the purpose of this function? Why do we need this function? BTW, would someone gives me some knowledge when will the pending irqs be triggered to run after setting up the pending bits? Seems normally they are called asynchronously. Thanks in advance! -cody
Keir Fraser
2012-Jan-19 09:14 UTC
Re: [question] what''s the purpose of smp_send_event_check_mask?
On 19/01/2012 09:02, "Kai Huang" <mail.kai.huang@gmail.com> wrote:> Hi, > > I see cpu_raise_softirq calls smp_send_event_check_mask after setting > softirq bit for target CPU if target CPU is not the current CPU. I > thought smp_send_event_check_mask will send IPI to target CPU and then > trigger target CPU to run pending irq, but seems > smp_send_event_check_mask does nothing but jast ACK the IPI. So what''s > the purpose of this function? Why do we need this function?Xen always checks softirqs on return from interrupt context to guest context, and also in its idle loopon wakeup. Hence the event_check interrupt handler itself doesn''t need to do anything.> BTW, would someone gives me some knowledge when will the pending irqs > be triggered to run after setting up the pending bits? Seems normally > they are called asynchronously.Yes, of course it''s asynchronous, the smp_send_event_check_mask interrupt is just to make sure it happens "soon". -- Keir> Thanks in advance! > > -cody > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel
Kai Huang
2012-Jan-19 09:18 UTC
Re: [question] what''s the purpose of smp_send_event_check_mask?
On Thu, Jan 19, 2012 at 5:14 PM, Keir Fraser <keir.xen@gmail.com> wrote:> > On 19/01/2012 09:02, "Kai Huang" <mail.kai.huang@gmail.com> wrote: > >> Hi, >> >> I see cpu_raise_softirq calls smp_send_event_check_mask after setting >> softirq bit for target CPU if target CPU is not the current CPU. I >> thought smp_send_event_check_mask will send IPI to target CPU and then >> trigger target CPU to run pending irq, but seems >> smp_send_event_check_mask does nothing but jast ACK the IPI. So what''s >> the purpose of this function? Why do we need this function? > > Xen always checks softirqs on return from interrupt context to guest > context, and also in its idle loopon wakeup. Hence the event_check interrupt > handler itself doesn''t need to do anything.Thanks. This makes sense. -cody> >> BTW, would someone gives me some knowledge when will the pending irqs >> be triggered to run after setting up the pending bits? Seems normally >> they are called asynchronously. > > Yes, of course it''s asynchronous, the smp_send_event_check_mask interrupt is > just to make sure it happens "soon". > > -- Keir > >> Thanks in advance! >> >> -cody >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel > >
Kai Huang
2012-Jan-19 09:26 UTC
Re: [question] what''s the purpose of smp_send_event_check_mask?
On Thu, Jan 19, 2012 at 5:14 PM, Keir Fraser <keir.xen@gmail.com> wrote:> > On 19/01/2012 09:02, "Kai Huang" <mail.kai.huang@gmail.com> wrote: > >> Hi, >> >> I see cpu_raise_softirq calls smp_send_event_check_mask after setting >> softirq bit for target CPU if target CPU is not the current CPU. I >> thought smp_send_event_check_mask will send IPI to target CPU and then >> trigger target CPU to run pending irq, but seems >> smp_send_event_check_mask does nothing but jast ACK the IPI. So what''s >> the purpose of this function? Why do we need this function? > > Xen always checks softirqs on return from interrupt context to guest > context, and also in its idle loopon wakeup. Hence the event_check interrupt > handler itself doesn''t need to do anything.Does this mean if raising softirq for remote CPU, we don''t need to call do_softirq explicitly on target CPU? -cody> >> BTW, would someone gives me some knowledge when will the pending irqs >> be triggered to run after setting up the pending bits? Seems normally >> they are called asynchronously. > > Yes, of course it''s asynchronous, the smp_send_event_check_mask interrupt is > just to make sure it happens "soon". > > -- Keir > >> Thanks in advance! >> >> -cody >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel > >
Keir Fraser
2012-Jan-19 09:49 UTC
Re: [question] what''s the purpose of smp_send_event_check_mask?
On 19/01/2012 09:26, "Kai Huang" <mail.kai.huang@gmail.com> wrote:> On Thu, Jan 19, 2012 at 5:14 PM, Keir Fraser <keir.xen@gmail.com> wrote: >> >> On 19/01/2012 09:02, "Kai Huang" <mail.kai.huang@gmail.com> wrote: >> >>> Hi, >>> >>> I see cpu_raise_softirq calls smp_send_event_check_mask after setting >>> softirq bit for target CPU if target CPU is not the current CPU. I >>> thought smp_send_event_check_mask will send IPI to target CPU and then >>> trigger target CPU to run pending irq, but seems >>> smp_send_event_check_mask does nothing but jast ACK the IPI. So what''s >>> the purpose of this function? Why do we need this function? >> >> Xen always checks softirqs on return from interrupt context to guest >> context, and also in its idle loopon wakeup. Hence the event_check interrupt >> handler itself doesn''t need to do anything. > > Does this mean if raising softirq for remote CPU, we don''t need to > call do_softirq explicitly on target CPU?That''s right, it''s called automatically from various places, which you can grep for. -- Keir> -cody > >> >>> BTW, would someone gives me some knowledge when will the pending irqs >>> be triggered to run after setting up the pending bits? Seems normally >>> they are called asynchronously. >> >> Yes, of course it''s asynchronous, the smp_send_event_check_mask interrupt is >> just to make sure it happens "soon". >> >> -- Keir >> >>> Thanks in advance! >>> >>> -cody >>> >>> _______________________________________________ >>> Xen-devel mailing list >>> Xen-devel@lists.xensource.com >>> http://lists.xensource.com/xen-devel >> >>
Kai Huang
2012-Jan-19 09:52 UTC
Re: [question] what''s the purpose of smp_send_event_check_mask?
On Thu, Jan 19, 2012 at 5:26 PM, Kai Huang <mail.kai.huang@gmail.com> wrote:> On Thu, Jan 19, 2012 at 5:14 PM, Keir Fraser <keir.xen@gmail.com> wrote: >> >> On 19/01/2012 09:02, "Kai Huang" <mail.kai.huang@gmail.com> wrote: >> >>> Hi, >>> >>> I see cpu_raise_softirq calls smp_send_event_check_mask after setting >>> softirq bit for target CPU if target CPU is not the current CPU. I >>> thought smp_send_event_check_mask will send IPI to target CPU and then >>> trigger target CPU to run pending irq, but seems >>> smp_send_event_check_mask does nothing but jast ACK the IPI. So what''s >>> the purpose of this function? Why do we need this function? >> >> Xen always checks softirqs on return from interrupt context to guest >> context, and also in its idle loopon wakeup. Hence the event_check interrupt >> handler itself doesn''t need to do anything. > > Does this mean if raising softirq for remote CPU, we don''t need to > call do_softirq explicitly on target CPU? >I think I understand now after looking at the code. When interrupt returns, if there''s any pending softirqs, the do_softirq will be called. do_softirq will run handler for all pending bits and additional call to do_softirq will have no harm as it just do nothing if no bits are pending. Thanks. -cody> -cody > >> >>> BTW, would someone gives me some knowledge when will the pending irqs >>> be triggered to run after setting up the pending bits? Seems normally >>> they are called asynchronously. >> >> Yes, of course it''s asynchronous, the smp_send_event_check_mask interrupt is >> just to make sure it happens "soon". >> >> -- Keir >> >>> Thanks in advance! >>> >>> -cody >>> >>> _______________________________________________ >>> Xen-devel mailing list >>> Xen-devel@lists.xensource.com >>> http://lists.xensource.com/xen-devel >> >>