linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Dufour <ldufour@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, Pingfan Liu <kernelfans@gmail.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>,
	Nathan Fontenot <nfont@linux.vnet.ibm.com>,
	kexec@lists.infradead.org, Hari Bathini <hbathini@linux.ibm.com>
Subject: Re: [PATCHv4 1/2] powerpc/pseries: group lmb operation and memblock's
Date: Mon, 3 Aug 2020 15:52:44 +0200	[thread overview]
Message-ID: <ee585548-aefc-ff3f-6a79-e616b9e04f12@linux.ibm.com> (raw)
In-Reply-To: <1596116005-27511-1-git-send-email-kernelfans@gmail.com>

> @@ -603,6 +606,8 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
>         }
>
>         lmb_set_nid(lmb);
> +       lmb->flags |= DRCONF_MEM_ASSIGNED;
> +
>         block_sz = memory_block_size_bytes();
>
>         /* Add the memory */

Since the lmb->flags is now set earlier, you should unset it in the case the 
call to __add_memory() fails, something like:

@@ -614,6 +614,7 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
  	rc = __add_memory(lmb->nid, lmb->base_addr, block_sz);
  	if (rc) {
  		invalidate_lmb_associativity_index(lmb);
+		lmb->flags &= ~DRCONF_MEM_ASSIGNED;
  		return rc;
  	}

> @@ -614,11 +619,14 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
>
>         rc = dlpar_online_lmb(lmb);
>         if (rc) {
> -               __remove_memory(lmb->nid, lmb->base_addr, block_sz);
> +               int nid = lmb->nid;
> +               phys_addr_t base_addr = lmb->base_addr;
> +
>                 invalidate_lmb_associativity_index(lmb);
>                 lmb_clear_nid(lmb);
> -       } else {
> -               lmb->flags |= DRCONF_MEM_ASSIGNED;
> +               lmb->flags &= ~DRCONF_MEM_ASSIGNED;
> +
> +               __remove_memory(nid, base_addr, block_sz);
>         }
>
>         return rc;

  parent reply	other threads:[~2020-08-03 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 13:33 [PATCHv4 1/2] powerpc/pseries: group lmb operation and memblock's Pingfan Liu
2020-07-30 13:33 ` [PATCHv4 2/2] powerpc/pseries: update device tree before ejecting hotplug uevents Pingfan Liu
2020-08-03 16:28   ` Laurent Dufour
2020-08-04 13:38     ` Pingfan Liu
2020-08-03 13:52 ` Laurent Dufour [this message]
2020-08-04 13:33   ` [PATCHv4 1/2] powerpc/pseries: group lmb operation and memblock's Pingfan Liu

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=ee585548-aefc-ff3f-6a79-e616b9e04f12@linux.ibm.com \
    --to=ldufour@linux.ibm.com \
    --cc=hbathini@linux.ibm.com \
    --cc=kernelfans@gmail.com \
    --cc=kexec@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nathanl@linux.ibm.com \
    --cc=nfont@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).