* [PATCH] powerpc/papr_scm: Use the correct bind address
@ 2019-01-31 1:53 Oliver O'Halloran
2019-02-05 11:25 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Oliver O'Halloran @ 2019-01-31 1:53 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Oliver O'Halloran, stable
When binding an SCM volume to a physical address the hypervisor has the
option to return early with a continue token with the expectation that
the guest will resume the bind operation until it completes. A quirk of
this interface is that the bind address will only be returned by the
first bind h-call and the subsequent calls will return
0xFFFF_FFFF_FFFF_FFFF for the bind address.
We currently do not save the address returned by the first h-call. As a
result we will use the junk address as the base of the bound region if
the hypervisor decides to split the bind across multiple h-calls. This
bug was found when testing with very large SCM volumes where the bind
process would take more time than they hypervisor's internal h-call time
limit would allow. This patch fixes the issue by saving the bind address
from the first call.
Cc: stable@vger.kernel.org
Fixes: b5beae5e224f ("powerpc/pseries: Add driver for PAPR SCM regions")
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/platforms/pseries/papr_scm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index 7d6457ab5d34..bba281b1fe1b 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -43,6 +43,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
{
unsigned long ret[PLPAR_HCALL_BUFSIZE];
uint64_t rc, token;
+ uint64_t saved = 0;
/*
* When the hypervisor cannot map all the requested memory in a single
@@ -56,6 +57,8 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0,
p->blocks, BIND_ANY_ADDR, token);
token = ret[0];
+ if (!saved)
+ saved = ret[1];
cond_resched();
} while (rc == H_BUSY);
@@ -64,7 +67,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
return -ENXIO;
}
- p->bound_addr = ret[1];
+ p->bound_addr = saved;
dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: powerpc/papr_scm: Use the correct bind address
2019-01-31 1:53 [PATCH] powerpc/papr_scm: Use the correct bind address Oliver O'Halloran
@ 2019-02-05 11:25 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2019-02-05 11:25 UTC (permalink / raw)
To: Oliver O'Halloran, linuxppc-dev; +Cc: Oliver O'Halloran, stable
On Thu, 2019-01-31 at 01:53:47 UTC, Oliver O'Halloran wrote:
> When binding an SCM volume to a physical address the hypervisor has the
> option to return early with a continue token with the expectation that
> the guest will resume the bind operation until it completes. A quirk of
> this interface is that the bind address will only be returned by the
> first bind h-call and the subsequent calls will return
> 0xFFFF_FFFF_FFFF_FFFF for the bind address.
>
> We currently do not save the address returned by the first h-call. As a
> result we will use the junk address as the base of the bound region if
> the hypervisor decides to split the bind across multiple h-calls. This
> bug was found when testing with very large SCM volumes where the bind
> process would take more time than they hypervisor's internal h-call time
> limit would allow. This patch fixes the issue by saving the bind address
> from the first call.
>
> Cc: stable@vger.kernel.org
> Fixes: b5beae5e224f ("powerpc/pseries: Add driver for PAPR SCM regions")
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/5a3840a470c41ec0b85cd36ca8037033
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-05 11:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31 1:53 [PATCH] powerpc/papr_scm: Use the correct bind address Oliver O'Halloran
2019-02-05 11:25 ` Michael Ellerman
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).