s390/mm: fix improper use of __storage_key_init_range
cover s390/mm: fix improper use of __storage_key_init_range
The function __storage_key_init_range() expects the end address to be the first byte outside the range to be initialized. I.e. end - start should be the size of the area to be initialized.
This small series fixes two cases in which the last address in the range was passed as end address. This was still functionally correct, since __storage_key_init_range() will still loop over single pages and correctly clear the given range, but it will be slower than clearing the storage keys for the whole 1M block with a single instruction.
Claudio Imbrenda (2):
s390/mm: fix storage key clearing for guest huge pages s390/mm: fix clearing storage keys for huge pages
arch/s390/mm/gmap.c | 2 +- arch/s390/mm/hugetlbpage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.44.0
PATCH 1/2 s390/mm: fix storage key clearing for guest huge pages
The function __storage_key_init_range() expects the end address to be the first byte outside the range to be initialized. I.e. end - start should be the size of the area to be initialized.
The current code works because __storage_key_init_range() will still loop over every page in the range, but it is slower than using sske_frame().
--- arch/s390/mm/gmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/mm/gmap.c +1 -1
@@ -2661,7 +2661,7 @@ static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,return 0 ; start =pmd_val (*pmd) &HPAGE_MASK ; - end = start +HPAGE_SIZE -1 ; + end = start +HPAGE_SIZE ;__storage_key_init_range (start, end);set_bit (PG_arch_1, &page->flags);cond_resched ();
Signature · 1 line
2.44.0
PATCH 2/2 s390/mm: fix clearing storage keys for huge pages
In reply to Claudio ImbrendaThe function __storage_key_init_range() expects the end address to be the first byte outside the range to be initialized. I.e. end - start should be the size of the area to be initialized.
The current code works because __storage_key_init_range() will still loop over every page in the range, but it is slower than using sske_frame().
--- arch/s390/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/mm/hugetlbpage.c +1 -1
@@ -139,7 +139,7 @@ static void clear_huge_pte_skeys(struct mm_struct *mm, unsigned long rste) }if (!test_and_set_bit (PG_arch_1, &page->flags)) -__storage_key_init_range (paddr, paddr + size -1 ); +__storage_key_init_range (paddr, paddr + size); } void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
Signature · 1 line
2.44.0
Quoted 10 lines · Claudio Imbrenda
The function
__storage_key_init_range()expects the end address to be the first byte outside the range to be initialized. I.e. end - start should be the size of the area to be initialized.This small series fixes two cases in which the last address in the range was passed as end address. This was still functionally correct, since
__storage_key_init_range()will still loop over single pages and correctly clear the given range, but it will be slower than clearing the storage keys for the whole 1M block with a single instruction.
Quoted 7 lines
Claudio Imbrenda (2):
s390/mm: fix storage key clearing for guest huge pages s390/mm: fix clearing storage keys for huge pagesarch/s390/mm/gmap.c | 2 +- arch/s390/mm/hugetlbpage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 3 lines · Claudio Imbrenda
arch/s390/mm/gmap.c | 2 +- arch/s390/mm/hugetlbpage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks!