kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Yang, Sheng" <sheng.yang@intel.com>
Cc: "'kvm@vger.kernel.org'" <kvm@vger.kernel.org>
Subject: Re: [RFC][PATCH 0/2] Fix guest shared interrupt with in-kernel irqchip
Date: Thu, 02 Oct 2008 16:27:18 +0300	[thread overview]
Message-ID: <48E4CC36.70607@redhat.com> (raw)
In-Reply-To: <D8078B8B3B09934AA9F8F2D5FB3F28CE08A3B9C7B0@pdsmsx502.ccr.corp.intel.com>

Yang, Sheng wrote:
> To deal with guest shared interrupt bug in in-kernel irqchip, we should:
>
> 1. Identify each level trig interrupt source.
> 2. Implement logical OR on the same IRQ line for each interrupt source.
>
> Here I chose a simple method: the caller of kvm_set_irq() has responsiblity
> to identify interrupt sources, and IOAPIC/PIC ensure logical OR on IRQ line.
>   

The downside is that every caller has to do this edge detection.

How about allocating a vector of u32s (one per irq), and each source 
will allocate a bit within this vector.  The 'or' operation becomes 
(word != 0).

For example:

   irq_src = kvm_irq_allocate_source(kvm);  /* allocate bit within irq 
vector */

    ...
 
   kvm_set_irq(kvm, irq, 1, irq_src);

kvm_set_irq(...)
{
    // locking?
    if (level)
        set_bit(irq_src, &kvm->irq_state[irq]);
    else
        clear_bit(irq_src, &kvm->irq_state[irq]);
   kvm_pic_set_irq(kvm, irq, !!kvm->irq_state[irq]);
   kvm_ioapic_set_irq(kvm, irq, !!kvm->irq_state[irq]);
}

kvm_irq_allocate_source(kvm)
{
     irq_src = find_first_clear_bit(kvm->irq_sources);
     set_bit(irq_src, &kvm->irq_sources);
     return irq_src;
}

This also keeps the pic and ioapic out of the picture, which is good.  
It also allows us to implement negative polarity easily in the future.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2008-10-02 13:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02  8:19 [RFC][PATCH 0/2] Fix guest shared interrupt with in-kernel irqchip Yang, Sheng
2008-10-02 13:27 ` Avi Kivity [this message]
2008-10-02 14:06   ` Sheng Yang
2008-10-02 16:45   ` Sheng Yang
2008-10-03  7:36     ` Amit Shah
2008-10-03 10:37       ` Sheng Yang
2008-10-03 10:47         ` Amit Shah
2008-10-04  8:45         ` Avi Kivity
2008-10-04  8:47         ` Avi Kivity
2008-10-06  6:23           ` Sheng Yang
2008-10-06  6:37             ` Sheng Yang
2008-10-10 12:12         ` Amit Shah
2008-10-08  8:29       ` Sheng Yang

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=48E4CC36.70607@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=sheng.yang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).