qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: Julia Suvorova <jusual@redhat.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 1/1] pci/pcie: refuse another hotplug/unplug event if attention button is pending
Date: Thu, 30 Jul 2020 13:38:53 +0200	[thread overview]
Message-ID: <20200730133853.048b64ce@redhat.com> (raw)
In-Reply-To: <1111d100381f431c1ffeabf1f2c7c74ba79a2af5.camel@redhat.com>

On Wed, 29 Jul 2020 08:09:37 +0300
Maxim Levitsky <mlevitsk@redhat.com> wrote:

> On Wed, 2020-07-22 at 19:19 +0300, Maxim Levitsky wrote:
> > On Wed, 2020-07-22 at 19:17 +0300, Maxim Levitsky wrote:  
> > > Curently it is possible to hotplug a device and then immediatly
> > > hotunplug it before the OS notices, and that will result
> > > in missed unplug event since we can only send one attention button event.
> > > 
> > > Moreover the device will stuck in unplugging state forever.
> > > 
> > > Error out in such cases and rely on the caller (e.g libvirt) to retry
> > > the unplug a bit later
> > > 
> > > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > > ---
> > >  hw/pci/pcie.c | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
> > > index 5b48bae0f6..9e836cf2f4 100644
> > > --- a/hw/pci/pcie.c
> > > +++ b/hw/pci/pcie.c
> > > @@ -402,6 +402,17 @@ static void pcie_cap_slot_plug_common(PCIDevice *hotplug_dev, DeviceState *dev,
> > >           */
> > >          error_setg_errno(errp, EBUSY, "slot is electromechanically locked");
> > >      }
> > > +
> > > +    if (sltsta & PCI_EXP_SLTSTA_ABP) {
> > > +        /*
> > > +         * Attention button is pressed, thus we can't send another
> > > +         * hotpplug event  
> > Typo here, forgot to refresh the commit.  
> > > +         */
> > > +        error_setg_errno(errp, EBUSY,
> > > +                         "attention button is already pressed, can't "
> > > +                         "send another hotplug event");
> > > +    }
> > > +
> > >  }
> > >  
> > >  void pcie_cap_slot_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,  
> ping.

CCing Julia since she was looking into PCI hotplug/unplug code recently.

> 
> Best regards,
> 	Maxim Levitsky
> 
> 



  reply	other threads:[~2020-07-30 11:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 16:17 [PATCH 0/1] RFC: pcie: parital fix for missing unplug events Maxim Levitsky
2020-07-22 16:17 ` [PATCH 1/1] pci/pcie: refuse another hotplug/unplug event if attention button is pending Maxim Levitsky
2020-07-22 16:19   ` Maxim Levitsky
2020-07-29  5:09     ` Maxim Levitsky
2020-07-30 11:38       ` Igor Mammedov [this message]
2020-07-30 16:04   ` Michael S. Tsirkin
2020-07-30 16:05 ` [PATCH 0/1] RFC: pcie: parital fix for missing unplug events Michael S. Tsirkin

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=20200730133853.048b64ce@redhat.com \
    --to=imammedo@redhat.com \
    --cc=jusual@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).