From: David Gibson <david@gibson.dropbear.id.au>
To: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, groug@kaod.org
Subject: Re: [PATCH 2/5] spapr.c: check unplug_request flag in spapr_memory_unplug_request()
Date: Tue, 2 Mar 2021 13:03:57 +1100 [thread overview]
Message-ID: <YD2dDcCGenJC27kC@yekko.fritz.box> (raw)
In-Reply-To: <20210226163301.419727-3-danielhb413@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2758 bytes --]
On Fri, Feb 26, 2021 at 01:32:58PM -0300, Daniel Henrique Barboza wrote:
> Now that we're asserting the first DRC LMB earlier, use it to query if
> the DRC is already pending unplug and, in this case, issue the same
> error we already do.
>
> The previous check was introduced in commit 2a129767ebb1 and it works,
> but it's easier to check the unplug_requested flag instead of looking
> for the existence of the sPAPRDIMMState. It's also compliant with what
> is already done in other unplug_request functions for other devices.
>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
I'm having some trouble completely convincing myself this is right.
What about this situation:
1. We initiate a DIMM unplug
- unplug_request is set on all the LMBs
- all the LMBs go on the pending_unplug list
2. The guest encounters no problems, and starts issuing set
indicator calls to mark the LMBs unusable, starting from the
lowest address
3. On drc_set_unusable() for the first LMB, we see that unplug is
requested and call spapr_drc_release()
4. spapr_drc_release() on the first LMB clears unplug_requested
5. At this point, but before this is done on *all* of the DIMM's
LMBs, the user attempts another unplug triggering the code
below
AFAICT this will now skip the error, since the first LMB is no longer
in unplug_requested state, but there *are* still pending unplugs for
some of the remaining LMBs, so the old code would have tripped the
error.
> ---
> hw/ppc/spapr.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 74e046b522..149dc2113f 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -3681,13 +3681,7 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev,
> addr_start / SPAPR_MEMORY_BLOCK_SIZE);
> g_assert(drc_start);
>
> - /*
> - * An existing pending dimm state for this DIMM means that there is an
> - * unplug operation in progress, waiting for the spapr_lmb_release
> - * callback to complete the job (BQL can't cover that far). In this case,
> - * bail out to avoid detaching DRCs that were already released.
> - */
> - if (spapr_pending_dimm_unplugs_find(spapr, dimm)) {
> + if (spapr_drc_unplug_requested(drc_start)) {
> error_setg(errp, "Memory unplug already in progress for device %s",
> dev->id);
> return;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-03-02 2:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 16:32 [PATCH 0/5] send QAPI_EVENT_MEM_UNPLUG_ERROR for ppc64 unplugs Daniel Henrique Barboza
2021-02-26 16:32 ` [PATCH 1/5] spapr.c: assert first DRC LMB earlier in spapr_memory_unplug_request() Daniel Henrique Barboza
2021-03-01 14:11 ` Greg Kurz
2021-02-26 16:32 ` [PATCH 2/5] spapr.c: check unplug_request flag " Daniel Henrique Barboza
2021-03-01 14:13 ` Greg Kurz
2021-03-02 2:03 ` David Gibson [this message]
2021-03-02 10:39 ` Daniel Henrique Barboza
2021-02-26 16:32 ` [PATCH 3/5] spapr.c: add 'unplug already in progress' message for PHB unplug Daniel Henrique Barboza
2021-03-01 14:14 ` Greg Kurz
2021-03-02 2:06 ` David Gibson
2021-02-26 16:33 ` [PATCH 4/5] spapr_pci.c: add 'unplug already in progress' message for PCI unplug Daniel Henrique Barboza
2021-03-01 14:14 ` Greg Kurz
2021-03-02 2:08 ` David Gibson
2021-02-26 16:33 ` [PATCH 5/5] spapr.c: send QAPI event when memory hotunplug fails Daniel Henrique Barboza
2021-03-01 14:19 ` Greg Kurz
2021-03-02 2:11 ` David Gibson
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=YD2dDcCGenJC27kC@yekko.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=danielhb413@gmail.com \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).