lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 3 Sep 2021 09:21:48 +0000
From:   Justin He <Justin.He@....com>
To:     Marc Zyngier <maz@...nel.org>
CC:     James Morse <James.Morse@....com>,
        Alexandru Elisei <Alexandru.Elisei@....com>,
        Suzuki Poulose <Suzuki.Poulose@....com>,
        Catalin Marinas <Catalin.Marinas@....com>,
        Will Deacon <will@...nel.org>,
        Liu Shixin <liushixin2@...wei.com>,
        Eric Auger <eric.auger@...hat.com>,
        Kees Cook <keescook@...omium.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Shenming Lu <lushenming@...wei.com>,
        Sami Tolvanen <samitolvanen@...gle.com>,
        Lorenzo Pieralisi <Lorenzo.Pieralisi@....com>,
        Xiaoming Ni <nixiaoming@...wei.com>,
        Zenghui Yu <yuzenghui@...wei.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "kvmarm@...ts.cs.columbia.edu" <kvmarm@...ts.cs.columbia.edu>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] KVM: arm64: Add memcg accounting to KVM allocations



> -----Original Message-----
> From: Marc Zyngier <maz@...nel.org>
> Sent: Friday, September 3, 2021 2:12 AM
> To: Justin He <Justin.He@....com>
> Cc: James Morse <James.Morse@....com>; Alexandru Elisei
> <Alexandru.Elisei@....com>; Suzuki Poulose <Suzuki.Poulose@....com>;
> Catalin Marinas <Catalin.Marinas@....com>; Will Deacon <will@...nel.org>;
> Liu Shixin <liushixin2@...wei.com>; Eric Auger <eric.auger@...hat.com>;
> Kees Cook <keescook@...omium.org>; Nick Desaulniers
> <ndesaulniers@...gle.com>; Shenming Lu <lushenming@...wei.com>; Sami
> Tolvanen <samitolvanen@...gle.com>; Lorenzo Pieralisi
> <Lorenzo.Pieralisi@....com>; Xiaoming Ni <nixiaoming@...wei.com>; Zenghui
> Yu <yuzenghui@...wei.com>; linux-arm-kernel@...ts.infradead.org;
> kvmarm@...ts.cs.columbia.edu; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH 2/2] KVM: arm64: Add memcg accounting to KVM
> allocations
> 
> On Thu, 02 Sep 2021 01:28:01 +0100,
> Jia He <justin.he@....com> wrote:
> >
> > Inspired by commit 254272ce6505 ("kvm: x86: Add memcg accounting to KVM
> > allocations"), it would be better to make arm64 KVM consistent with
> > common kvm codes.
> >
> > The memory allocations of VM scope should be charged into VM process
> > cgroup, hence change GFP_KERNEL to GFP_KERNEL_ACCOUNT.
> >
> > There remained a few cases since these allocations are global, not in VM
> > scope.
> >
> > Signed-off-by: Jia He <justin.he@....com>
> > ---
> >  arch/arm64/kvm/arm.c      | 6 ++++--
> >  arch/arm64/kvm/mmu.c      | 2 +-
> >  arch/arm64/kvm/pmu-emul.c | 2 +-
> >  arch/arm64/kvm/reset.c    | 2 +-
> >  4 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> > index e9a2b8f27792..9d6f5bcaddef 100644
> > --- a/arch/arm64/kvm/arm.c
> > +++ b/arch/arm64/kvm/arm.c
> > @@ -289,10 +289,12 @@ long kvm_arch_dev_ioctl(struct file *filp,
> >
> >  struct kvm *kvm_arch_alloc_vm(void)
> >  {
> > +	unsigned long sz = sizeof(struct kvm);
> 
> If you are going to introduce an extra variable, please use the
> correct type (size_t).

Okay
> 
> > +
> >  	if (!has_vhe())
> > -		return kzalloc(sizeof(struct kvm), GFP_KERNEL);
> > +		return kzalloc(sz, GFP_KERNEL | GFP_KERNEL_ACCOUNT);
> 
> Why both GFP_KERNEL and GFP_KERNEL_ACCOUNT?
Urgh, sorry for the mistake.

--
Cheers,
Justin (Jia He)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ