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] [thread-next>] [day] [month] [year] [list]
Message-ID: <mhng-7c486840-63d3-4645-84ff-8c89660fc552@palmer-si-x1c4>
Date:   Wed, 23 Jan 2019 18:00:35 -0800 (PST)
From:   Palmer Dabbelt <palmer@...ive.com>
To:     guoren@...nel.org
CC:     Christoph Hellwig <hch@...radead.org>, aou@...s.berkeley.edu,
        linux-arch@...r.kernel.org, linux-riscv@...ts.infradead.org,
        linux-kernel@...r.kernel.org, ren_guo@...ky.com, mao_han@...ky.com
Subject:     Re: [PATCH] riscv: fixup max_low_pfn with PFN_DOWN.

On Tue, 15 Jan 2019 17:07:38 PST (-0800), guoren@...nel.org wrote:
> Hi Christoph,
>
> I use PFN_DOWN() every where as possible and seems it's a habit
> problem. So let risc-v maintainer to choose "PFN_DOW()" or
> ">> PAGE_SHIFT".
>
> Also the same with "end_of_DRAM & max_low_pfn".

PFN_DOWN makes sense to me, as that's what we're trying to do here (round a 
physical address down to page frame number).  Am a I misunderstanding 
something?

>
> Best Regards
>  Guo Ren
>
> On Tue, Jan 15, 2019 at 08:12:54AM -0800, Christoph Hellwig wrote:
>> On Wed, Jan 16, 2019 at 12:10:00AM +0800, Guo Ren wrote:
>> > > >  	set_max_mapnr(PFN_DOWN(mem_size));
>> > > > -	max_low_pfn = memblock_end_of_DRAM();
>> > > > +	max_low_pfn = PFN_DOWN(memblock_end_of_DRAM());
>> > >
>> > > I know it is used just above, but can we please just switch this
>> > > code to use >> PAGE_SHIFT instead of PFN_DOWN, which just horribly
>> > > obsfucates what is going on?
>> > ???
>> > #define PFN_DOWN(x)	((x) >> PAGE_SHIFT)
>> >
>> > phys_addr_t __init_memblock memblock_end_of_DRAM(void)
>> > {
>> > 	int idx = memblock.memory.cnt - 1;
>> >
>> > 	return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size);
>> > }
>> >
>> > What's the problem? PFN_DOWN() couldn't be used with function call?
>>
>> PFN_DOWN gives you the correct result.  But I think it actually
>> drastically reduces readability over just opencoding it.
>>
>> > My patch just want to point out that max_low_pfn is PFN not size. In fact
>> > there is no error for running without my patch :P
>>
>> No, I think your patch is correct.  I just wonder if we could make
>> the code easier to read.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ