lkml.org 
[lkml]   [2022]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/9] KVM: s390: Extend MEM_OP ioctl by storage key checked cmpxchg
On Thu, 01 Dec 2022 18:44:56 +0100
Janis Schoetterl-Glausch <scgl@linux.ibm.com> wrote:

> >
> > please also document -EOPNOTSUPP
>
> I'd add "* -EOPNOTSUPP: should never occur", then, that ok with you?

no, also explain in which conditions it is returned

something like:
* -EOPNOTSUPP: if the memslot is not writable (should never occour)

> >
> > > + */
> > > +int cmpxchg_guest_abs_with_key(struct kvm *kvm, gpa_t gpa, int len,
> > > + __uint128_t *old_p, __uint128_t new,
> > > + u8 access_key)
> > > +{
> > > + gfn_t gfn = gpa >> PAGE_SHIFT;
> > > + struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn);
> >
> > exchange the above two lines (reverse christmas tree)
>
> Is this a hard requirement? Since there is a dependency.
> If I do the initialization further down, the order wouldn't actually change.

ahhhhh right, I had missed that

keep it as it is, of course

[...]

> > I really dislike repeating the same code 5 times, but I guess there was
> > no other way?
>
> I could use the function called by cmpxchg_user_key directly, but Heiko won't agree to that.
> A macro would work too, of course, not sure if I prefer that tho.

ok so there is no other way, let's keep it as it is

[...]

> To me it feels like KVM_S390_MEMOP_R_NO_XCHG is api surface and should be referenced here.
> cmpxchg_guest_abs_with_key isn't mem op specific
> (of course that's the only thing it is currently used for).

fair enough

> >
> > > + if (copy_to_user(old_p, &old.raw[off_in_quad], mop->size))
> > > + r = -EFAULT;
> > > + }
> > > } else {
> > > if (copy_from_user(tmpbuf, uaddr, mop->size)) {
> > > r = -EFAULT;
> >
>

\
 
 \ /
  Last update: 2022-12-02 10:04    [W:0.106 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site