public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: David Hildenbrand <david@redhat.com>
Cc: "Dmitry Vyukov" <dvyukov@google.com>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"KVM list" <kvm@vger.kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	stable <stable@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail
Date: Fri, 24 Mar 2017 10:33:55 +0100	[thread overview]
Message-ID: <20170324103355.73bb95ec.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <0dd97243-db9b-4d22-970e-489d0f491851@redhat.com>

On Fri, 24 Mar 2017 09:55:15 +0100
David Hildenbrand <david@redhat.com> wrote:

> 
> >>> -             return r;
> >>> +     if (i == bus->dev_count)
> >>> +             return;
> >>>
> >>>       new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count - 1) *
> >>>                         sizeof(struct kvm_io_range)), GFP_KERNEL);
> >>> -     if (!new_bus)
> >>> -             return -ENOMEM;
> >>> +     if (!new_bus)  {
> >>> +             pr_err("kvm: failed to shrink bus, removing it completely\n");
> >>> +             goto broken;
> >>
> >> The guest will fail in mysterious ways, if you do this (and
> >> io_bus_unregister_dev can be called during runtime): in-kernel device
> >> accesses will fail with unknown behaviour in the guest.
> 
> Actually, the next access to the BUS should result in -ENOMEM. And the
> error message should be enough to then figure out what went wrong.

Hopefully, an admin will look at the logs :)

But yes, the patch should have caught all issues in the host, and the
guest will basically be presented with broken "hardware".

> However, to hit this scenario at all feels very unlikely. So I would
> like to avoid advanced allocation schemes.

Agreed, spending too much time on complex recovery scenarios is
overkill for this unlikely case.

  reply	other threads:[~2017-03-24  9:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 17:24 [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail David Hildenbrand
2017-03-23 17:31 ` Cornelia Huck
2017-03-23 20:42 ` Marcelo Tosatti
2017-03-24  8:48   ` Dmitry Vyukov
2017-03-24  8:55     ` David Hildenbrand
2017-03-24  9:33       ` Cornelia Huck [this message]
2017-03-24 10:33     ` Marcelo Tosatti
2017-03-24 14:40       ` Cornelia Huck

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=20170324103355.73bb95ec.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=david@redhat.com \
    --cc=dvyukov@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=stable@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