* [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
@ 2021-04-04 16:31 ` Vaibhav Jain
0 siblings, 0 replies; 6+ messages in thread
From: Vaibhav Jain @ 2021-04-04 16:31 UTC (permalink / raw)
To: linuxppc-dev, linux-nvdimm
Cc: Vaibhav Jain, Aneesh Kumar K . V, Michael Ellerman, Christophe Leroy
While removing large number of mappings from hash page tables for
large memory systems as soft-lockup is reported because of the time
spent inside htap_remove_mapping() like one below:
watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
<snip>
NIP plpar_hcall+0x38/0x58
LR pSeries_lpar_hpte_invalidate+0x68/0xb0
Call Trace:
0x1fffffffffff000 (unreliable)
pSeries_lpar_hpte_removebolted+0x9c/0x230
hash__remove_section_mapping+0xec/0x1c0
remove_section_mapping+0x28/0x3c
arch_remove_memory+0xfc/0x150
devm_memremap_pages_release+0x180/0x2f0
devm_action_release+0x30/0x50
release_nodes+0x28c/0x300
device_release_driver_internal+0x16c/0x280
unbind_store+0x124/0x170
drv_attr_store+0x44/0x60
sysfs_kf_write+0x64/0x90
kernfs_fop_write+0x1b0/0x290
__vfs_write+0x3c/0x70
vfs_write+0xd4/0x270
ksys_write+0xdc/0x130
system_call+0x5c/0x70
Fix this by adding a cond_resched() to the loop in
htap_remove_mapping() that issues hcall to remove hpte mapping. The
call to cond_resched() is issued every HZ jiffies which should prevent
the soft-lockup from being reported.
Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
Changelog:
v2: Issue cond_resched() every HZ jiffies instead of each iteration of
the loop. [ Christophe Leroy ]
---
arch/powerpc/mm/book3s64/hash_utils.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
index 581b20a2feaf..286e7e8cb919 100644
--- a/arch/powerpc/mm/book3s64/hash_utils.c
+++ b/arch/powerpc/mm/book3s64/hash_utils.c
@@ -338,7 +338,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
int htab_remove_mapping(unsigned long vstart, unsigned long vend,
int psize, int ssize)
{
- unsigned long vaddr;
+ unsigned long vaddr, time_limit;
unsigned int step, shift;
int rc;
int ret = 0;
@@ -351,8 +351,19 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
/* Unmap the full range specificied */
vaddr = ALIGN_DOWN(vstart, step);
+ time_limit = jiffies + HZ;
+
for (;vaddr < vend; vaddr += step) {
rc = mmu_hash_ops.hpte_removebolted(vaddr, psize, ssize);
+
+ /*
+ * For large number of mappings introduce a cond_resched()
+ * to prevent softlockup warnings.
+ */
+ if (time_after(jiffies, time_limit)) {
+ cond_resched();
+ time_limit = jiffies + HZ;
+ }
if (rc == -ENOENT) {
ret = -ENOENT;
continue;
--
2.30.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
@ 2021-04-04 16:31 ` Vaibhav Jain
0 siblings, 0 replies; 6+ messages in thread
From: Vaibhav Jain @ 2021-04-04 16:31 UTC (permalink / raw)
To: linuxppc-dev, linux-nvdimm
Cc: Santosh Sivaraj, Aneesh Kumar K . V, Vaibhav Jain, Dan Williams,
Ira Weiny
While removing large number of mappings from hash page tables for
large memory systems as soft-lockup is reported because of the time
spent inside htap_remove_mapping() like one below:
watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
<snip>
NIP plpar_hcall+0x38/0x58
LR pSeries_lpar_hpte_invalidate+0x68/0xb0
Call Trace:
0x1fffffffffff000 (unreliable)
pSeries_lpar_hpte_removebolted+0x9c/0x230
hash__remove_section_mapping+0xec/0x1c0
remove_section_mapping+0x28/0x3c
arch_remove_memory+0xfc/0x150
devm_memremap_pages_release+0x180/0x2f0
devm_action_release+0x30/0x50
release_nodes+0x28c/0x300
device_release_driver_internal+0x16c/0x280
unbind_store+0x124/0x170
drv_attr_store+0x44/0x60
sysfs_kf_write+0x64/0x90
kernfs_fop_write+0x1b0/0x290
__vfs_write+0x3c/0x70
vfs_write+0xd4/0x270
ksys_write+0xdc/0x130
system_call+0x5c/0x70
Fix this by adding a cond_resched() to the loop in
htap_remove_mapping() that issues hcall to remove hpte mapping. The
call to cond_resched() is issued every HZ jiffies which should prevent
the soft-lockup from being reported.
Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
Changelog:
v2: Issue cond_resched() every HZ jiffies instead of each iteration of
the loop. [ Christophe Leroy ]
---
arch/powerpc/mm/book3s64/hash_utils.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
index 581b20a2feaf..286e7e8cb919 100644
--- a/arch/powerpc/mm/book3s64/hash_utils.c
+++ b/arch/powerpc/mm/book3s64/hash_utils.c
@@ -338,7 +338,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
int htab_remove_mapping(unsigned long vstart, unsigned long vend,
int psize, int ssize)
{
- unsigned long vaddr;
+ unsigned long vaddr, time_limit;
unsigned int step, shift;
int rc;
int ret = 0;
@@ -351,8 +351,19 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
/* Unmap the full range specificied */
vaddr = ALIGN_DOWN(vstart, step);
+ time_limit = jiffies + HZ;
+
for (;vaddr < vend; vaddr += step) {
rc = mmu_hash_ops.hpte_removebolted(vaddr, psize, ssize);
+
+ /*
+ * For large number of mappings introduce a cond_resched()
+ * to prevent softlockup warnings.
+ */
+ if (time_after(jiffies, time_limit)) {
+ cond_resched();
+ time_limit = jiffies + HZ;
+ }
if (rc == -ENOENT) {
ret = -ENOENT;
continue;
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
2021-04-04 16:31 ` Vaibhav Jain
@ 2021-04-04 17:05 ` Christophe Leroy
-1 siblings, 0 replies; 6+ messages in thread
From: Christophe Leroy @ 2021-04-04 17:05 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev, linux-nvdimm
Cc: Aneesh Kumar K . V, Michael Ellerman
Le 04/04/2021 à 18:31, Vaibhav Jain a écrit :
> While removing large number of mappings from hash page tables for
> large memory systems as soft-lockup is reported because of the time
> spent inside htap_remove_mapping() like one below:
>
> watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
> <snip>
> NIP plpar_hcall+0x38/0x58
> LR pSeries_lpar_hpte_invalidate+0x68/0xb0
> Call Trace:
> 0x1fffffffffff000 (unreliable)
> pSeries_lpar_hpte_removebolted+0x9c/0x230
> hash__remove_section_mapping+0xec/0x1c0
> remove_section_mapping+0x28/0x3c
> arch_remove_memory+0xfc/0x150
> devm_memremap_pages_release+0x180/0x2f0
> devm_action_release+0x30/0x50
> release_nodes+0x28c/0x300
> device_release_driver_internal+0x16c/0x280
> unbind_store+0x124/0x170
> drv_attr_store+0x44/0x60
> sysfs_kf_write+0x64/0x90
> kernfs_fop_write+0x1b0/0x290
> __vfs_write+0x3c/0x70
> vfs_write+0xd4/0x270
> ksys_write+0xdc/0x130
> system_call+0x5c/0x70
>
> Fix this by adding a cond_resched() to the loop in
> htap_remove_mapping() that issues hcall to remove hpte mapping. The
> call to cond_resched() is issued every HZ jiffies which should prevent
> the soft-lockup from being reported.
>
> Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> ---
> Changelog:
>
> v2: Issue cond_resched() every HZ jiffies instead of each iteration of
> the loop. [ Christophe Leroy ]
> ---
> arch/powerpc/mm/book3s64/hash_utils.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
> index 581b20a2feaf..286e7e8cb919 100644
> --- a/arch/powerpc/mm/book3s64/hash_utils.c
> +++ b/arch/powerpc/mm/book3s64/hash_utils.c
> @@ -338,7 +338,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
> int htab_remove_mapping(unsigned long vstart, unsigned long vend,
> int psize, int ssize)
> {
> - unsigned long vaddr;
> + unsigned long vaddr, time_limit;
> unsigned int step, shift;
> int rc;
> int ret = 0;
> @@ -351,8 +351,19 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
>
> /* Unmap the full range specificied */
> vaddr = ALIGN_DOWN(vstart, step);
> + time_limit = jiffies + HZ;
> +
> for (;vaddr < vend; vaddr += step) {
> rc = mmu_hash_ops.hpte_removebolted(vaddr, psize, ssize);
> +
> + /*
> + * For large number of mappings introduce a cond_resched()
> + * to prevent softlockup warnings.
> + */
> + if (time_after(jiffies, time_limit)) {
> + cond_resched();
> + time_limit = jiffies + HZ;
> + }
> if (rc == -ENOENT) {
> ret = -ENOENT;
> continue;
>
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
@ 2021-04-04 17:05 ` Christophe Leroy
0 siblings, 0 replies; 6+ messages in thread
From: Christophe Leroy @ 2021-04-04 17:05 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev, linux-nvdimm
Cc: Aneesh Kumar K . V, Dan Williams, Ira Weiny, Santosh Sivaraj
Le 04/04/2021 à 18:31, Vaibhav Jain a écrit :
> While removing large number of mappings from hash page tables for
> large memory systems as soft-lockup is reported because of the time
> spent inside htap_remove_mapping() like one below:
>
> watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
> <snip>
> NIP plpar_hcall+0x38/0x58
> LR pSeries_lpar_hpte_invalidate+0x68/0xb0
> Call Trace:
> 0x1fffffffffff000 (unreliable)
> pSeries_lpar_hpte_removebolted+0x9c/0x230
> hash__remove_section_mapping+0xec/0x1c0
> remove_section_mapping+0x28/0x3c
> arch_remove_memory+0xfc/0x150
> devm_memremap_pages_release+0x180/0x2f0
> devm_action_release+0x30/0x50
> release_nodes+0x28c/0x300
> device_release_driver_internal+0x16c/0x280
> unbind_store+0x124/0x170
> drv_attr_store+0x44/0x60
> sysfs_kf_write+0x64/0x90
> kernfs_fop_write+0x1b0/0x290
> __vfs_write+0x3c/0x70
> vfs_write+0xd4/0x270
> ksys_write+0xdc/0x130
> system_call+0x5c/0x70
>
> Fix this by adding a cond_resched() to the loop in
> htap_remove_mapping() that issues hcall to remove hpte mapping. The
> call to cond_resched() is issued every HZ jiffies which should prevent
> the soft-lockup from being reported.
>
> Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> ---
> Changelog:
>
> v2: Issue cond_resched() every HZ jiffies instead of each iteration of
> the loop. [ Christophe Leroy ]
> ---
> arch/powerpc/mm/book3s64/hash_utils.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
> index 581b20a2feaf..286e7e8cb919 100644
> --- a/arch/powerpc/mm/book3s64/hash_utils.c
> +++ b/arch/powerpc/mm/book3s64/hash_utils.c
> @@ -338,7 +338,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
> int htab_remove_mapping(unsigned long vstart, unsigned long vend,
> int psize, int ssize)
> {
> - unsigned long vaddr;
> + unsigned long vaddr, time_limit;
> unsigned int step, shift;
> int rc;
> int ret = 0;
> @@ -351,8 +351,19 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
>
> /* Unmap the full range specificied */
> vaddr = ALIGN_DOWN(vstart, step);
> + time_limit = jiffies + HZ;
> +
> for (;vaddr < vend; vaddr += step) {
> rc = mmu_hash_ops.hpte_removebolted(vaddr, psize, ssize);
> +
> + /*
> + * For large number of mappings introduce a cond_resched()
> + * to prevent softlockup warnings.
> + */
> + if (time_after(jiffies, time_limit)) {
> + cond_resched();
> + time_limit = jiffies + HZ;
> + }
> if (rc == -ENOENT) {
> ret = -ENOENT;
> continue;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
2021-04-04 16:31 ` Vaibhav Jain
@ 2021-04-19 3:59 ` Michael Ellerman
-1 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2021-04-19 3:59 UTC (permalink / raw)
To: Vaibhav Jain, linux-nvdimm, linuxppc-dev
Cc: Aneesh Kumar K . V, Christophe Leroy, Michael Ellerman
On Sun, 4 Apr 2021 22:01:48 +0530, Vaibhav Jain wrote:
> While removing large number of mappings from hash page tables for
> large memory systems as soft-lockup is reported because of the time
> spent inside htap_remove_mapping() like one below:
>
> watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
> <snip>
> NIP plpar_hcall+0x38/0x58
> LR pSeries_lpar_hpte_invalidate+0x68/0xb0
> Call Trace:
> 0x1fffffffffff000 (unreliable)
> pSeries_lpar_hpte_removebolted+0x9c/0x230
> hash__remove_section_mapping+0xec/0x1c0
> remove_section_mapping+0x28/0x3c
> arch_remove_memory+0xfc/0x150
> devm_memremap_pages_release+0x180/0x2f0
> devm_action_release+0x30/0x50
> release_nodes+0x28c/0x300
> device_release_driver_internal+0x16c/0x280
> unbind_store+0x124/0x170
> drv_attr_store+0x44/0x60
> sysfs_kf_write+0x64/0x90
> kernfs_fop_write+0x1b0/0x290
> __vfs_write+0x3c/0x70
> vfs_write+0xd4/0x270
> ksys_write+0xdc/0x130
> system_call+0x5c/0x70
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/mm: Add cond_resched() while removing hpte mappings
https://git.kernel.org/powerpc/c/a5d6a3e73acbd619dd5b7b831762b755f9e2db80
cheers
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
@ 2021-04-19 3:59 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2021-04-19 3:59 UTC (permalink / raw)
To: Vaibhav Jain, linux-nvdimm, linuxppc-dev; +Cc: Aneesh Kumar K . V
On Sun, 4 Apr 2021 22:01:48 +0530, Vaibhav Jain wrote:
> While removing large number of mappings from hash page tables for
> large memory systems as soft-lockup is reported because of the time
> spent inside htap_remove_mapping() like one below:
>
> watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
> <snip>
> NIP plpar_hcall+0x38/0x58
> LR pSeries_lpar_hpte_invalidate+0x68/0xb0
> Call Trace:
> 0x1fffffffffff000 (unreliable)
> pSeries_lpar_hpte_removebolted+0x9c/0x230
> hash__remove_section_mapping+0xec/0x1c0
> remove_section_mapping+0x28/0x3c
> arch_remove_memory+0xfc/0x150
> devm_memremap_pages_release+0x180/0x2f0
> devm_action_release+0x30/0x50
> release_nodes+0x28c/0x300
> device_release_driver_internal+0x16c/0x280
> unbind_store+0x124/0x170
> drv_attr_store+0x44/0x60
> sysfs_kf_write+0x64/0x90
> kernfs_fop_write+0x1b0/0x290
> __vfs_write+0x3c/0x70
> vfs_write+0xd4/0x270
> ksys_write+0xdc/0x130
> system_call+0x5c/0x70
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/mm: Add cond_resched() while removing hpte mappings
https://git.kernel.org/powerpc/c/a5d6a3e73acbd619dd5b7b831762b755f9e2db80
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-04-19 4:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-04 16:31 [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings Vaibhav Jain
2021-04-04 16:31 ` Vaibhav Jain
2021-04-04 17:05 ` Christophe Leroy
2021-04-04 17:05 ` Christophe Leroy
2021-04-19 3:59 ` Michael Ellerman
2021-04-19 3:59 ` Michael Ellerman
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.