* [PATCH v2 0/3] powerpc/papr_scm: Workaround for failure of drc bind after kexec
@ 2019-06-25 12:27 Vaibhav Jain
2019-06-25 12:27 ` [PATCH v2 1/3] powerpc/pseries: Update SCM hcall op-codes in hvcall.h Vaibhav Jain
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Vaibhav Jain @ 2019-06-25 12:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Aneesh Kumar K . V, Oliver O'Halloran, Vaibhav Jain,
Laurent Dufour, David Gibson
Presently an error is returned in response to hcall H_SCM_BIND_MEM when a
new kernel boots on lpar via kexec. This prevents papr_scm from registering
drc memory regions with nvdimm. The error reported is of the form below:
"papr_scm ibm,persistent-memory:ibm,pmemory@44100002: bind err: -68"
On investigation it was revealed that phyp returns this error as previous
kernel did not completely release bindings for drc scm-memory blocks and
hence phyp rejected request for re-binding these block to lpar with error
H_OVERLAP. Also support for a new H_SCM_UNBIND_ALL is recently added which
is better suited for releasing all the bound scm-memory block from an lpar.
So leveraging new hcall H_SCM_UNBIND_ALL, we can workaround H_OVERLAP issue
during kexec by forcing an unbind of all drm scm-memory blocks and issuing
H_SCM_BIND_MEM to re-bind the drc scm-memory blocks to lpar. This sequence
will also be needed when a new kernel boot on lpar after previous kernel
panicked and it never got an opportunity to call H_SCM_UNBIND_MEM/ALL.
Hence this patch-set implements following changes to papr_scm module:
* Update hvcall.h to include opcodes for new hcall H_SCM_UNBIND_ALL.
* Update it to use H_SCM_UNBIND_ALL instead of H_SCM_UNBIND_MEM
* In case hcall H_SCM_BIND_MEM fails with error H_OVERLAP, force
H_SCM_UNBIND_ALL and retry the bind operation again.
With the patch-set applied re-bind of drc scm-memory to lpar succeeds after
a kexec to new kernel as illustrated below:
# Old kernel
$ sudo ndctl list -R
[
{
"dev":"region0",
<snip>
....
}
]
# kexec to new kernel
$ sudo kexec --initrd=... vmlinux
...
...
I'm in purgatory
...
papr_scm ibm,persistent-memory:ibm,pmemory@44100002: Un-binding and retrying
...
# New kernel
$ sudo ndctl list -R
[
{
"dev":"region0",
<snip>
....
}
]
---
Change-log:
v2:
* Addressed review comments from Oliver on v1 patchset.
Vaibhav Jain (3):
powerpc/pseries: Update SCM hcall op-codes in hvcall.h
powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL
powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
arch/powerpc/include/asm/hvcall.h | 9 +++--
arch/powerpc/platforms/pseries/papr_scm.c | 44 ++++++++++++++++++-----
2 files changed, 43 insertions(+), 10 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/3] powerpc/pseries: Update SCM hcall op-codes in hvcall.h
2019-06-25 12:27 [PATCH v2 0/3] powerpc/papr_scm: Workaround for failure of drc bind after kexec Vaibhav Jain
@ 2019-06-25 12:27 ` Vaibhav Jain
2019-06-26 3:17 ` Oliver O'Halloran
2019-06-25 12:27 ` [PATCH v2 2/3] powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL Vaibhav Jain
2019-06-25 12:27 ` [PATCH v2 3/3] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails Vaibhav Jain
2 siblings, 1 reply; 8+ messages in thread
From: Vaibhav Jain @ 2019-06-25 12:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Aneesh Kumar K . V, Oliver O'Halloran, Vaibhav Jain,
Laurent Dufour, David Gibson
Update the hvcalls.h to include op-codes for new hcalls introduce to
manage SCM memory. Also update existing hcall definitions to reflect
current papr specification for SCM.
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
Change-log:
v2:
* None new patch in this series.
---
arch/powerpc/include/asm/hvcall.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 463c63a9fcf1..1f5f917dae8c 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -302,9 +302,14 @@
#define H_SCM_UNBIND_MEM 0x3F0
#define H_SCM_QUERY_BLOCK_MEM_BINDING 0x3F4
#define H_SCM_QUERY_LOGICAL_MEM_BINDING 0x3F8
-#define H_SCM_MEM_QUERY 0x3FC
+#define H_SCM_UNBIND_ALL 0x3FC
#define H_SCM_BLOCK_CLEAR 0x400
-#define MAX_HCALL_OPCODE H_SCM_BLOCK_CLEAR
+#define H_SCM_PERFORMANCE_STATS 0x418
+#define MAX_HCALL_OPCODE H_SCM_PERFORMANCE_STATS
+
+/* Scope args for H_SCM_UNBIND_ALL */
+#define H_UNBIND_SCOPE_ALL (0x1)
+#define H_UNBIND_SCOPE_DRC (0x2)
/* H_VIOCTL functions */
#define H_GET_VIOA_DUMP_SIZE 0x01
--
2.21.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] powerpc/pseries: Update SCM hcall op-codes in hvcall.h
2019-06-25 12:27 ` [PATCH v2 1/3] powerpc/pseries: Update SCM hcall op-codes in hvcall.h Vaibhav Jain
@ 2019-06-26 3:17 ` Oliver O'Halloran
0 siblings, 0 replies; 8+ messages in thread
From: Oliver O'Halloran @ 2019-06-26 3:17 UTC (permalink / raw)
To: Vaibhav Jain
Cc: Laurent Dufour, linuxppc-dev, Aneesh Kumar K . V, David Gibson
On Tue, Jun 25, 2019 at 10:27 PM Vaibhav Jain <vaibhav@linux.ibm.com> wrote:
>
> Update the hvcalls.h to include op-codes for new hcalls introduce to
> manage SCM memory. Also update existing hcall definitions to reflect
> current papr specification for SCM.
>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> ---
> Change-log:
>
> v2:
> * None new patch in this series.
> ---
> arch/powerpc/include/asm/hvcall.h | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
> index 463c63a9fcf1..1f5f917dae8c 100644
> --- a/arch/powerpc/include/asm/hvcall.h
> +++ b/arch/powerpc/include/asm/hvcall.h
> @@ -302,9 +302,14 @@
> #define H_SCM_UNBIND_MEM 0x3F0
> #define H_SCM_QUERY_BLOCK_MEM_BINDING 0x3F4
> #define H_SCM_QUERY_LOGICAL_MEM_BINDING 0x3F8
> -#define H_SCM_MEM_QUERY 0x3FC
> +#define H_SCM_UNBIND_ALL 0x3FC
> #define H_SCM_BLOCK_CLEAR 0x400
The BLOCK_CLEAR hcall was removed from the spec and the 0x400 hcall
number is now used by H_SCM_HEALTH.
> -#define MAX_HCALL_OPCODE H_SCM_BLOCK_CLEAR
> +#define H_SCM_PERFORMANCE_STATS 0x418
> +#define MAX_HCALL_OPCODE H_SCM_PERFORMANCE_STATS
> +
> +/* Scope args for H_SCM_UNBIND_ALL */
> +#define H_UNBIND_SCOPE_ALL (0x1)
> +#define H_UNBIND_SCOPE_DRC (0x2)
>
> /* H_VIOCTL functions */
> #define H_GET_VIOA_DUMP_SIZE 0x01
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL
2019-06-25 12:27 [PATCH v2 0/3] powerpc/papr_scm: Workaround for failure of drc bind after kexec Vaibhav Jain
2019-06-25 12:27 ` [PATCH v2 1/3] powerpc/pseries: Update SCM hcall op-codes in hvcall.h Vaibhav Jain
@ 2019-06-25 12:27 ` Vaibhav Jain
2019-06-25 20:35 ` kbuild test robot
2019-06-26 3:47 ` Oliver O'Halloran
2019-06-25 12:27 ` [PATCH v2 3/3] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails Vaibhav Jain
2 siblings, 2 replies; 8+ messages in thread
From: Vaibhav Jain @ 2019-06-25 12:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Aneesh Kumar K . V, Oliver O'Halloran, Vaibhav Jain,
Laurent Dufour, David Gibson
The new hcall named H_SCM_UNBIND_ALL has been introduce that can
unbind all the memory drc memory-blocks assigned to an lpar. This is
more efficient than using H_SCM_UNBIND_MEM as currently we don't
support partial unbind of drc memory-blocks.
Hence this patch proposes following changes to drc_pmem_unbind():
* Update drc_pmem_unbind() to replace hcall H_SCM_UNBIND_MEM to
H_SCM_UNBIND_ALL.
* Update drc_pmem_unbind() to handles cases when PHYP asks the guest
kernel to wait for specific amount of time before retrying the
hcall via the 'LONG_BUSY' return value.
* Ensure appropriate error code is returned back from the function
in case of an error.
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
Change-log:
v2:
* Added a dev_dbg when unbind operation succeeds [Oliver]
* Changed type of variable 'rc' to int64_t [Oliver]
* Removed the code that was logging a warning in case bind operation
takes >1-seconds [Oliver]
* Spinned off changes to hvcall.h as a separate patch. [Oliver]
---
arch/powerpc/platforms/pseries/papr_scm.c | 29 +++++++++++++++++------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index 96c53b23e58f..a4e1674bb15c 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -11,6 +11,7 @@
#include <linux/sched.h>
#include <linux/libnvdimm.h>
#include <linux/platform_device.h>
+#include <linux/delay.h>
#include <asm/plpar_wrappers.h>
@@ -77,22 +78,36 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
static int drc_pmem_unbind(struct papr_scm_priv *p)
{
unsigned long ret[PLPAR_HCALL_BUFSIZE];
- uint64_t rc, token;
+ uint64_t token;
+ int64_t rc;
- token = 0;
+ dev_dbg(&p->pdev->dev, "unbind drc %x\n", p->drc_index);
- /* NB: unbind has the same retry requirements mentioned above */
+ /* NB: unbind has the same retry requirements as drc_pmem_bind() */
do {
- rc = plpar_hcall(H_SCM_UNBIND_MEM, ret, p->drc_index,
- p->bound_addr, p->blocks, token);
+
+ /* Unbind of all SCM resources associated with drcIndex */
+ rc = plpar_hcall(H_SCM_UNBIND_ALL, ret, H_UNBIND_SCOPE_DRC,
+ p->drc_index, token);
token = ret[0];
- cond_resched();
+
+ /* Check if we are stalled for some time */
+ if (H_IS_LONG_BUSY(rc)) {
+ msleep(get_longbusy_msecs(rc));
+ rc = H_BUSY;
+ } else if (rc == H_BUSY) {
+ cond_resched();
+ }
+
} while (rc == H_BUSY);
if (rc)
dev_err(&p->pdev->dev, "unbind error: %lld\n", rc);
+ else
+ dev_dbg(&p->pdev->dev, "unbind drc %x complete\n",
+ p->drc_index);
- return !!rc;
+ return rc == H_SUCCESS ? 0 : -ENXIO;
}
static int papr_scm_meta_get(struct papr_scm_priv *p,
--
2.21.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/3] powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL
2019-06-25 12:27 ` [PATCH v2 2/3] powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL Vaibhav Jain
@ 2019-06-25 20:35 ` kbuild test robot
2019-06-26 3:47 ` Oliver O'Halloran
1 sibling, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2019-06-25 20:35 UTC (permalink / raw)
To: Vaibhav Jain
Cc: Aneesh Kumar K . V, Oliver O'Halloran, kbuild-all,
Vaibhav Jain, Laurent Dufour, linuxppc-dev, David Gibson
[-- Attachment #1: Type: text/plain, Size: 2806 bytes --]
Hi Vaibhav,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.2-rc6 next-20190625]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Vaibhav-Jain/powerpc-papr_scm-Workaround-for-failure-of-drc-bind-after-kexec/20190626-034335
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
arch/powerpc/platforms/pseries/papr_scm.c: In function 'drc_pmem_unbind.isra.2':
>> arch/powerpc/platforms/pseries/papr_scm.c:90:6: warning: 'token' may be used uninitialized in this function [-Wmaybe-uninitialized]
rc = plpar_hcall(H_SCM_UNBIND_ALL, ret, H_UNBIND_SCOPE_DRC,
~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p->drc_index, token);
~~~~~~~~~~~~~~~~~~~~
vim +/token +90 arch/powerpc/platforms/pseries/papr_scm.c
77
78 static int drc_pmem_unbind(struct papr_scm_priv *p)
79 {
80 unsigned long ret[PLPAR_HCALL_BUFSIZE];
81 uint64_t token;
82 int64_t rc;
83
84 dev_dbg(&p->pdev->dev, "unbind drc %x\n", p->drc_index);
85
86 /* NB: unbind has the same retry requirements as drc_pmem_bind() */
87 do {
88
89 /* Unbind of all SCM resources associated with drcIndex */
> 90 rc = plpar_hcall(H_SCM_UNBIND_ALL, ret, H_UNBIND_SCOPE_DRC,
91 p->drc_index, token);
92 token = ret[0];
93
94 /* Check if we are stalled for some time */
95 if (H_IS_LONG_BUSY(rc)) {
96 msleep(get_longbusy_msecs(rc));
97 rc = H_BUSY;
98 } else if (rc == H_BUSY) {
99 cond_resched();
100 }
101
102 } while (rc == H_BUSY);
103
104 if (rc)
105 dev_err(&p->pdev->dev, "unbind error: %lld\n", rc);
106 else
107 dev_dbg(&p->pdev->dev, "unbind drc %x complete\n",
108 p->drc_index);
109
110 return rc == H_SUCCESS ? 0 : -ENXIO;
111 }
112
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62037 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/3] powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL
2019-06-25 12:27 ` [PATCH v2 2/3] powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL Vaibhav Jain
2019-06-25 20:35 ` kbuild test robot
@ 2019-06-26 3:47 ` Oliver O'Halloran
1 sibling, 0 replies; 8+ messages in thread
From: Oliver O'Halloran @ 2019-06-26 3:47 UTC (permalink / raw)
To: Vaibhav Jain
Cc: Laurent Dufour, linuxppc-dev, Aneesh Kumar K . V, David Gibson
On Tue, Jun 25, 2019 at 10:27 PM Vaibhav Jain <vaibhav@linux.ibm.com> wrote:
>
> The new hcall named H_SCM_UNBIND_ALL has been introduce that can
> unbind all the memory drc memory-blocks assigned to an lpar.
This is a little muddy. For normal memory each block has a DRC so you
can add/remove individual blocks by configuring or deconfiguring the
DRC for that block. For storage class memory the DRC refers to the SCM
volume as a whole rather than an individual block so a "memory DRC"
isn't really what you're taking about here.
This is probably being a little pedantic, but I find the whole DRC
system confusing enough as-is so it's good to be clear about these
things.
> more efficient than using H_SCM_UNBIND_MEM as currently we don't
> support partial unbind of drc memory-blocks.
>
> Hence this patch proposes following changes to drc_pmem_unbind():
>
> * Update drc_pmem_unbind() to replace hcall H_SCM_UNBIND_MEM to
> H_SCM_UNBIND_ALL.
>
> * Update drc_pmem_unbind() to handles cases when PHYP asks the guest
> kernel to wait for specific amount of time before retrying the
> hcall via the 'LONG_BUSY' return value.
>
> * Ensure appropriate error code is returned back from the function
> in case of an error.
>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> ---
> Change-log:
>
> v2:
> * Added a dev_dbg when unbind operation succeeds [Oliver]
> * Changed type of variable 'rc' to int64_t [Oliver]
> * Removed the code that was logging a warning in case bind operation
> takes >1-seconds [Oliver]
> * Spinned off changes to hvcall.h as a separate patch. [Oliver]
Looks good otherwise, when you respin feel free to add:
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
2019-06-25 12:27 [PATCH v2 0/3] powerpc/papr_scm: Workaround for failure of drc bind after kexec Vaibhav Jain
2019-06-25 12:27 ` [PATCH v2 1/3] powerpc/pseries: Update SCM hcall op-codes in hvcall.h Vaibhav Jain
2019-06-25 12:27 ` [PATCH v2 2/3] powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL Vaibhav Jain
@ 2019-06-25 12:27 ` Vaibhav Jain
2019-06-26 3:24 ` Oliver O'Halloran
2 siblings, 1 reply; 8+ messages in thread
From: Vaibhav Jain @ 2019-06-25 12:27 UTC (permalink / raw)
To: linuxppc-dev
Cc: Aneesh Kumar K . V, Oliver O'Halloran, Vaibhav Jain,
Laurent Dufour, David Gibson
In some cases initial bind of scm memory for an lpar can fail if
previously it wasn't released using a scm-unbind hcall. This situation
can arise due to panic of the previous kernel or forced lpar
fadump. In such cases the H_SCM_BIND_MEM return a H_OVERLAP error.
To mitigate such cases the patch updates papr_scm_probe() to force a
call to drc_pmem_unbind() in case the initial bind of scm memory fails
with EBUSY error. In case scm-bind operation again fails after the
forced scm-unbind then we follow the existing error path. We also
update drc_pmem_bind() to handle the H_OVERLAP error returned by phyp
and indicate it as a EBUSY error back to the caller.
Suggested-by: "Oliver O'Halloran" <oohall@gmail.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
Change-log:
v2:
* Moved the retry code from drc_pmem_bind() to papr_scm_probe()
[Oliver]
* Changed the type of variable 'rc' in drc_pmem_bind() to
int64_t. [Oliver]
---
arch/powerpc/platforms/pseries/papr_scm.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index a4e1674bb15c..2c90cbe88313 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -43,8 +43,9 @@ struct papr_scm_priv {
static int drc_pmem_bind(struct papr_scm_priv *p)
{
unsigned long ret[PLPAR_HCALL_BUFSIZE];
- uint64_t rc, token;
uint64_t saved = 0;
+ uint64_t token;
+ int64_t rc;
/*
* When the hypervisor cannot map all the requested memory in a single
@@ -64,6 +65,10 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
} while (rc == H_BUSY);
if (rc) {
+ /* H_OVERLAP needs a separate error path */
+ if (rc == H_OVERLAP)
+ return -EBUSY;
+
dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
return -ENXIO;
}
@@ -331,6 +336,14 @@ static int papr_scm_probe(struct platform_device *pdev)
/* request the hypervisor to bind this region to somewhere in memory */
rc = drc_pmem_bind(p);
+
+ /* If phyp reports drc memory still bound the force unbound and retry */
+ if (rc == -EBUSY) {
+ dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
+ drc_pmem_unbind(p);
+ rc = drc_pmem_bind(p);
+ }
+
if (rc)
goto err;
--
2.21.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/3] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
2019-06-25 12:27 ` [PATCH v2 3/3] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails Vaibhav Jain
@ 2019-06-26 3:24 ` Oliver O'Halloran
0 siblings, 0 replies; 8+ messages in thread
From: Oliver O'Halloran @ 2019-06-26 3:24 UTC (permalink / raw)
To: Vaibhav Jain
Cc: Laurent Dufour, linuxppc-dev, Aneesh Kumar K . V, David Gibson
On Tue, Jun 25, 2019 at 10:27 PM Vaibhav Jain <vaibhav@linux.ibm.com> wrote:
>
> In some cases initial bind of scm memory for an lpar can fail if
> previously it wasn't released using a scm-unbind hcall. This situation
> can arise due to panic of the previous kernel or forced lpar
> fadump. In such cases the H_SCM_BIND_MEM return a H_OVERLAP error.
>
> To mitigate such cases the patch updates papr_scm_probe() to force a
> call to drc_pmem_unbind() in case the initial bind of scm memory fails
> with EBUSY error. In case scm-bind operation again fails after the
> forced scm-unbind then we follow the existing error path. We also
> update drc_pmem_bind() to handle the H_OVERLAP error returned by phyp
> and indicate it as a EBUSY error back to the caller.
>
> Suggested-by: "Oliver O'Halloran" <oohall@gmail.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> ---
> Change-log:
>
> v2:
> * Moved the retry code from drc_pmem_bind() to papr_scm_probe()
> [Oliver]
> * Changed the type of variable 'rc' in drc_pmem_bind() to
> int64_t. [Oliver]
> ---
> arch/powerpc/platforms/pseries/papr_scm.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
> index a4e1674bb15c..2c90cbe88313 100644
> --- a/arch/powerpc/platforms/pseries/papr_scm.c
> +++ b/arch/powerpc/platforms/pseries/papr_scm.c
> @@ -43,8 +43,9 @@ struct papr_scm_priv {
> static int drc_pmem_bind(struct papr_scm_priv *p)
> {
> unsigned long ret[PLPAR_HCALL_BUFSIZE];
> - uint64_t rc, token;
> uint64_t saved = 0;
> + uint64_t token;
> + int64_t rc;
>
> /*
> * When the hypervisor cannot map all the requested memory in a single
> @@ -64,6 +65,10 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
> } while (rc == H_BUSY);
>
> if (rc) {
> + /* H_OVERLAP needs a separate error path */
> + if (rc == H_OVERLAP)
> + return -EBUSY;
> +
> dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
> return -ENXIO;
> }
> @@ -331,6 +336,14 @@ static int papr_scm_probe(struct platform_device *pdev)
>
> /* request the hypervisor to bind this region to somewhere in memory */
> rc = drc_pmem_bind(p);
> +
> + /* If phyp reports drc memory still bound the force unbound and retry */
"the force" should be "then force"?
> + if (rc == -EBUSY) {
> + dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
Looks good otherwise,
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-06-26 3:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 12:27 [PATCH v2 0/3] powerpc/papr_scm: Workaround for failure of drc bind after kexec Vaibhav Jain
2019-06-25 12:27 ` [PATCH v2 1/3] powerpc/pseries: Update SCM hcall op-codes in hvcall.h Vaibhav Jain
2019-06-26 3:17 ` Oliver O'Halloran
2019-06-25 12:27 ` [PATCH v2 2/3] powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL Vaibhav Jain
2019-06-25 20:35 ` kbuild test robot
2019-06-26 3:47 ` Oliver O'Halloran
2019-06-25 12:27 ` [PATCH v2 3/3] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails Vaibhav Jain
2019-06-26 3:24 ` Oliver O'Halloran
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.