lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53EB3337.3030809@suse.com>
Date:	Wed, 13 Aug 2014 11:43:19 +0200
From:	Juergen Gross <jgross@...e.com>
To:	David Vrabel <david.vrabel@...rix.com>,
	xen-devel@...ts.xenproject.org, konrad.wilk@...cle.com,
	linux-kernel@...r.kernel.org
Subject: Re: [Xen-devel] [PATCH] Make bind_interdomain_evtchn_to_irq() public

On 08/13/2014 11:29 AM, David Vrabel wrote:
> On 12/08/14 14:43, jgross@...e.com wrote:
>> From: Juergen Gross <jgross@...e.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ