[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190306170346.zs6orsyu327c6m2p@dwarf.suse.cz>
Date: Wed, 6 Mar 2019 18:03:46 +0100
From: Jiri Bohac <jbohac@...e.cz>
To: Kairui Song <kasong@...hat.com>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Alexey Dobriyan <adobriyan@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Omar Sandoval <osandov@...com>, Baoquan He <bhe@...hat.com>,
Dave Young <dyoung@...hat.com>
Subject: Re: [PATCH v4] x86/gart/kcore: Exclude GART aperture from kcore
Hi,
On Wed, Mar 06, 2019 at 07:38:59PM +0800, Kairui Song wrote:
> +int register_mem_pfn_is_ram(int (*fn)(unsigned long pfn))
> +{
> + if (mem_pfn_is_ram)
> + return -EBUSY;
> + mem_pfn_is_ram = fn;
> + return 0;
> +}
> +
> +void unregister_mem_pfn_is_ram(void)
> +{
> + mem_pfn_is_ram = NULL;
> +}
> +
> +static int pfn_is_ram(unsigned long pfn)
> +{
> + if (mem_pfn_is_ram)
> + return mem_pfn_is_ram(pfn);
> + else
> + return 1;
> +}
> +
If anyone were ever to use unregister_mem_pfn_is_ram(),
pfn_is_ram() would become racy.
In V2 you had this:
+ fn = mem_pfn_is_ram;
+ if (fn)
+ ret = fn(pfn);
I agree it's unnecessary since nothing uses
unregister_mem_pfn_is_ram(). But then I think it would be best to
just drop the unregister function.
Otherwise the patch looks good to me.
--
Jiri Bohac <jbohac@...e.cz>
SUSE Labs, Prague, Czechia
Powered by blists - more mailing lists