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]
Date:	Sat, 22 Aug 2009 13:18:16 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Amerigo Wang <amwang@...hat.com>, linux-kernel@...r.kernel.org,
	tony.luck@...el.com, linux-ia64@...r.kernel.org,
	nhorman@...hat.com, ebiederm@...ssion.com, andi@...stfloor.org,
	bernhard.walle@....de, fenghua.yu@...el.com,
	kamezawa.hiroyu@...fujitsu.com, avorontsov@...mvista.com
Subject: Re: [Patch 5/8] ia64: implement crashkernel=auto


* Andrew Morton <akpm@...ux-foundation.org> wrote:

> On Fri, 21 Aug 2009 02:55:04 -0400
> Amerigo Wang <amwang@...hat.com> wrote:
> 
> > +#ifdef CONFIG_KEXEC_AUTO_RESERVE
> > +#define ARCH_HAS_DEFAULT_CRASH_SIZE
> > +static inline
> > +unsigned long long arch_default_crash_size(unsigned long long total_size)
> > +{
> > +	if (total_size >= 4ULL<<30 && total_size < 12ULL<<30)
> > +		return 1ULL<<28;
> > +	else if (total_size >= 12ULL<<30 && total_size < 128ULL<<30)
> > +		return 1ULL<<29;
> > +	else if (total_size >= 128ULL<<30 && total_size < 256ULL<<30)
> > +		return 3ULL<<28;
> > +	else if (total_size >= 256ULL<<30 && total_size < 378ULL<<30)
> > +		return 1ULL<<30;
> > +	else if (total_size >= 318ULL<<30 && total_size < 512ULL<<30)
> > +		return 3ULL<<29;
> > +	else if (total_size >= 512ULL<<30 && total_size < 768ULL<<30)
> > +		return 2ULL<<30;
> > +	else if (total_size >= 768ULL<<30)
> > +		return 3ULL<<30;
> > +}
> > +#include <asm-generic/kexec.h>
> > +#endif
> 
> a) Why on earth is this inlined?
> 
> b) Please consider making arch_default_crash_size() a __weak
>    function.  You'll probably find the result to be pleasing.
> 
> c) If we can't use __weak then please don't add
>    ARCH_HAS_DEFAULT_CRASH_SIZE.  Instead do this trick:
> 
> 
> 	#ifndef arch_default_crash_size
> 	static inline unsigned long long arch_default_crash_size(unsigned long long total_size)
> 	{
> 		...
> 	}
> 	#define arch_default_crash_size arch_default_crash_size
> 	#endif
> 
> 	because i) it's good to standardise on something and ii) one less
> 	symbol gets added to the kernel.
> 
> d) why is asm-generic/kexec.h only included in asm/kexec.h if
>    CONFIG_KEXEC_AUTO_RESERVE happened to be defined?  That makes no
>    sense - there may be a multitude of reasons why asm/kexec.h wants
>    to include asm-generic/kexec.h.

e) All the 'else' statements are superflous and make it all harder 
   to read.

f) 2ULL<<30 should be written as 1ULL<31, to keep things consistent.

g) A nice comment explaining the purpose and logic wouldnt hurt.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ