Make bind_interdomain_evtchn_to_irq() public
[email protected]
maintainerPATCH 1/1 Make bind_interdomain_evtchn_to_irq() public
From: Juergen Gross <[email protected]>
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.
--- drivers/xen/events/events_base.c | 5 +++-- include/xen/events.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/xen/events/events_base.c +3 -2
@@ -900,8 +900,8 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)return irq; } -static int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, -unsigned int remote_port) +int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, +unsigned int remote_port) {struct evtchn_bind_interdomain bind_interdomain;int err;
@@ -914,6 +914,7 @@ static int bind_interdomain_evtchn_to_irq(unsigned int remote_domain,return err ? :bind_evtchn_to_irq (bind_interdomain.local_port); } +EXPORT_SYMBOL_GPL (bind_interdomain_evtchn_to_irq);static int find_virq (unsigned int virq,unsigned int cpu) {
include/xen/events.h +2 -0
@@ -28,6 +28,8 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,unsigned long irqflags, const char *devname, void *dev_id); +int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, +unsigned int remote_port); int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, unsigned int remote_port, irq_handler_t handler,
Signature · 1 line
1.8.4.5
Quoted 8 lines · On 12/08/14 14:43, [email protected] wrote:
From: Juergen Gross <[email protected]>
bind_interdomain_evtchn_to_irq()is currently a private function. It is used only bybind_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.
David
Quoted 35 lines
drivers/xen/events/events_base.c +3
-2@@ -900,8 +900,8 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)return irq; } -static int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, -unsigned int remote_port) +int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, +unsigned int remote_port) {struct evtchn_bind_interdomain bind_interdomain;int err;@@ -914,6 +914,7 @@ static int bind_interdomain_evtchn_to_irq(unsigned int remote_domain,return err ? :bind_evtchn_to_irq (bind_interdomain.local_port); } +EXPORT_SYMBOL_GPL (bind_interdomain_evtchn_to_irq);static int find_virq (unsigned int virq,unsigned int cpu) {include/xen/events.h +2
-0@@ -28,6 +28,8 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,unsigned long irqflags, const char *devname, void *dev_id); +int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, +unsigned int remote_port); int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, unsigned int remote_port, irq_handler_t handler,
Juergen Gross
maintainerQuoted 7 lines · David Vrabel
Quoted 6 lines · On 12/08/14 14:43, [email protected] wrote:
From: Juergen Gross <[email protected]>
bind_interdomain_evtchn_to_irq()is currently a private function. It is used only bybind_interdomain_evtchn_to_irqhandler()to register an irq-handler for an event channel.
Quoted 6 lines
Quoted 2 lines
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
Juergen Gross
maintainerQuoted 7 lines · David Vrabel
Quoted 6 lines · On 12/08/14 14:43, [email protected] wrote:
From: Juergen Gross <[email protected]>
bind_interdomain_evtchn_to_irq()is currently a private function. It is used only bybind_interdomain_evtchn_to_irqhandler()to register an irq-handler for an event channel.
Quoted 6 lines
Quoted 2 lines
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
Quoted 10 lines · Juergen Gross
static int scsiback_init_sring(struct
vscsibk_info*info,grant_ref_tring_ref,
evtchn_port_tevtchn)
{
...
irq =bind_interdomain_evtchn_to_irq(info->domid, evtchn); request_threaded_irq(irq, NULL,scsiback_irq_fn,
IRQF_ONESHOT, "vscsiif-backend", info)
...
This usage is fine.
I assume the error checking of bind_interdomain_evtchn_to_irq() and request_threaded_irq() was omitted for clarity in this example?
David
Juergen Gross
maintainerQuoted 12 lines · David Vrabel
Quoted 10 lines · Juergen Gross
static int scsiback_init_sring(struct
vscsibk_info*info,grant_ref_tring_ref,
evtchn_port_tevtchn)
{
...
irq =bind_interdomain_evtchn_to_irq(info->domid, evtchn); request_threaded_irq(irq, NULL,scsiback_irq_fn,
IRQF_ONESHOT, "vscsiif-backend", info)
...
Quoted 4 lines
This usage is fine.
I assume the error checking of
bind_interdomain_evtchn_to_irq()andrequest_threaded_irq()was omitted for clarity in this example?
Sure.
Juergen
Juergen Gross
maintainerQuoted 12 lines · David Vrabel
Quoted 10 lines · Juergen Gross
static int scsiback_init_sring(struct
vscsibk_info*info,grant_ref_tring_ref,
evtchn_port_tevtchn)
{
...
irq =bind_interdomain_evtchn_to_irq(info->domid, evtchn); request_threaded_irq(irq, NULL,scsiback_irq_fn,
IRQF_ONESHOT, "vscsiif-backend", info)
...
Quoted 4 lines
This usage is fine.
I assume the error checking of
bind_interdomain_evtchn_to_irq()andrequest_threaded_irq()was omitted for clarity in this example?
Sure.
Juergen
Quoted 10 lines · Juergen Gross
static int scsiback_init_sring(struct
vscsibk_info*info,grant_ref_tring_ref,
evtchn_port_tevtchn)
{
...
irq =bind_interdomain_evtchn_to_irq(info->domid, evtchn); request_threaded_irq(irq, NULL,scsiback_irq_fn,
IRQF_ONESHOT, "vscsiif-backend", info)
...
This usage is fine.
I assume the error checking of bind_interdomain_evtchn_to_irq() and request_threaded_irq() was omitted for clarity in this example?
David
Quoted 8 lines · On 12/08/14 14:43, [email protected] wrote:
From: Juergen Gross <[email protected]>
bind_interdomain_evtchn_to_irq()is currently a private function. It is used only bybind_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.
David
Quoted 35 lines
drivers/xen/events/events_base.c +3
-2@@ -900,8 +900,8 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)return irq; } -static int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, -unsigned int remote_port) +int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, +unsigned int remote_port) {struct evtchn_bind_interdomain bind_interdomain;int err;@@ -914,6 +914,7 @@ static int bind_interdomain_evtchn_to_irq(unsigned int remote_domain,return err ? :bind_evtchn_to_irq (bind_interdomain.local_port); } +EXPORT_SYMBOL_GPL (bind_interdomain_evtchn_to_irq);static int find_virq (unsigned int virq,unsigned int cpu) {include/xen/events.h +2
-0@@ -28,6 +28,8 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,unsigned long irqflags, const char *devname, void *dev_id); +int bind_interdomain_evtchn_to_irq (unsigned int remote_domain, +unsigned int remote_port); int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, unsigned int remote_port, irq_handler_t handler,
Quoted 8 lines · On 12/08/14 14:43, [email protected] wrote:
From: Juergen Gross <[email protected]>
bind_interdomain_evtchn_to_irq()is currently a private function. It is used only bybind_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.
But can you change the subject/commit message to:
xen/events: support threaded irqs for interdomain event channels
Export bind_interdomain_evtchn_to_irq() so drivers can use threaded
interrupt handlers with:
irq = bind_interdomain_evtchn_to_irq(remote_dom, remote_port);
if (irq < 0)
/* error */
ret = request_threaded_irq(...);Since your pvscsi series depends on this you will want to add this to that series to be merged via the scsi tree.
David
Juergen Gross
maintainerQuoted 24 lines · David Vrabel
Quoted 8 lines · On 12/08/14 14:43, [email protected] wrote:
From: Juergen Gross <[email protected]>
bind_interdomain_evtchn_to_irq()is currently a private function. It is used only bybind_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.
Acked-by David Vrabel <[email protected]>But can you change the subject/commit message to:
xen/events: support threaded irqs for interdomain event channels Export bind_interdomain_evtchn_to_irq() so drivers can use threaded interrupt handlers with: irq = bind_interdomain_evtchn_to_irq(remote_dom, remote_port); if (irq < 0) /* error */ ret = request_threaded_irq(...);
Quoted 2 lines
Since your pvscsi series depends on this you will want to add this to that series to be merged via the scsi tree.
Already done locally. :-)
Juergen
Juergen Gross
maintainerQuoted 24 lines · David Vrabel
Quoted 8 lines · On 12/08/14 14:43, [email protected] wrote:
From: Juergen Gross <[email protected]>
bind_interdomain_evtchn_to_irq()is currently a private function. It is used only bybind_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.
Acked-by David Vrabel <[email protected]>But can you change the subject/commit message to:
xen/events: support threaded irqs for interdomain event channels Export bind_interdomain_evtchn_to_irq() so drivers can use threaded interrupt handlers with: irq = bind_interdomain_evtchn_to_irq(remote_dom, remote_port); if (irq < 0) /* error */ ret = request_threaded_irq(...);
Quoted 2 lines
Since your pvscsi series depends on this you will want to add this to that series to be merged via the scsi tree.
Already done locally. :-)
Juergen
Quoted 8 lines · On 12/08/14 14:43, [email protected] wrote:
From: Juergen Gross <[email protected]>
bind_interdomain_evtchn_to_irq()is currently a private function. It is used only bybind_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.
But can you change the subject/commit message to:
xen/events: support threaded irqs for interdomain event channels
Export bind_interdomain_evtchn_to_irq() so drivers can use threaded
interrupt handlers with:
irq = bind_interdomain_evtchn_to_irq(remote_dom, remote_port);
if (irq < 0)
/* error */
ret = request_threaded_irq(...);Since your pvscsi series depends on this you will want to add this to that series to be merged via the scsi tree.
David