All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>, Alexander Graf <agraf@suse.de>,
	kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 3/9] KVM: PPC: Book3S: Add kernel emulation for the XICS interrupt controller
Date: Thu, 21 Feb 2013 01:45:15 +0000	[thread overview]
Message-ID: <1361411115.31212.17@snotra> (raw)
In-Reply-To: <20130221010955.GA30853@amt.cnet> (from mtosatti@redhat.com on Wed Feb 20 19:09:55 2013)

On 02/20/2013 07:09:55 PM, Marcelo Tosatti wrote:
> On Wed, Feb 20, 2013 at 06:20:51PM -0600, Scott Wood wrote:
> > On 02/20/2013 01:58:54 PM, Marcelo Tosatti wrote:
> > >This is probably a stupid question, but why the
> > >KVM_SET_IRQCHIP/KVM_SET_GSI_ROUTING interface is not appropriate  
> for
> > >your purposes?
> > >
> > >x86 sets up a default GSI->IRQCHIP PIN mapping on creation (during
> > >KVM_SET_IRQCHIP), but it can be modified with KVM_SET_GSI_ROUTING.
> >
> > To start, the whole IRQ routing stuff is poorly documented.
> >
> > Am I supposed to make up GSI numbers and use the routing thing to
> > associate them with real interrupts?
> 
> I have no idea. Is mapping from one integer linear space (GSIs)
> to real interrupts suitable for you?

I can live with it.

> > Where does the code live to manage this table, and how APICy is it  
> (looks like the
> > answer is "irq_comm.c, and very")?
> 
> Thinking faster than typing? Not sure what you mean.

Sorry...  The code to manage the table lives in virt/kvm/irq_comm.c.   
That code is very APIC-specific and not currently in a state that  
invites sharing.

> > It looks like I'm going to have to do this anyway for irqfd, though
> > that doesn't make the other uses of the device control api go away.
> > Even KVM_DEV_MPIC_GRP_IRQ_ACTIVE would still be useful for reading
> > the status for debugging (reading device registers doesn't quite do
> > it, since the "active" bit won't show up if the interrupt is
> > masked).
> 
> > At that point, is it more offensive to make it read-only
> > even though it would be trivial to make it read/write (which would
> > allow users who don't need it to bypass the routing API), or to make
> > it read/write and live with there being more than one way to do
> > something?
> 
> Can't follow this sentence.

Suppose, for the sake of irqfd (and maillist tranquility) MPIC uses  
existing KVM_IRQ_LINE and such.  Will there be objection to being able  
to use KVM_GET_DEVICE_ATTR to *get* the irq line status for debugging  
purposes (maybe also useful for migration)?  If there's no objection to  
that, would there be any actual reason, beyond saving a few lines of  
glue code, to make it a read-only attribute?

> > KVM_SET_IRQCHIP is not suitable because we have more than 512 bytes
> > of state, and because it doesn't allow debugging access to device
> > registers (e.g. inspecting from the QEMU command line), and because
> > it's hard to add new pieces of state if we realize we left something
> > out.  It reminds be of GET/SET_SREGS.  With that, I did what you
> > seem to want here, which is to adapt the existing interfaces, using
> > feature flags to control optional state.  It ended up being a mess,
> > and ONE_REG was introduced as a replacement.  The device control API
> > is the equivalent of ONE_REG for things other than vcpus.
> >
> > -Scott
> 
> - ACK on 512 bytes not sufficient. Add another ioctl, SET_IRQCHIP2?

Well, that's what KVM_SET_DEVICE_ATTR is.

> - Agree on poor extensibility of interface. Adding a reserved amount
> of space as padding and versioning such as has been done so far
> is not acceptable?

That's exactly what we did with SREGS, and it got declared a mess and  
replaced with ONE_REG.  I'm trying to learn from my mistakes. :-)

> - Debugging: why is reading entire register state not acceptable? Yes,
>   its slow.

For one, it's more work.  The current way works by simulating a guest  
MMIO access.  No blob format to design, implement, and keep compatible.

-Scott

WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>, Alexander Graf <agraf@suse.de>,
	<kvm@vger.kernel.org>, <kvm-ppc@vger.kernel.org>
Subject: Re: [PATCH 3/9] KVM: PPC: Book3S: Add kernel emulation for the XICS interrupt controller
Date: Wed, 20 Feb 2013 19:45:15 -0600	[thread overview]
Message-ID: <1361411115.31212.17@snotra> (raw)
In-Reply-To: <20130221010955.GA30853@amt.cnet> (from mtosatti@redhat.com on Wed Feb 20 19:09:55 2013)

On 02/20/2013 07:09:55 PM, Marcelo Tosatti wrote:
> On Wed, Feb 20, 2013 at 06:20:51PM -0600, Scott Wood wrote:
> > On 02/20/2013 01:58:54 PM, Marcelo Tosatti wrote:
> > >This is probably a stupid question, but why the
> > >KVM_SET_IRQCHIP/KVM_SET_GSI_ROUTING interface is not appropriate  
> for
> > >your purposes?
> > >
> > >x86 sets up a default GSI->IRQCHIP PIN mapping on creation (during
> > >KVM_SET_IRQCHIP), but it can be modified with KVM_SET_GSI_ROUTING.
> >
> > To start, the whole IRQ routing stuff is poorly documented.
> >
> > Am I supposed to make up GSI numbers and use the routing thing to
> > associate them with real interrupts?
> 
> I have no idea. Is mapping from one integer linear space (GSIs)
> to real interrupts suitable for you?

I can live with it.

> > Where does the code live to manage this table, and how APICy is it  
> (looks like the
> > answer is "irq_comm.c, and very")?
> 
> Thinking faster than typing? Not sure what you mean.

Sorry...  The code to manage the table lives in virt/kvm/irq_comm.c.   
That code is very APIC-specific and not currently in a state that  
invites sharing.

> > It looks like I'm going to have to do this anyway for irqfd, though
> > that doesn't make the other uses of the device control api go away.
> > Even KVM_DEV_MPIC_GRP_IRQ_ACTIVE would still be useful for reading
> > the status for debugging (reading device registers doesn't quite do
> > it, since the "active" bit won't show up if the interrupt is
> > masked).
> 
> > At that point, is it more offensive to make it read-only
> > even though it would be trivial to make it read/write (which would
> > allow users who don't need it to bypass the routing API), or to make
> > it read/write and live with there being more than one way to do
> > something?
> 
> Can't follow this sentence.

Suppose, for the sake of irqfd (and maillist tranquility) MPIC uses  
existing KVM_IRQ_LINE and such.  Will there be objection to being able  
to use KVM_GET_DEVICE_ATTR to *get* the irq line status for debugging  
purposes (maybe also useful for migration)?  If there's no objection to  
that, would there be any actual reason, beyond saving a few lines of  
glue code, to make it a read-only attribute?

> > KVM_SET_IRQCHIP is not suitable because we have more than 512 bytes
> > of state, and because it doesn't allow debugging access to device
> > registers (e.g. inspecting from the QEMU command line), and because
> > it's hard to add new pieces of state if we realize we left something
> > out.  It reminds be of GET/SET_SREGS.  With that, I did what you
> > seem to want here, which is to adapt the existing interfaces, using
> > feature flags to control optional state.  It ended up being a mess,
> > and ONE_REG was introduced as a replacement.  The device control API
> > is the equivalent of ONE_REG for things other than vcpus.
> >
> > -Scott
> 
> - ACK on 512 bytes not sufficient. Add another ioctl, SET_IRQCHIP2?

Well, that's what KVM_SET_DEVICE_ATTR is.

> - Agree on poor extensibility of interface. Adding a reserved amount
> of space as padding and versioning such as has been done so far
> is not acceptable?

That's exactly what we did with SREGS, and it got declared a mess and  
replaced with ONE_REG.  I'm trying to learn from my mistakes. :-)

> - Debugging: why is reading entire register state not acceptable? Yes,
>   its slow.

For one, it's more work.  The current way works by simulating a guest  
MMIO access.  No blob format to design, implement, and keep compatible.

-Scott

  reply	other threads:[~2013-02-21  1:45 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 23:59 [PATCH 0/9] In-kernel XICS interrupt controller emulation Paul Mackerras
2013-02-14 23:59 ` Paul Mackerras
2013-02-14 23:59 ` [PATCH 1/9] KVM: PPC: Book3S: Add infrastructure to implement kernel-side RTAS calls Paul Mackerras
2013-02-14 23:59   ` Paul Mackerras
2013-03-21  8:52   ` Alexander Graf
2013-03-21  8:52     ` Alexander Graf
2013-04-04  5:37     ` Paul Mackerras
2013-04-04  5:37       ` Paul Mackerras
2013-04-04  9:49       ` Alexander Graf
2013-04-04  9:49         ` Alexander Graf
2013-04-04 22:38         ` Paul Mackerras
2013-04-04 22:38           ` Paul Mackerras
2013-04-19 15:16           ` Alexander Graf
2013-04-19 15:16             ` Alexander Graf
2013-02-15  0:00 ` [PATCH 2/9] KVM: PPC: Remove unused argument to kvmppc_core_dequeue_external Paul Mackerras
2013-02-15  0:00   ` Paul Mackerras
2013-03-21  8:58   ` Alexander Graf
2013-03-21  8:58     ` Alexander Graf
2013-02-15  0:01 ` [PATCH 3/9] KVM: PPC: Book3S: Add kernel emulation for the XICS interrupt controller Paul Mackerras
2013-02-15  0:01   ` Paul Mackerras
2013-02-15 20:05   ` Scott Wood
2013-02-15 20:05     ` Scott Wood
2013-02-15 23:18     ` Paul Mackerras
2013-02-15 23:18       ` Paul Mackerras
2013-02-15 23:59       ` Scott Wood
2013-02-15 23:59         ` Scott Wood
2013-02-16  2:56         ` Paul Mackerras
2013-02-16  2:56           ` Paul Mackerras
2013-02-16  3:57           ` Scott Wood
2013-02-16  3:57             ` Scott Wood
2013-02-16  4:51             ` Paul Mackerras
2013-02-16  4:51               ` Paul Mackerras
2013-02-18 22:43               ` Scott Wood
2013-02-18 22:43                 ` Scott Wood
2013-02-20  0:41                 ` Paul Mackerras
2013-02-20  0:41                   ` Paul Mackerras
2013-02-20  1:01                   ` Scott Wood
2013-02-20  1:01                     ` Scott Wood
2013-02-20 19:58           ` Marcelo Tosatti
2013-02-20 19:58             ` Marcelo Tosatti
2013-02-21  0:20             ` Scott Wood
2013-02-21  0:20               ` Scott Wood
2013-02-21  1:09               ` Marcelo Tosatti
2013-02-21  1:09                 ` Marcelo Tosatti
2013-02-21  1:45                 ` Scott Wood [this message]
2013-02-21  1:45                   ` Scott Wood
2013-02-24 14:08               ` Gleb Natapov
2013-02-24 14:08                 ` Gleb Natapov
2013-02-25  0:59             ` Paul Mackerras
2013-02-25  0:59               ` Paul Mackerras
2013-03-21  9:20               ` Alexander Graf
2013-03-21  9:20                 ` Alexander Graf
2013-02-15  0:01 ` [PATCH 4/9] KVM: PPC: Book3S: Generalize interfaces to interrupt controller emulation Paul Mackerras
2013-02-15  0:01   ` Paul Mackerras
2013-02-15  0:02 ` [PATCH 5/9] KVM: PPC: Book3S: Facilities to save/restore XICS presentation ctrler state Paul Mackerras
2013-02-15  0:02   ` Paul Mackerras
2013-02-15  0:02 ` [PATCH 6/9] KVM: PPC: Book3S HV: Speed up wakeups of CPUs on HV KVM Paul Mackerras
2013-02-15  0:02   ` Paul Mackerras
2013-02-15  0:03 ` [PATCH 7/9] KVM: PPC: Book3S HV: Add support for real mode ICP in XICS emulation Paul Mackerras
2013-02-15  0:03   ` Paul Mackerras
2013-02-15  0:03 ` [PATCH 8/9] KVM: PPC: Book3S HV: Improve real-mode handling of external interrupts Paul Mackerras
2013-02-15  0:03   ` Paul Mackerras
2013-02-15  0:04 ` [PATCH 9/9] KVM: PPC: Book3S: Add support for ibm,int-on/off RTAS calls Paul Mackerras
2013-02-15  0:04   ` Paul Mackerras

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=1361411115.31212.17@snotra \
    --to=scottwood@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=paulus@samba.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 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.