Re: [PATCH] powerpc/lpar: Don't crash on H_PROTECT errors
On 03/01/2016 10:57 AM, Aneesh Kumar K.V wrote: > Tyrel Datwylerwrites: > >> > On 02/29/2016 03:52 AM, Anshuman Khandual wrote: >>> >> There are certain condition in which H_PROTECT can return error code >>> >> other than H_NOT_FOUND and H_SUCCESS. One such being an attempt to >>> >> update an hpte owned by adjunct partition. Return 0 in that case so >>> >> that user space will retry the access. In adjunct case this mean we >>> >> will not make much progress in the user space. But atleast we get a >>> >> chance to kill the task and avoid taking down the entire box. >>> >> >>> >> Signed-off-by: Aneesh Kumar K.V >>> >> Signed-off-by: Anshuman Khandual >>> >> --- >>> >> arch/powerpc/platforms/pseries/lpar.c | 2 +- >>> >> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >> >>> >> diff --git a/arch/powerpc/platforms/pseries/lpar.c >>> >> b/arch/powerpc/platforms/pseries/lpar.c >>> >> index 477290a..31bcdaf 100644 >>> >> --- a/arch/powerpc/platforms/pseries/lpar.c >>> >> +++ b/arch/powerpc/platforms/pseries/lpar.c >>> >> @@ -310,7 +310,7 @@ static long pSeries_lpar_hpte_updatepp(unsigned long >>> >> slot, >>> >> >>> >> pr_devel("ok\n"); >>> >> >>> >> -BUG_ON(lpar_rc != H_SUCCESS); >>> >> +WARN_RATELIMIT(lpar_rc != H_SUCCESS, "H_PROTECT returned >>> >> %lu\n", lpar_rc); >> > >> > In the event that we don't get H_NOT_FOUND (which is handled earlier in >> > the function) or H_SUCCESS this patch assumes H_RESOURCE. It fails to >> > handle H_PARAMETER which is also a valid return from the H_PROTECT >> > hypercall. > One of the possible thing we could do is sent SIGBUS to the application > rather than taking down the system ? But in case of H_PARAMETER, its the kernel which generated wrong arguments which was in it's control, hence BUG_ON will not more appropriate for it ? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/lpar: Don't crash on H_PROTECT errors
Tyrel Datwylerwrites: > On 02/29/2016 03:52 AM, Anshuman Khandual wrote: >> There are certain condition in which H_PROTECT can return error code >> other than H_NOT_FOUND and H_SUCCESS. One such being an attempt to >> update an hpte owned by adjunct partition. Return 0 in that case so >> that user space will retry the access. In adjunct case this mean we >> will not make much progress in the user space. But atleast we get a >> chance to kill the task and avoid taking down the entire box. >> >> Signed-off-by: Aneesh Kumar K.V >> Signed-off-by: Anshuman Khandual >> --- >> arch/powerpc/platforms/pseries/lpar.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/powerpc/platforms/pseries/lpar.c >> b/arch/powerpc/platforms/pseries/lpar.c >> index 477290a..31bcdaf 100644 >> --- a/arch/powerpc/platforms/pseries/lpar.c >> +++ b/arch/powerpc/platforms/pseries/lpar.c >> @@ -310,7 +310,7 @@ static long pSeries_lpar_hpte_updatepp(unsigned long >> slot, >> >> pr_devel("ok\n"); >> >> -BUG_ON(lpar_rc != H_SUCCESS); >> +WARN_RATELIMIT(lpar_rc != H_SUCCESS, "H_PROTECT returned %lu\n", >> lpar_rc); > > In the event that we don't get H_NOT_FOUND (which is handled earlier in > the function) or H_SUCCESS this patch assumes H_RESOURCE. It fails to > handle H_PARAMETER which is also a valid return from the H_PROTECT > hypercall. One of the possible thing we could do is sent SIGBUS to the application rather than taking down the system ? -aneesh ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/lpar: Don't crash on H_PROTECT errors
On 02/29/2016 10:20 PM, Tyrel Datwyler wrote: > On 02/29/2016 03:52 AM, Anshuman Khandual wrote: >> There are certain condition in which H_PROTECT can return error code >> other than H_NOT_FOUND and H_SUCCESS. One such being an attempt to >> update an hpte owned by adjunct partition. Return 0 in that case so >> that user space will retry the access. In adjunct case this mean we >> will not make much progress in the user space. But atleast we get a >> chance to kill the task and avoid taking down the entire box. >> >> Signed-off-by: Aneesh Kumar K.V>> Signed-off-by: Anshuman Khandual >> --- >> arch/powerpc/platforms/pseries/lpar.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/powerpc/platforms/pseries/lpar.c >> b/arch/powerpc/platforms/pseries/lpar.c >> index 477290a..31bcdaf 100644 >> --- a/arch/powerpc/platforms/pseries/lpar.c >> +++ b/arch/powerpc/platforms/pseries/lpar.c >> @@ -310,7 +310,7 @@ static long pSeries_lpar_hpte_updatepp(unsigned long >> slot, >> >> pr_devel("ok\n"); >> >> -BUG_ON(lpar_rc != H_SUCCESS); >> +WARN_RATELIMIT(lpar_rc != H_SUCCESS, "H_PROTECT returned %lu\n", >> lpar_rc); > > In the event that we don't get H_NOT_FOUND (which is handled earlier in > the function) or H_SUCCESS this patch assumes H_RESOURCE. It fails to > handle H_PARAMETER which is also a valid return from the H_PROTECT > hypercall. Right, I guess its okay to BUG_ON() if we detect H_PARAMETER return code as the kernel should not have created wrong arguments to the hcall in the first place. Although we will still want to return 0 from here for H_RESOURCE return code with a WARN_RATELIMIT message. Will change the code accordingly next time around. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/lpar: Don't crash on H_PROTECT errors
On 02/29/2016 03:52 AM, Anshuman Khandual wrote: > There are certain condition in which H_PROTECT can return error code > other than H_NOT_FOUND and H_SUCCESS. One such being an attempt to > update an hpte owned by adjunct partition. Return 0 in that case so > that user space will retry the access. In adjunct case this mean we > will not make much progress in the user space. But atleast we get a > chance to kill the task and avoid taking down the entire box. > > Signed-off-by: Aneesh Kumar K.V> Signed-off-by: Anshuman Khandual > --- > arch/powerpc/platforms/pseries/lpar.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/platforms/pseries/lpar.c > b/arch/powerpc/platforms/pseries/lpar.c > index 477290a..31bcdaf 100644 > --- a/arch/powerpc/platforms/pseries/lpar.c > +++ b/arch/powerpc/platforms/pseries/lpar.c > @@ -310,7 +310,7 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot, > > pr_devel("ok\n"); > > - BUG_ON(lpar_rc != H_SUCCESS); > + WARN_RATELIMIT(lpar_rc != H_SUCCESS, "H_PROTECT returned %lu\n", > lpar_rc); In the event that we don't get H_NOT_FOUND (which is handled earlier in the function) or H_SUCCESS this patch assumes H_RESOURCE. It fails to handle H_PARAMETER which is also a valid return from the H_PROTECT hypercall. -Tyrel > > return 0; > } > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/lpar: Don't crash on H_PROTECT errors
There are certain condition in which H_PROTECT can return error code other than H_NOT_FOUND and H_SUCCESS. One such being an attempt to update an hpte owned by adjunct partition. Return 0 in that case so that user space will retry the access. In adjunct case this mean we will not make much progress in the user space. But atleast we get a chance to kill the task and avoid taking down the entire box. Signed-off-by: Aneesh Kumar K.VSigned-off-by: Anshuman Khandual --- arch/powerpc/platforms/pseries/lpar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 477290a..31bcdaf 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -310,7 +310,7 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot, pr_devel("ok\n"); - BUG_ON(lpar_rc != H_SUCCESS); + WARN_RATELIMIT(lpar_rc != H_SUCCESS, "H_PROTECT returned %lu\n", lpar_rc); return 0; } -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev