public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Chris Wright <chrisw@sous-sol.org>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] kvm-kmod: fix kvm_request_irq race
Date: Thu, 21 May 2009 09:29:01 +0300	[thread overview]
Message-ID: <4A14F4AD.9060408@redhat.com> (raw)
In-Reply-To: <20090521062135.GR20823@sequoia.sous-sol.org>

Chris Wright wrote:
> Commit "32658734: Fix request_irq() for < 2.6.19" is racy between multiple
> guests since ioctl is only serialized per guest.  Add mutex and serialize
> kvm_request_irq/kvm_free_irq to avoid race.
>
> Signed-off-by: Chris Wright <chrisw@redhat.com>
> ---
>  external-module-compat-comm.h |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
> index 8cb5440..eaad986 100644
> --- a/external-module-compat-comm.h
> +++ b/external-module-compat-comm.h
> @@ -645,6 +645,7 @@ static inline int pci_reset_function(struct pci_dev *dev)
>  
>  typedef irqreturn_t (*kvm_irq_handler_t)(int, void *);
>  static kvm_irq_handler_t kvm_irq_handlers[NR_IRQS];
> +static DEFINE_MUTEX(kvm_irq_handlers_mutex);
>  
>   

Since this mutex is in a header file, it can be instantiated multiple 
times.  It will only serialize callers within a translation unit.  
Please define it in a C file.

Would be best to move the the code as well.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


  reply	other threads:[~2009-05-21  6:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-21  6:21 [PATCH] kvm-kmod: fix kvm_request_irq race Chris Wright
2009-05-21  6:29 ` Avi Kivity [this message]
2009-05-21  6:38   ` Chris Wright
2009-05-21  7:38   ` [PATCH kvm-kmod v2] " Chris Wright
2009-05-21  7:45     ` Avi Kivity

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=4A14F4AD.9060408@redhat.com \
    --to=avi@redhat.com \
    --cc=chrisw@sous-sol.org \
    --cc=kvm@vger.kernel.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