linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Bringmann <mwb@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>,
	Juliet Kim <minkim@us.ibm.com>,
	Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Subject: Re: [PATCH v06 3/5] migration/memory: Add hotplug READD_MULTIPLE
Date: Wed, 17 Oct 2018 10:12:49 -0500	[thread overview]
Message-ID: <ba686c81-4f44-f04b-91a8-7f86cf0ec977@linux.vnet.ibm.com> (raw)
In-Reply-To: <871s8pl7p4.fsf@concordia.ellerman.id.au>

On 10/16/2018 07:48 PM, Michael Ellerman wrote:
> Michael Bringmann <mwb@linux.vnet.ibm.com> writes:
>> On 10/16/2018 02:57 PM, Tyrel Datwyler wrote:
>>> On 10/15/2018 05:39 PM, Michael Ellerman wrote:
>>>> Michael Bringmann <mwb@linux.vnet.ibm.com> writes:
>>>>> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
>>>>> index 2b796da..9c76345 100644
>>>>> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
>>>>> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
>>>>> @@ -541,6 +549,23 @@ static int dlpar_memory_readd_by_index(u32 drc_index)
>>>>>  	return rc;
>>>>>  }
>>>>>
>>>>> +static int dlpar_memory_readd_multiple(void)
>>>>> +{
>>>>> +	struct drmem_lmb *lmb;
>>>>> +	int rc;
>>>>> +
>>>>> +	pr_info("Attempting to update multiple LMBs\n");
>>>>> +
>>>>> +	for_each_drmem_lmb(lmb) {
>>>>> +		if (drmem_lmb_update(lmb)) {
>>>>> +			rc = dlpar_memory_readd_helper(lmb);
>>>>> +			drmem_remove_lmb_update(lmb);
>>>>> +		}
>>>>> +	}
>>>>> +
>>>>> +	return rc;
>>>>> +}
>>>>
>>>> This leaves rc potentially uninitialised.
>>>>
>>>> What should the result be in that case, -EINVAL ?
>>>
>>> On another note if there are multiple LMBs to update the value of rc only reflects the final dlpar_memory_readd_helper() call.
>>
>> Correct.  But that is what happens when we compress common code
>> between two disparate uses i.e. updating memory association after
>> a migration event with no reporting mechanism other than the console
>> log, vs re-adding a single LMB by index for the purposes of DLPAR / drmgr.
>>
>> I could discard the return value from dlpar_memory_readd_helper entirely
>> in this function and just return 0, but in my experience, once errors start
>> to occur in memory dlpar ops, they tend to keep on occurring, so I was
>> returning the last one.  We could also make the code smart enough to
>> capture and return the first/last non-zero return code.  I didn't believe
>> that the frequency of errors for this operation warranted the overhead.
> 
> The actual error value is probably not very relevant.
> 
> But dropping errors entirely is almost always a bad idea.
> 
> So I think you should at least return an error if any error occurred,
> that way at least an error will be returned up to the caller(s).
> 
> Something like:
> 
> 	int rc;
> 
> 	rc = 0;
> 	for_each_drmem_lmb(lmb) {
> 		if (drmem_lmb_update(lmb)) {
> 			rc |= dlpar_memory_readd_helper(lmb);
> 			drmem_remove_lmb_update(lmb);
> 		}
> 	}
> 
> 	if (rc)
> 		return -EIO;

Okay.

> 
> cheers
> 

Thanks.

-- 
Michael W. Bringmann
Linux Technology Center
IBM Corporation
Tie-Line  363-5196
External: (512) 286-5196
Cell:       (512) 466-0650
mwb@linux.vnet.ibm.com


  reply	other threads:[~2018-10-17 15:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20181015194738.5705.88953.stgit@ltcalpine2-lp9.aus.stglabs.ibm.com>
2018-10-15 19:53 ` [PATCH v06 3/5] migration/memory: Add hotplug READD_MULTIPLE Michael Bringmann
2018-10-16  0:39   ` Michael Ellerman
2018-10-16 14:07     ` Michael Bringmann
2018-10-16 19:57     ` Tyrel Datwyler
2018-10-16 21:31       ` Michael Bringmann
2018-10-17  0:48         ` Michael Ellerman
2018-10-17 15:12           ` Michael Bringmann [this message]
2018-10-17  0:43       ` Michael Ellerman

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=ba686c81-4f44-f04b-91a8-7f86cf0ec977@linux.vnet.ibm.com \
    --to=mwb@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=minkim@us.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=nfont@linux.vnet.ibm.com \
    --cc=tlfalcon@linux.vnet.ibm.com \
    --cc=tyreld@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;
as well as URLs for NNTP newsgroup(s).