From: Jeremy Fitzhardinge <jeremy@goop.org>
To: "Han, Weidong" <weidong.han@intel.com>
Cc: "'xen-devel@lists.xensource.com'" <xen-devel@lists.xensource.com>,
"'keir.fraser@eu.citrix.com'" <keir.fraser@eu.citrix.com>
Subject: Re: [PATCH][RFC] pv-ops: fix shared irq device passthrough
Date: Mon, 26 Oct 2009 13:27:50 -0700 [thread overview]
Message-ID: <4AE60646.7050307@goop.org> (raw)
In-Reply-To: <715D42877B251141A38726ABF5CABF2C05509A75F3@pdsmsx503.ccr.corp.intel.com>
On 10/23/09 04:39, Han, Weidong wrote:
> From 9c91f23076c555690488cbd81f889f279d4cf2fa Mon Sep 17 00:00:00 2001
> From: Weidong Han <weidong.han@intel.com>
> Date: Sat, 24 Oct 2009 03:18:30 +0800
> Subject: [PATCH] pv-ops: fix shared irq device passthrough
>
> In driver/xen/events.c, whether bind_pirq is shareable or not is
> determined by desc->action is NULL or not. But in __setup_irq,
> startup(irq) is invoked before desc->action is assigned with
> new action. So desc->action in startup_irq is alwasy NULL, and
> bind_pirq is always not shareable. This results in pt_irq_create_bind
> failure when passthrough a device which shares irq to other devices.
>
> This patch move desc->action before startup(irq), therefore fix
> the problem.
>
Hm, not sure about this. The logic in __setup_irq already looks pretty
tortured, and I'd like to avoid touching it unless there's definitively
a bug in there.
I think the right question is whether probe_irq() is really doing the
right test, and whether it could do something else instead?
J
> Signed-off-by: Weidong Han <weidong.han@intel.com>
> ---
> kernel/irq/manage.c | 14 ++++++++++----
> 1 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 07a11dc..3b85b72 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -565,6 +565,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
> {
> struct irqaction *old, **old_ptr;
> const char *old_name = NULL;
> + int old_irq;
> unsigned long flags;
> int shared = 0;
> int ret;
> @@ -644,6 +645,11 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
> shared = 1;
> }
>
> + old = *old_ptr;
> + old_irq = new->irq;
> + new->irq = irq;
> + *old_ptr = new;
> +
> if (!shared) {
> irq_chip_set_defaults(desc->chip);
>
> @@ -654,8 +660,11 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
> ret = __irq_set_trigger(desc, irq,
> new->flags & IRQF_TRIGGER_MASK);
>
> - if (ret)
> + if (ret) {
> + new->irq = old_irq;
> + *old_ptr = old;
> goto out_thread;
> + }
> } else
> compat_irq_chip_set_default_handler(desc);
> #if defined(CONFIG_IRQ_PER_CPU)
> @@ -690,9 +699,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
> (int)(new->flags & IRQF_TRIGGER_MASK));
> }
>
> - new->irq = irq;
> - *old_ptr = new;
> -
> /* Reset broken irq detection when installing new handler */
> desc->irq_count = 0;
> desc->irqs_unhandled = 0;
>
next prev parent reply other threads:[~2009-10-26 20:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-23 11:39 [PATCH][RFC] pv-ops: fix shared irq device passthrough Han, Weidong
2009-10-26 20:27 ` Jeremy Fitzhardinge [this message]
2009-10-27 1:32 ` Han, Weidong
2009-10-29 22:56 ` Jeremy Fitzhardinge
2009-10-30 9:29 ` Han, Weidong
2009-10-30 21:34 ` Jeremy Fitzhardinge
2009-10-31 13:50 ` Han, Weidong
[not found] ` <715D42877B251141A38726ABF5CABF2C055064A406@pdsmsx503.ccr.corp.intel.com>
2009-11-02 10:12 ` Han, Weidong
2009-11-10 6:12 ` Han, Weidong
2009-11-10 6:30 ` Mr. Teo En Ming (Zhang Enming)
2009-11-10 6:59 ` Han, Weidong
2009-11-10 16:30 ` Konrad Rzeszutek Wilk
2009-11-10 17:11 ` Kay, Allen M
2009-11-10 18:40 ` Konrad Rzeszutek Wilk
2009-11-10 18:44 ` Jeremy Fitzhardinge
2009-11-12 7:15 ` Han, Weidong
2009-11-10 17:56 ` Jeremy Fitzhardinge
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=4AE60646.7050307@goop.org \
--to=jeremy@goop.org \
--cc=keir.fraser@eu.citrix.com \
--cc=weidong.han@intel.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.