public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] KVM: s390/mm: Properly reset no-dat
@ 2023-11-09 12:36 Claudio Imbrenda
  2023-11-09 12:44 ` Claudio Imbrenda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Claudio Imbrenda @ 2023-11-09 12:36 UTC (permalink / raw)
  To: kvm
  Cc: linux-kernel, linux-s390, frankja, nrb, nsg, borntraeger, hca,
	gerald.schaefer, gor, svens, agordeev

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.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 arch/s390/mm/pgtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 3bd2ab2a9a34..5cb92941540b 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -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.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] KVM: s390/mm: Properly reset no-dat
  2023-11-09 12:36 [PATCH v1 1/1] KVM: s390/mm: Properly reset no-dat Claudio Imbrenda
@ 2023-11-09 12:44 ` Claudio Imbrenda
  2023-11-09 13:11 ` Christian Borntraeger
  2023-11-14 16:24 ` Nico Boehr
  2 siblings, 0 replies; 4+ messages in thread
From: Claudio Imbrenda @ 2023-11-09 12:44 UTC (permalink / raw)
  To: kvm
  Cc: linux-kernel, linux-s390, frankja, nrb, nsg, borntraeger, hca,
	gerald.schaefer, gor, svens, agordeev

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

On Thu,  9 Nov 2023 13:36:24 +0100
Claudio Imbrenda <imbrenda@linux.ibm.com> wrote:

> 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.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  arch/s390/mm/pgtable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
> index 3bd2ab2a9a34..5cb92941540b 100644
> --- a/arch/s390/mm/pgtable.c
> +++ b/arch/s390/mm/pgtable.c
> @@ -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();
>  }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] KVM: s390/mm: Properly reset no-dat
  2023-11-09 12:36 [PATCH v1 1/1] KVM: s390/mm: Properly reset no-dat Claudio Imbrenda
  2023-11-09 12:44 ` Claudio Imbrenda
@ 2023-11-09 13:11 ` Christian Borntraeger
  2023-11-14 16:24 ` Nico Boehr
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2023-11-09 13:11 UTC (permalink / raw)
  To: Claudio Imbrenda, kvm
  Cc: linux-kernel, linux-s390, frankja, nrb, nsg, hca, gor, svens,
	agordeev, Gerald Schaefer

Am 09.11.23 um 13:36 schrieb Claudio Imbrenda:
> 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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] KVM: s390/mm: Properly reset no-dat
  2023-11-09 12:36 [PATCH v1 1/1] KVM: s390/mm: Properly reset no-dat Claudio Imbrenda
  2023-11-09 12:44 ` Claudio Imbrenda
  2023-11-09 13:11 ` Christian Borntraeger
@ 2023-11-14 16:24 ` Nico Boehr
  2 siblings, 0 replies; 4+ messages in thread
From: Nico Boehr @ 2023-11-14 16:24 UTC (permalink / raw)
  To: Claudio Imbrenda, kvm
  Cc: linux-kernel, linux-s390, frankja, nsg, borntraeger, hca,
	gerald.schaefer, gor, svens, agordeev

Quoting Claudio Imbrenda (2023-11-09 13:36:24)
> 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.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

Please Cc stable and add my:

Reviewed-by: Nico Boehr <nrb@linux.ibm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-14 16:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 12:36 [PATCH v1 1/1] KVM: s390/mm: Properly reset no-dat Claudio Imbrenda
2023-11-09 12:44 ` Claudio Imbrenda
2023-11-09 13:11 ` Christian Borntraeger
2023-11-14 16:24 ` Nico Boehr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox