public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: David Vrabel <david.vrabel@citrix.com>,
	xen-devel@lists.xenproject.org, konrad.wilk@oracle.com,
	linux-kernel@vger.kernel.org
Subject: Re: [Xen-devel] [PATCH] Make bind_interdomain_evtchn_to_irq() public
Date: Wed, 13 Aug 2014 11:43:19 +0200	[thread overview]
Message-ID: <53EB3337.3030809@suse.com> (raw)
In-Reply-To: <53EB3014.8090008@citrix.com>

On 08/13/2014 11:29 AM, David Vrabel wrote:
> On 12/08/14 14:43, jgross@suse.com wrote:
>> From: Juergen Gross <jgross@suse.com>
>>
>> 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

  reply	other threads:[~2014-08-13  9:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 13:43 [PATCH] Make bind_interdomain_evtchn_to_irq() public jgross
2014-08-13  9:29 ` [Xen-devel] " David Vrabel
2014-08-13  9:43   ` Juergen Gross [this message]
2014-08-13  9:54     ` David Vrabel
2014-08-13 10:04       ` Juergen Gross
2014-08-13  9:53 ` David Vrabel
2014-08-13 10:04   ` [Xen-devel] " Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53EB3337.3030809@suse.com \
    --to=jgross@suse.com \
    --cc=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox