[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210712185107.vgm2qyltftzmfua7@liuwe-devbox-debian-v2>
Date: Mon, 12 Jul 2021 18:51:07 +0000
From: Wei Liu <wei.liu@...nel.org>
To: Michael Kelley <mikelley@...rosoft.com>
Cc: Wei Liu <wei.liu@...nel.org>,
Stephen Hemminger <sthemmin@...rosoft.com>,
KY Srinivasan <kys@...rosoft.com>,
Dexuan Cui <decui@...rosoft.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, "x86@...nel.org" <x86@...nel.org>,
"hpa@...or.com" <hpa@...or.com>, "arnd@...db.de" <arnd@...db.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>
Subject: Re: [PATCH 1/3] Drivers: hv: Make portions of Hyper-V init code be
arch neutral
On Mon, Jul 12, 2021 at 06:41:21PM +0000, Michael Kelley wrote:
> From: Wei Liu <wei.liu@...nel.org> Sent: Monday, July 12, 2021 11:24 AM
> >
> > On Sun, Jul 11, 2021 at 08:25:14PM -0700, Michael Kelley wrote:
> > [...]
> > > +int hv_common_cpu_init(unsigned int cpu)
> > > +{
> > > + void **inputarg, **outputarg;
> > > + u64 msr_vp_index;
> > > + gfp_t flags;
> > > + int pgcount = hv_root_partition ? 2 : 1;
> > > +
> > > + /* hv_cpu_init() can be called with IRQs disabled from hv_resume() */
> > > + flags = irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL;
> > > +
> > > + inputarg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg);
> > > + *inputarg = kmalloc(pgcount * HV_HYP_PAGE_SIZE, flags);
> >
> > This is changed from alloc_pages to kmalloc. Does it ensure the
> > alignment is still correct?
> >
> > Wei.
>
> It does. The alignment guarantee made by kmalloc() was changed a
> couple of years ago. See commit 59bb47985c1d. Here's the current text
> from the comments preceding kmalloc():
>
> * The allocated object address is aligned to at least ARCH_KMALLOC_MINALIGN
> * bytes. For @size of power of two bytes, the alignment is also guaranteed
> * to be at least to the size.
OK. That's good.
Wei.
>
> Michael
>
Powered by blists - more mailing lists