mbox series

[0/3] Replace current->mm by kvm->mm on powerpc/kvm

Message ID 20190923212409.7153-1-leonardo@linux.ibm.com
Headers show
Series Replace current->mm by kvm->mm on powerpc/kvm | expand

Message

Leonardo Bras Sept. 23, 2019, 9:24 p.m. UTC
By replacing, we would reduce the use of 'global' current on code,
relying more in the contents of kvm struct.

On code, I found that in kvm_create_vm() there is:
kvm->mm = current->mm;

And that on every kvm_*_ioctl we have tests like that:
if (kvm->mm != current->mm)
        return -EIO;

So this change would be safe.

I split the changes in 3 patches, so it would be easier to read
and reject separated parts. If decided that squashing is better,
I see no problem doing that.

Best regards,

Leonardo Bras (3):
  powerpc/kvm/book3s: Replace current->mm by kvm->mm
  powerpc/kvm/book3e: Replace current->mm by kvm->mm
  powerpc/kvm/e500: Replace current->mm by kvm->mm

 arch/powerpc/kvm/book3s_64_mmu_hv.c |  4 ++--
 arch/powerpc/kvm/book3s_64_vio.c    |  6 +++---
 arch/powerpc/kvm/book3s_hv.c        | 10 +++++-----
 arch/powerpc/kvm/booke.c            |  2 +-
 arch/powerpc/kvm/e500_mmu_host.c    |  6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

Comments

Paul Mackerras Sept. 24, 2019, 2 a.m. UTC | #1
On Mon, Sep 23, 2019 at 06:24:06PM -0300, Leonardo Bras wrote:
> By replacing, we would reduce the use of 'global' current on code,
> relying more in the contents of kvm struct.
> 
> On code, I found that in kvm_create_vm() there is:
> kvm->mm = current->mm;
> 
> And that on every kvm_*_ioctl we have tests like that:
> if (kvm->mm != current->mm)
>         return -EIO;
> 
> So this change would be safe.
> 
> I split the changes in 3 patches, so it would be easier to read
> and reject separated parts. If decided that squashing is better,
> I see no problem doing that.

The patch series looks fine.  It has missed the 5.4 merge window, and
it doesn't fix any bugs, so I will queue it up for the 5.5 merge
window, meaning that I will put it into my kvm-ppc-next branch when I
prepare it for the 5.5 merge window, probably in about a month from
now.

This remark also applies to your other patch "Reduce calls to get
current->mm by storing the value locally".

Thanks,
Paul.
Leonardo Bras Sept. 24, 2019, 1:46 p.m. UTC | #2
On Tue, 2019-09-24 at 12:00 +1000, Paul Mackerras wrote:
> On Mon, Sep 23, 2019 at 06:24:06PM -0300, Leonardo Bras wrote:
> > By replacing, we would reduce the use of 'global' current on code,
> > relying more in the contents of kvm struct.
> > 
> > On code, I found that in kvm_create_vm() there is:
> > kvm->mm = current->mm;
> > 
> > And that on every kvm_*_ioctl we have tests like that:
> > if (kvm->mm != current->mm)
> >         return -EIO;
> > 
> > So this change would be safe.
> > 
> > I split the changes in 3 patches, so it would be easier to read
> > and reject separated parts. If decided that squashing is better,
> > I see no problem doing that.
> 
> The patch series looks fine.  It has missed the 5.4 merge window, and
> it doesn't fix any bugs, so I will queue it up for the 5.5 merge
> window, meaning that I will put it into my kvm-ppc-next branch when I
> prepare it for the 5.5 merge window, probably in about a month from
> now.
> 
> This remark also applies to your other patch "Reduce calls to get
> current->mm by storing the value locally".
> 
> Thanks,
> Paul.

Thanks!
Leonardo Bras