[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFNnc1hZEWcU0Nh_@google.com>
Date: Wed, 18 Jun 2025 18:27:15 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Oliver Upton <oliver.upton@...ux.dev>
Cc: James Houghton <jthoughton@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>,
Jonathan Corbet <corbet@....net>, Marc Zyngier <maz@...nel.org>, Yan Zhao <yan.y.zhao@...el.com>,
Nikita Kalyazin <kalyazin@...zon.com>, Anish Moorthy <amoorthy@...gle.com>,
Peter Gonda <pgonda@...gle.com>, Peter Xu <peterx@...hat.com>,
David Matlack <dmatlack@...gle.com>, wei.w.wang@...el.com, kvm@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev
Subject: Re: [PATCH v3 04/15] KVM: Add common infrastructure for KVM Userfaults
On Wed, Jun 18, 2025, Oliver Upton wrote:
> On Wed, Jun 18, 2025 at 01:33:17PM -0700, Sean Christopherson wrote:
> > On Wed, Jun 18, 2025, Oliver Upton wrote:
> > And this path is other motiviation for returning a boolean. To me, return "success"
> > when a uaccess fails looks all kinds of wrong:
> >
> > if (__get_user(chunk, user_chunk))
> > return 0;
>
> Yeah, that's gross. Although I would imagine we want to express
> "failure" here, game over, out to userspace for resolution. So maybe:
>
> if (__get_user(chunk, user_chunk))
> return -EFAULT;
I toyed with that idea too, but if kvm_do_userfault() returns a value, that it
bugs me to no end that the callers blindly convert all failures to -EFAULT. To
avoid that, callers would have to be:
r = kvm_do_userfault(vcpu, &fault);
if (r)
return r;
And that just annoyed me. :-) But I'm a-ok with that direction if that's
preferrable to the boolean return.
Powered by blists - more mailing lists