mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Scott Cheloha <cheloha@linux.ibm.com>
To: Nathan Lynch <nathanl@linux.ibm.com>
Cc: Nathan Fontenont <ndfont@gmail.com>,
	Rick Lindsley <ricklind@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [PATCH] pseries/hotplug-memory: remove dlpar_memory_{add,remove}_by_index() functions
Date: Tue, 11 Feb 2020 16:04:06 -0600	[thread overview]
Message-ID: <20200211220406.72jdndodtp23v4w2@rascal.austin.ibm.com> (raw)
In-Reply-To: <87ftfimbjy.fsf@linux.ibm.com>

On Mon, Feb 10, 2020 at 02:28:49PM -0600, Nathan Lynch wrote:
> Scott Cheloha <cheloha@linux.ibm.com> writes:
> > The dlpar_memory_{add,remove}_by_index() functions are just special
> > cases of their dlpar_memory_{add,remove}_by_ic() counterparts where
> > the LMB count is 1.
> 
> I wish that were the case, but there are (gratuitous?) differences:
> 
> - dlpar_memory_remove_by_ic() checks DRCONF_MEM_RESERVED and
>   DRCONF_MEM_ASSIGNED flags; dlpar_memory_remove_by_index() does not.

The lack of a DRCONF_MEM_RESERVED check in add_by_index() and
remove_by_index() might be a mistake.  If I understand the PAPR
correctly, when DRCONF_MEM_RESERVED is set for an LMB the operating
system isn't allowed to touch it.  The LMB could become available for
use later if the platform clears the bit, but if it's set it's
no good.

DRCONF_MEM_ASSIGNED checks are not present in
dlpar_memory_add_by_index() and dlpar_memory_remove_by_index() but
they are done at the top of dlpar_add_lmb() and lmb_is_removable(),
so the checks do happen in those paths.

> - dlpar_memory_remove_by_ic() attempts to roll back failed removal;
>   dlpar_memory_remove_by_index() does not.

The exclusion of rollback in the remove_by_index() path makes sense,
as there are only N=1 possible elements where the operation can fail.
Doing the marking/unmarking for rollback in the N=1 case is harmless
though.  If the removal fails for the given LMB we never call
drmem_mark_reserved() to indicate that we need to re-add it.  The
rollback loop then finds no marked LMBs and does no work.

> I'm not sure how much either of these gets used in practice. AFAIK the
> usual HMC/drmgr-driven workflow tends to exercise
> dlpar_memory_remove_by_count().

drmgr eventually uses dlpar_memory_*_by_count() when you give it a
count of LMBs with the '-q' flag, e.g.:

# drmgr -c mem -a -q 10

drmgr eventually uses dlpar_memory_*_by_index() when you give it a
particular DRC, e.g.:

# drmgr -c mem -a -s <some drc number>

QEMU hotplug uses dlpar_memory_*_by_ic().

> I agree this code needs consolidation, but we should proceed a little
> carefully because it's likely going to entail changing some user-visible
> behaviors.

Sure.

Maybe there are less ambitious ways to start out.

      reply	other threads:[~2020-02-11 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27 20:08 Scott Cheloha
2020-02-10 20:28 ` Nathan Lynch
2020-02-11 22:04   ` Scott Cheloha [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=20200211220406.72jdndodtp23v4w2@rascal.austin.ibm.com \
    --to=cheloha@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=nathanl@linux.ibm.com \
    --cc=ndfont@gmail.com \
    --cc=ricklind@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®