Re: [Xen-devel] [PATCH] Make bind_interdomain_evtchn_to_irq() public

From: Juergen Gross
Date: Wed Aug 13 2014 - 05:43:28 EST


On 08/13/2014 11:29 AM, David Vrabel wrote:
On 12/08/14 14:43, jgross@xxxxxxxx wrote:
From: Juergen Gross <jgross@xxxxxxxx>

bind_interdomain_evtchn_to_irq() is currently a private function. It is used
only by bind_interdomain_evtchn_to_irqhandler() to register an irq-handler for
an event channel.

By making it public it is possible to use e.g. threaded interrupts with
interdomain event channels.

Can you give an example of using this? Maybe we want a
bind_interdomain_evtchn_to_threaded_irqhandler() instead? Or add a flags
field to the existing function.

Instead of

static int scsiback_schedule(void *data)
{
struct vscsibk_info *info = (struct vscsibk_info *)data;

while (!kthread_should_stop()) {
wait_event_interruptible(info->wq,
info->waiting_reqs || kthread_should_stop());

info->waiting_reqs = 0;
smp_mb(); /* waiting_reqs used by other thread */

switch (scsiback_do_cmd_fn(info)) {
case 1:
info->waiting_reqs = 1;
default:
break;
}
cond_resched();
}
return 0;
}

static void scsiback_notify_work(struct vscsibk_info *info)
{
info->waiting_reqs = 1;
wake_up(&info->wq);
}

static irqreturn_t scsiback_intr(int irq, void *dev_id)
{
scsiback_notify_work((struct vscsibk_info *)dev_id);
return IRQ_HANDLED;
}

static int scsiback_init_sring(struct vscsibk_info *info, grant_ref_t ring_ref,
evtchn_port_t evtchn)
{
...
bind_interdomain_evtchn_to_irqhandler(
info->domid, evtchn,
scsiback_intr, 0, "vscsiif-backend", info);

...
info->kthread = kthread_run(scsiback_schedule, info, name);
...
}


I only need the following:

static irqreturn_t scsiback_irq_fn(int irq, void *dev_id)
{
struct vscsibk_info *info = dev_id;

while (scsiback_do_cmd_fn(info))
cond_resched();

return IRQ_HANDLED;
}

static int scsiback_init_sring(struct vscsibk_info *info, grant_ref_t ring_ref,
evtchn_port_t evtchn)
{
...
irq = bind_interdomain_evtchn_to_irq(info->domid, evtchn);
request_threaded_irq(irq, NULL, scsiback_irq_fn,
IRQF_ONESHOT, "vscsiif-backend", info)
...
}


So yes, it could be done via a flag, too.

Juergen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/