[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D0F6DA53F@AcuExch.aculab.com>
Date: Tue, 11 Mar 2014 09:51:32 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'David Miller' <davem@...emloft.net>,
"torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>
CC: "ast@...mgrid.com" <ast@...mgrid.com>,
"dborkman@...hat.com" <dborkman@...hat.com>,
"mingo@...nel.org" <mingo@...nel.org>,
"wad@...omium.org" <wad@...omium.org>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"a.p.zijlstra@...llo.nl" <a.p.zijlstra@...llo.nl>,
"hpa@...or.com" <hpa@...or.com>, "hagen@...u.net" <hagen@...u.net>,
"jesse@...ira.com" <jesse@...ira.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"fweisbec@...il.com" <fweisbec@...il.com>,
"acme@...radead.org" <acme@...radead.org>,
"penberg@....fi" <penberg@....fi>,
"arjan@...radead.org" <arjan@...radead.org>,
"hch@...radead.org" <hch@...radead.org>,
"xemul@...allels.com" <xemul@...allels.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH v8 net-next 1/3] filter: add Extended BPF interpreter
and converter
From: David Miller
> From: Linus Torvalds <torvalds@...ux-foundation.org>
> Date: Mon, 10 Mar 2014 19:02:18 -0700
>
> > I would generally suggest that people only use "bool" for function
> > return types, and absolutely nothing else. Seriously.
>
> I think it makes sense for function arguments too.
'bool' doesn't necessarily even make sense for function arguments
and results.
It might require the same additional masking of high bits that
are required for 'short' and 'char' parameters.
Also, IIRC, one of the arm ABIs used 32bit 'bool'.
Even the extra code that gets added to ensure that the 'bool'
values are either 0 or 1 can be a problem.
I don't know whether the recent compilers (or standards) say
whether the reader or writer is expected to enforce the domain.
But if the compiler uses a bit-wise AND for bool_a & bool_b there
is definitely scope for unexpected behaviour, and if the compiler
does anything else you get unwanted instructions and possibly branches.
Some old versions of gcc made a 'pigs breakfast' of bool_a |= bool_b.
David
--
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