linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
To: John Allen <jallen@linux.vnet.ibm.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3 2/3] powerpc/pseries: Introduce memory hotplug READD operation
Date: Mon, 9 Jan 2017 10:32:26 -0600	[thread overview]
Message-ID: <1b0aa019-ab4d-5d4f-ce5e-36715ac6a076@linux.vnet.ibm.com> (raw)
In-Reply-To: <9a232a88-7418-8365-4e15-13b13542be26@linux.vnet.ibm.com>

On 01/06/2017 01:27 PM, John Allen wrote:
> Currently, memory must be hot removed and subsequently re-added in order
> to dynamically update the affinity of LMBs specified by a PRRN event.
> Earlier implementations of the PRRN event handler ran into issues in which
> the hot remove would occur successfully, but a hotplug event would be
> initiated from another source and grab the hotplug lock preventing the hot
> add from occurring. To prevent this situation, this patch introduces the
> notion of a hot "readd" action for memory which atomizes a hot remove and
> a hot add into a single, serialized operation on the hotplug queue.
> 
> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>

Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

> ---
> diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
> index 9c23baa..076b892 100644
> --- a/arch/powerpc/include/asm/rtas.h
> +++ b/arch/powerpc/include/asm/rtas.h
> @@ -318,6 +318,7 @@ struct pseries_hp_errorlog {
> 
>  #define PSERIES_HP_ELOG_ACTION_ADD	1
>  #define PSERIES_HP_ELOG_ACTION_REMOVE	2
> +#define PSERIES_HP_ELOG_ACTION_READD	3
> 
>  #define PSERIES_HP_ELOG_ID_DRC_NAME	1
>  #define PSERIES_HP_ELOG_ID_DRC_INDEX	2
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index 0eb4b1d..06f10a8 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -560,6 +560,44 @@ static int dlpar_memory_remove_by_index(u32 drc_index, struct property *prop)
>  	return rc;
>  }
> 
> +static int dlpar_memory_readd_by_index(u32 drc_index, struct property *prop)
> +{
> +	struct of_drconf_cell *lmbs;
> +	u32 num_lmbs, *p;
> +	int lmb_found;
> +	int i, rc;
> +
> +	pr_info("Attempting to update LMB, drc index %x\n", drc_index);
> +
> +	p = prop->value;
> +	num_lmbs = *p++;
> +	lmbs = (struct of_drconf_cell *)p;
> +
> +	lmb_found = 0;
> +	for (i = 0; i < num_lmbs; i++) {
> +		if (lmbs[i].drc_index == drc_index) {
> +			lmb_found = 1;
> +			rc = dlpar_remove_lmb(&lmbs[i]);
> +			if (!rc) {
> +				rc = dlpar_add_lmb(&lmbs[i]);
> +				if (rc)
> +					dlpar_release_drc(lmbs[i].drc_index);
> +			}
> +			break;
> +		}
> +	}
> +
> +	if (!lmb_found)
> +		rc = -EINVAL;
> +
> +	if (rc)
> +		pr_info("Failed to update memory at %llx\n",
> +			lmbs[i].base_addr);
> +	else
> +		pr_info("Memory at %llx was updated\n", lmbs[i].base_addr);
> +
> +	return rc;
> +}
>  #else
>  static inline int pseries_remove_memblock(unsigned long base,
>  					  unsigned int memblock_size)
> @@ -776,6 +814,9 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
>  		else
>  			rc = -EINVAL;
>  		break;
> +	case PSERIES_HP_ELOG_ACTION_READD:
> +		rc = dlpar_memory_readd_by_index(drc_index, prop);
> +		break;
>  	default:
>  		pr_err("Invalid action (%d) specified\n", hp_elog->action);
>  		rc = -EINVAL;
> 

  reply	other threads:[~2017-01-09 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 19:23 [PATCH v3 0/3] powerpc/pseries: Perform PRRN topology updates in kernel John Allen
2017-01-06 19:25 ` [PATCH v3 1/3] powerpc/pseries: Make the acquire/release of the drc for memory a seperate step John Allen
2017-02-02 11:45   ` [v3, " Michael Ellerman
2017-01-06 19:27 ` [PATCH v3 2/3] powerpc/pseries: Introduce memory hotplug READD operation John Allen
2017-01-09 16:32   ` Nathan Fontenot [this message]
2017-01-06 19:28 ` [PATCH v3 3/3] powerpc/pseries: Update affinity for memory and cpus specified in a PRRN event John Allen
2017-01-09 16:32   ` Nathan Fontenot

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=1b0aa019-ab4d-5d4f-ce5e-36715ac6a076@linux.vnet.ibm.com \
    --to=nfont@linux.vnet.ibm.com \
    --cc=jallen@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.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).