All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] s390x/flic: adapter routes handling if !kernel_irqchip
Date: Thu, 16 Jan 2020 15:46:24 +0100	[thread overview]
Message-ID: <20200116154624.697c2c92.cohuck@redhat.com> (raw)
In-Reply-To: <57df7c9b-ddd7-3a7a-1113-91f7c1355d10@redhat.com>

On Thu, 16 Jan 2020 13:52:21 +0100
Thomas Huth <thuth@redhat.com> wrote:

> On 16/01/2020 13.37, Cornelia Huck wrote:
> > If the kernel irqchip has been disabled, we don't want the
> > {add,release}_adapter_routes routines to call any kvm_irqchip_*
> > interfaces, as they may rely on an irqchip actually having been
> > created. Just take a quick exit in that case instead.
> > 
> > Fixes: d426d9fba8ea ("s390x/virtio-ccw: wire up irq routing and irqfds")
> > Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> > ---
> > 
> > Without this patch, QEMU with kernel_irqchip=off will crash in
> > kvm_irqchip_release_virq(), so alternatively, we could add a check
> > there. kvm_irqchip_add_adapter_route() is actually fine.
> > 
> > ---
> >  hw/intc/s390_flic_kvm.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
> > index dddd33ea61c8..44b7960ebcc8 100644
> > --- a/hw/intc/s390_flic_kvm.c
> > +++ b/hw/intc/s390_flic_kvm.c
> > @@ -331,6 +331,10 @@ static int kvm_s390_add_adapter_routes(S390FLICState *fs,
> >      int ret, i;
> >      uint64_t ind_offset = routes->adapter.ind_offset;
> >  
> > +    if (!kvm_gsi_routing_enabled()) {
> > +        return -ENOSYS;
> > +    }  
> 
> As you wrote, this check is not really necessary since it is already
> done in  kvm_irqchip_add_adapter_route() ...

I do think it is cleaner, though.

> 
> >      for (i = 0; i < routes->num_routes; i++) {
> >          ret = kvm_irqchip_add_adapter_route(kvm_state, &routes->adapter);
> >          if (ret < 0) {  
> 
> ... so I wonder if it would be simply best to set
> 
>                routes->gsi[i] = -1;
> 
> before the "goto" instead to make sure that
> kvm_s390_release_adapter_routes() does not try to clean it up? That
> would also fix a potential crash in case kvm_irqchip_add_adapter_route()
> returned an error code in case of a different problem, I think.

I think we should pre-initialize gsi[] to -1 instead, just to be on the
safe side.



      reply	other threads:[~2020-01-16 14:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 12:37 [PATCH] s390x/flic: adapter routes handling if !kernel_irqchip Cornelia Huck
2020-01-16 12:52 ` Thomas Huth
2020-01-16 14:46   ` Cornelia Huck [this message]

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=20200116154624.697c2c92.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.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.