Pass the right type of flag to vcpu_dat_fault_handler(); it expects a
FOLL_* flag (in particular FOLL_WRITE), but FAULT_FLAG_WRITE is passed
instead.
This still works because they happen to have the same integer value,
but it's a mistake, thus the fix.
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Fixes: 05066cafa925 ("s390/mm/fault: Handle guest-related program interrupts in KVM")
---
arch/s390/kvm/kvm-s390.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index d5ad10791c25..d41d77f2c7cd 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -4954,13 +4954,13 @@ static int vcpu_dat_fault_handler(struct kvm_vcpu *vcpu, unsigned long gaddr, un
static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu)
{
- unsigned int flags = 0;
+ unsigned int foll = 0;
unsigned long gaddr;
int rc;
gaddr = current->thread.gmap_teid.addr * PAGE_SIZE;
if (kvm_s390_cur_gmap_fault_is_write())
- flags = FAULT_FLAG_WRITE;
+ foll = FOLL_WRITE;
switch (current->thread.gmap_int_code & PGM_INT_CODE_MASK) {
case 0:
@@ -5002,7 +5002,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu)
send_sig(SIGSEGV, current, 0);
if (rc != -ENXIO)
break;
- flags = FAULT_FLAG_WRITE;
+ foll = FOLL_WRITE;
fallthrough;
case PGM_PROTECTION:
case PGM_SEGMENT_TRANSLATION:
@@ -5012,7 +5012,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu)
case PGM_REGION_SECOND_TRANS:
case PGM_REGION_THIRD_TRANS:
kvm_s390_assert_primary_as(vcpu);
- return vcpu_dat_fault_handler(vcpu, gaddr, flags);
+ return vcpu_dat_fault_handler(vcpu, gaddr, foll);
default:
KVM_BUG(1, vcpu->kvm, "Unexpected program interrupt 0x%x, TEID 0x%016lx",
current->thread.gmap_int_code, current->thread.gmap_teid.val);
--
2.50.1
Am 05.08.25 um 13:14 schrieb Claudio Imbrenda: > Pass the right type of flag to vcpu_dat_fault_handler(); it expects a > FOLL_* flag (in particular FOLL_WRITE), but FAULT_FLAG_WRITE is passed > instead. > > This still works because they happen to have the same integer value, > but it's a mistake, thus the fix. > > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > Fixes: 05066cafa925 ("s390/mm/fault: Handle guest-related program interrupts in KVM") Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com> Shouldnt we rename the parameter to __kvm_s390_handle_dat_fault and vcpu_dat_fault_handler from flags to foll as well in their implementation and prototypes to keep this consistent? > --- > arch/s390/kvm/kvm-s390.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index d5ad10791c25..d41d77f2c7cd 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -4954,13 +4954,13 @@ static int vcpu_dat_fault_handler(struct kvm_vcpu *vcpu, unsigned long gaddr, un > > static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) > { > - unsigned int flags = 0; > + unsigned int foll = 0; > unsigned long gaddr; > int rc; > > gaddr = current->thread.gmap_teid.addr * PAGE_SIZE; > if (kvm_s390_cur_gmap_fault_is_write()) > - flags = FAULT_FLAG_WRITE; > + foll = FOLL_WRITE; > > switch (current->thread.gmap_int_code & PGM_INT_CODE_MASK) { > case 0: > @@ -5002,7 +5002,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) > send_sig(SIGSEGV, current, 0); > if (rc != -ENXIO) > break; > - flags = FAULT_FLAG_WRITE; > + foll = FOLL_WRITE; > fallthrough; > case PGM_PROTECTION: > case PGM_SEGMENT_TRANSLATION: > @@ -5012,7 +5012,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) > case PGM_REGION_SECOND_TRANS: > case PGM_REGION_THIRD_TRANS: > kvm_s390_assert_primary_as(vcpu); > - return vcpu_dat_fault_handler(vcpu, gaddr, flags); > + return vcpu_dat_fault_handler(vcpu, gaddr, foll); > default: > KVM_BUG(1, vcpu->kvm, "Unexpected program interrupt 0x%x, TEID 0x%016lx", > current->thread.gmap_int_code, current->thread.gmap_teid.val);
On Tue, 5 Aug 2025 13:44:04 +0200 Christian Borntraeger <borntraeger@de.ibm.com> wrote: > Am 05.08.25 um 13:14 schrieb Claudio Imbrenda: > > Pass the right type of flag to vcpu_dat_fault_handler(); it expects a > > FOLL_* flag (in particular FOLL_WRITE), but FAULT_FLAG_WRITE is passed > > instead. > > > > This still works because they happen to have the same integer value, > > but it's a mistake, thus the fix. > > > > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > > Fixes: 05066cafa925 ("s390/mm/fault: Handle guest-related program interrupts in KVM") > > Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com> > > Shouldnt we rename the parameter to __kvm_s390_handle_dat_fault and > vcpu_dat_fault_handler from flags to foll as well in their > implementation and prototypes to keep this consistent? that's a fair point a patch in an upcoming series will do that, but I guess I can move that change here instead. I'll send a v2 later on today > > > --- > > arch/s390/kvm/kvm-s390.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > > index d5ad10791c25..d41d77f2c7cd 100644 > > --- a/arch/s390/kvm/kvm-s390.c > > +++ b/arch/s390/kvm/kvm-s390.c > > @@ -4954,13 +4954,13 @@ static int vcpu_dat_fault_handler(struct kvm_vcpu *vcpu, unsigned long gaddr, un > > > > static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) > > { > > - unsigned int flags = 0; > > + unsigned int foll = 0; > > unsigned long gaddr; > > int rc; > > > > gaddr = current->thread.gmap_teid.addr * PAGE_SIZE; > > if (kvm_s390_cur_gmap_fault_is_write()) > > - flags = FAULT_FLAG_WRITE; > > + foll = FOLL_WRITE; > > > > switch (current->thread.gmap_int_code & PGM_INT_CODE_MASK) { > > case 0: > > @@ -5002,7 +5002,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) > > send_sig(SIGSEGV, current, 0); > > if (rc != -ENXIO) > > break; > > - flags = FAULT_FLAG_WRITE; > > + foll = FOLL_WRITE; > > fallthrough; > > case PGM_PROTECTION: > > case PGM_SEGMENT_TRANSLATION: > > @@ -5012,7 +5012,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) > > case PGM_REGION_SECOND_TRANS: > > case PGM_REGION_THIRD_TRANS: > > kvm_s390_assert_primary_as(vcpu); > > - return vcpu_dat_fault_handler(vcpu, gaddr, flags); > > + return vcpu_dat_fault_handler(vcpu, gaddr, foll); > > default: > > KVM_BUG(1, vcpu->kvm, "Unexpected program interrupt 0x%x, TEID 0x%016lx", > > current->thread.gmap_int_code, current->thread.gmap_teid.val); >
On 05.08.25 13:14, Claudio Imbrenda wrote: > Pass the right type of flag to vcpu_dat_fault_handler(); it expects a > FOLL_* flag (in particular FOLL_WRITE), but FAULT_FLAG_WRITE is passed > instead. > > This still works because they happen to have the same integer value, > but it's a mistake, thus the fix. > > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > Fixes: 05066cafa925 ("s390/mm/fault: Handle guest-related program interrupts in KVM") > --- Reviewed-by: David Hildenbrand <david@redhat.com> -- Cheers, David / dhildenb
© 2016 - 2025 Red Hat, Inc.