Skip to contentSkip to conversation

KVM: s390/mm: Properly reset no-dat

PATCH In review Claudio Imbrenda 3 participants 4 messages Nov 9, 2023 – Nov 14, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: s390/mm: Properly reset no-dat

When the CMMA state needs to be reset, the no-dat bit also needs to be reset. Failure to do so could cause issues in the guest, since the guest expects the bit to be cleared after a reset.

---
 arch/s390/mm/pgtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/mm/pgtable.c +1 -1
index 3bd2ab2a9a34..5cb92941540b 100644
@@ -756,7 +756,7 @@ void ptep_zap_unused(struct mm_struct *mm, unsigned long addr,
 		pte_clear(mm, addr, ptep);
 	}
 	if (reset)
-		pgste_val(pgste) &= ~_PGSTE_GPS_USAGE_MASK;
+		pgste_val(pgste) &= ~(_PGSTE_GPS_USAGE_MASK | _PGSTE_GPS_NODAT);
 	pgste_set_unlock(ptep, pgste);
 	preempt_enable();
 }
Signature · 1 line
2.41.0
#1 lore raw

Sorry, I had copy-pasted the wrong email address for Gerald, fixed now

Quoted 22 lines · On Thu, 9 Nov 2023 13:36:24 +0100 Claudio Imbrenda <[email protected]>…

When the CMMA state needs to be reset, the no-dat bit also needs to be reset. Failure to do so could cause issues in the guest, since the guest expects the bit to be cleared after a reset.

---
 arch/s390/mm/pgtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/mm/pgtable.c +1 -1
index 3bd2ab2a9a34..5cb92941540b 100644
@@ -756,7 +756,7 @@ void ptep_zap_unused(struct mm_struct *mm, unsigned long addr,
 		pte_clear(mm, addr, ptep);
 	}
 	if (reset)
-		pgste_val(pgste) &= ~_PGSTE_GPS_USAGE_MASK;
+		pgste_val(pgste) &= ~(_PGSTE_GPS_USAGE_MASK | _PGSTE_GPS_NODAT);
 	pgste_set_unlock(ptep, pgste);
 	preempt_enable();
 }
#2 lore raw
In reply to Claudio Imbrenda

Am 09.11.23 um 13:36 schrieb Claudio Imbrenda:

Quoted 3 lines

When the CMMA state needs to be reset, the no-dat bit also needs to be reset. Failure to do so could cause issues in the guest, since the guest expects the bit to be cleared after a reset.

This happens during reset of a guest (or whenever QEMU calls the CLR_CMMA thingi). I think after reset a normal Linux guest has no DAT tables and very likely a cpu reset (with explicit full guest flush) will happen. It will very likely also set the CMMA state during boot before setting up its DAT tables. So for the normal reboot this should be ok. But I can imagine cases that would not be ok. So maybe add cc stable?