Re: ARM inline assembly usage in Linux kernel

2014-02-18 Thread Andrew Pinski
On Tue, Feb 18, 2014 at 6:56 PM, Saleem Abdulrasool wrote: > Hello. > > I am sending this at the behest of Renato. I have been working on the ARM > integrated assembler in LLVM and came across an interesting item in the Linux > kernel. > > I am wondering if this is an unstated covenant between th

ARM inline assembly usage in Linux kernel

2014-02-18 Thread Saleem Abdulrasool
Hello. I am sending this at the behest of Renato. I have been working on the ARM integrated assembler in LLVM and came across an interesting item in the Linux kernel. I am wondering if this is an unstated covenant between the kernel and GCC or simply a clever use of an unintended/undefined behav

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Sewell
On 18 February 2014 20:43, Torvald Riegel wrote: > On Tue, 2014-02-18 at 12:12 +, Peter Sewell wrote: >> Several of you have said that the standard and compiler should not >> permit speculative writes of atomics, or (effectively) that the >> compiler should preserve dependencies. In simple ex

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 10:40:15PM +0100, Torvald Riegel wrote: > xagsmtp4.20140218214207.8...@vmsdvm9.vnet.ibm.com > X-Xagent-Gateway: vmsdvm9.vnet.ibm.com (XAGSMTP4 at VMSDVM9) > > On Tue, 2014-02-18 at 09:16 -0800, Paul E. McKenney wrote: > > On Tue, Feb 18, 2014 at 08:49:13AM -0800, Linus Torv

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Linus Torvalds
On Tue, Feb 18, 2014 at 1:21 PM, Torvald Riegel wrote: >> >> So imagine that you have some clever global optimizer that sees that >> the program never ever actually sets the dirty bit at all in any >> thread, and then uses that kind of non-local knowledge to make >> optimization decisions. THAT WO

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Zijlstra
> > 4. Some drivers allow user-mode code to mmap() some of their > > state. Any changes undertaken by the user-mode code would > > be invisible to the compiler. > > A good point, but a compiler that doesn't try to (incorrectly) assume > something about the semantics of mmap will simply s

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Tue, 2014-02-18 at 22:40 +0100, Peter Zijlstra wrote: > On Tue, Feb 18, 2014 at 10:21:56PM +0100, Torvald Riegel wrote: > > Well, that's how atomics that aren't volatile are defined in the > > standard. I can see that you want something else too, but that doesn't > > mean that the other thing i

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Zijlstra
On Tue, Feb 18, 2014 at 10:21:56PM +0100, Torvald Riegel wrote: > Yes, I do. But that seems to be "volatile" territory. It crosses the > boundaries of the abstract machine, and thus is input/output. Which > fraction of your atomic accesses can read values produced by hardware? > I would still su

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Zijlstra
On Tue, Feb 18, 2014 at 10:21:56PM +0100, Torvald Riegel wrote: > Well, that's how atomics that aren't volatile are defined in the > standard. I can see that you want something else too, but that doesn't > mean that the other thing is broken. Well that other thing depends on being able to see the

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Tue, 2014-02-18 at 09:16 -0800, Paul E. McKenney wrote: > On Tue, Feb 18, 2014 at 08:49:13AM -0800, Linus Torvalds wrote: > > On Tue, Feb 18, 2014 at 7:31 AM, Torvald Riegel wrote: > > > On Mon, 2014-02-17 at 16:05 -0800, Linus Torvalds wrote: > > >> And exactly because I know enough, I would *

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 09:43:31PM +0100, Torvald Riegel wrote: > xagsmtp5.20140218204423.3...@bldgate.vnet.ibm.com > X-Xagent-Gateway: bldgate.vnet.ibm.com (XAGSMTP5 at BLDGATE) > > On Tue, 2014-02-18 at 12:12 +, Peter Sewell wrote: > > Several of you have said that the standard and compiler

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Tue, 2014-02-18 at 08:49 -0800, Linus Torvalds wrote: > On Tue, Feb 18, 2014 at 7:31 AM, Torvald Riegel wrote: > > On Mon, 2014-02-17 at 16:05 -0800, Linus Torvalds wrote: > >> And exactly because I know enough, I would *really* like atomics to be > >> well-defined, and have very clear - and *l

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Tue, 2014-02-18 at 18:21 +, Peter Sewell wrote: > On 18 February 2014 17:38, Linus Torvalds > wrote: > > On Tue, Feb 18, 2014 at 4:12 AM, Peter Sewell > > wrote: > >> > >> For example, suppose we have, in one compilation unit: > >> > >> void f(int ra, int*rb) { > >> if (ra==42)

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Tue, 2014-02-18 at 12:12 +, Peter Sewell wrote: > Several of you have said that the standard and compiler should not > permit speculative writes of atomics, or (effectively) that the > compiler should preserve dependencies. In simple examples it's easy > to see what that means, but in gener

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Tue, 2014-02-18 at 08:55 -0800, Paul E. McKenney wrote: > On Tue, Feb 18, 2014 at 04:38:40PM +0100, Torvald Riegel wrote: > > On Mon, 2014-02-17 at 16:18 -0800, Linus Torvalds wrote: > > > On Mon, Feb 17, 2014 at 3:41 PM, Torvald Riegel > > > wrote: > > > > > > > > There's an underlying proble

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Tue, 2014-02-18 at 09:44 -0800, Linus Torvalds wrote: > On Tue, Feb 18, 2014 at 8:17 AM, Torvald Riegel wrote: > > The standard is clear on what's required. I strongly suggest reading > > the formalization of the memory model by Batty et al. > > Can you point to it? Because I can find a draft

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 10:49:27AM -0800, Linus Torvalds wrote: > On Tue, Feb 18, 2014 at 10:21 AM, Peter Sewell > wrote: > > > > This is a bit more subtle, because (on ARM and POWER) removing the > > dependency and conditional branch is actually in general *not* equivalent > > in the hardware, in

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 06:23:47PM +, Peter Sewell wrote: > On 18 February 2014 17:16, Paul E. McKenney > wrote: > > On Tue, Feb 18, 2014 at 08:49:13AM -0800, Linus Torvalds wrote: > >> On Tue, Feb 18, 2014 at 7:31 AM, Torvald Riegel wrote: > >> > On Mon, 2014-02-17 at 16:05 -0800, Linus Tor

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 09:44:48AM -0800, Linus Torvalds wrote: > On Tue, Feb 18, 2014 at 8:17 AM, Torvald Riegel wrote: [ . . . ] > > The standard is clear on what's required. I strongly suggest reading > > the formalization of the memory model by Batty et al. > > Can you point to it? Because

Re: TYPE_BINFO and canonical types at LTO

2014-02-18 Thread Jan Hubicka
> > Non-ODR types born from other frontends will then need to be made to > > alias all the ODR variants that can be done by storing them into the > > current canonical type hash. > > (I wonder if we want to support cross language aliasing for non-POD?) > > Surely for accessing components of non-

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Linus Torvalds
On Tue, Feb 18, 2014 at 10:23 AM, Peter Sewell wrote: > > interesting list. So are you saying that value-range-analysis and > such-like (I say glibly, without really knowing what "such-like" > refers to here) are fundamentally incompatible with > the kernel code No, it's fine to do things like v

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Linus Torvalds
On Tue, Feb 18, 2014 at 10:21 AM, Peter Sewell wrote: > > This is a bit more subtle, because (on ARM and POWER) removing the > dependency and conditional branch is actually in general *not* equivalent > in the hardware, in a concurrent context. So I agree, but I think that's a generic issue with

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Sewell
On 18 February 2014 17:16, Paul E. McKenney wrote: > On Tue, Feb 18, 2014 at 08:49:13AM -0800, Linus Torvalds wrote: >> On Tue, Feb 18, 2014 at 7:31 AM, Torvald Riegel wrote: >> > On Mon, 2014-02-17 at 16:05 -0800, Linus Torvalds wrote: >> >> And exactly because I know enough, I would *really* li

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Sewell
On 18 February 2014 17:38, Linus Torvalds wrote: > On Tue, Feb 18, 2014 at 4:12 AM, Peter Sewell > wrote: >> >> For example, suppose we have, in one compilation unit: >> >> void f(int ra, int*rb) { >> if (ra==42) >> *rb=42; >> else >> *rb=42; >> } > > So this

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Linus Torvalds
On Tue, Feb 18, 2014 at 8:17 AM, Torvald Riegel wrote: >> >> "Consume operation: no reads in the current thread dependent on the >> value currently loaded can be reordered before this load" > > I can't remember seeing that language in the standard (ie, C or C++). > Where is this from? That's ju

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Linus Torvalds
On Tue, Feb 18, 2014 at 4:12 AM, Peter Sewell wrote: > > For example, suppose we have, in one compilation unit: > > void f(int ra, int*rb) { > if (ra==42) > *rb=42; > else > *rb=42; > } So this is a great example, and in general I really like your page at: > F

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 03:16:33PM +, Mark Batty wrote: > Hi Paul, > > Thanks for the document. I'm looking forward to reading the bits about > dependency chains in Linux. And I am looking forward to your thoughts on those bits! > > One point of confusion for me... Example 4 says "language

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 08:49:13AM -0800, Linus Torvalds wrote: > On Tue, Feb 18, 2014 at 7:31 AM, Torvald Riegel wrote: > > On Mon, 2014-02-17 at 16:05 -0800, Linus Torvalds wrote: > >> And exactly because I know enough, I would *really* like atomics to be > >> well-defined, and have very clear -

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 04:38:40PM +0100, Torvald Riegel wrote: > On Mon, 2014-02-17 at 16:18 -0800, Linus Torvalds wrote: > > On Mon, Feb 17, 2014 at 3:41 PM, Torvald Riegel wrote: > > > > > > There's an underlying problem here that's independent from the actual > > > instance that you're worried

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 04:56:40PM +0100, Torvald Riegel wrote: > On Mon, 2014-02-17 at 19:00 -0800, Paul E. McKenney wrote: > > On Mon, Feb 17, 2014 at 12:18:21PM -0800, Linus Torvalds wrote: > > > On Mon, Feb 17, 2014 at 11:55 AM, Torvald Riegel > > > wrote: > > > > > > > > Which example do you

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Linus Torvalds
On Tue, Feb 18, 2014 at 7:31 AM, Torvald Riegel wrote: > On Mon, 2014-02-17 at 16:05 -0800, Linus Torvalds wrote: >> And exactly because I know enough, I would *really* like atomics to be >> well-defined, and have very clear - and *local* - rules about how they >> can be combined and optimized. >

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 03:33:35PM +, Peter Sewell wrote: > Hi Paul, > > On 18 February 2014 14:56, Paul E. McKenney > wrote: > > On Tue, Feb 18, 2014 at 12:12:06PM +, Peter Sewell wrote: > >> Several of you have said that the standard and compiler should not > >> permit speculative writ

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Mon, 2014-02-17 at 16:09 -0800, Linus Torvalds wrote: > On Mon, Feb 17, 2014 at 3:17 PM, Torvald Riegel wrote: > > On Mon, 2014-02-17 at 14:32 -0800, > > > >> Stop claiming it "can return 1".. It *never* returns 1 unless you do > >> the load and *verify* it, or unless the load itself can be mad

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Mon, 2014-02-17 at 19:42 -0800, Linus Torvalds wrote: > On Mon, Feb 17, 2014 at 7:24 PM, Linus Torvalds > wrote: > > > > As far as I can tell, the intent is that you can't do value > > speculation (except perhaps for the "relaxed", which quite frankly > > sounds largely useless). > > Hmm. The

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Sewell
On 18 February 2014 12:53, Peter Zijlstra wrote: > On Tue, Feb 18, 2014 at 12:12:06PM +, Peter Sewell wrote: >> Several of you have said that the standard and compiler should not >> permit speculative writes of atomics, or (effectively) that the >> compiler should preserve dependencies. > > Th

Deadline for DWARF Version 5 comments -- March 31, 2014

2014-02-18 Thread Michael Eager
The DWARF Debugging Information Format Committee (http://dwarfstd.org) is nearing completion on the DWARF Version 5 standard. We anticipate a public comment draft to be released mid-2014. As in the past, we have attempted where possible to make DWARF Version 5 backward compatible with previous v

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Mon, 2014-02-17 at 19:00 -0800, Paul E. McKenney wrote: > On Mon, Feb 17, 2014 at 12:18:21PM -0800, Linus Torvalds wrote: > > On Mon, Feb 17, 2014 at 11:55 AM, Torvald Riegel wrote: > > > > > > Which example do you have in mind here? Haven't we resolved all the > > > debated examples, or did I

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Mon, 2014-02-17 at 16:18 -0800, Linus Torvalds wrote: > On Mon, Feb 17, 2014 at 3:41 PM, Torvald Riegel wrote: > > > > There's an underlying problem here that's independent from the actual > > instance that you're worried about here: "no sense" is a ultimately a > > matter of taste/objectives/p

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Sewell
Hi Paul, On 18 February 2014 14:56, Paul E. McKenney wrote: > On Tue, Feb 18, 2014 at 12:12:06PM +, Peter Sewell wrote: >> Several of you have said that the standard and compiler should not >> permit speculative writes of atomics, or (effectively) that the >> compiler should preserve dependen

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Torvald Riegel
On Mon, 2014-02-17 at 16:05 -0800, Linus Torvalds wrote: > And exactly because I know enough, I would *really* like atomics to be > well-defined, and have very clear - and *local* - rules about how they > can be combined and optimized. "Local"? > None of this "if you can prove that the read has v

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Mark Batty
Hi Paul, Thanks for the document. I'm looking forward to reading the bits about dependency chains in Linux. > One point of confusion for me... Example 4 says "language must allow". > Shouldn't that be "language is permitted to allow"? When we say "allow", we mean that the optimised execution sh

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Paul E. McKenney
On Tue, Feb 18, 2014 at 12:12:06PM +, Peter Sewell wrote: > Several of you have said that the standard and compiler should not > permit speculative writes of atomics, or (effectively) that the > compiler should preserve dependencies. In simple examples it's easy > to see what that means, but i

[LM-32] Code generation for address loading

2014-02-18 Thread FX MOREL
Hi everyone, I am developing on a custom design using the LatticeMico32 architecture and I use gcc 4.5.1 to compile C code for this arch. In this architecture, the loading of an address 0x always takes two assembly instructions to fetch the address because immediates are on 16 bits :

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Zijlstra
On Tue, Feb 18, 2014 at 12:12:06PM +, Peter Sewell wrote: > Several of you have said that the standard and compiler should not > permit speculative writes of atomics, or (effectively) that the > compiler should preserve dependencies. The example below only deals with control dependencies; so I

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-18 Thread Peter Sewell
Several of you have said that the standard and compiler should not permit speculative writes of atomics, or (effectively) that the compiler should preserve dependencies. In simple examples it's easy to see what that means, but in general it's not so clear what the language should guarantee, becaus

Re: TYPE_BINFO and canonical types at LTO

2014-02-18 Thread Richard Biener
On Tue, 18 Feb 2014, Richard Biener wrote: > On Mon, 17 Feb 2014, Jan Hubicka wrote: > > > > > > > Yeah, ok. But we treat those types (B and C) TBAA equivalent because > > > structurally they are the same ;) Luckily C has a "proper" field > > > for its base (proper means that offset and size a

Re: TYPE_BINFO and canonical types at LTO

2014-02-18 Thread Richard Biener
On Mon, 17 Feb 2014, Jan Hubicka wrote: > > > > Yeah, ok. But we treat those types (B and C) TBAA equivalent because > > structurally they are the same ;) Luckily C has a "proper" field > > for its base (proper means that offset and size are correct as well > > as the type). It indeed has DECL

Re: MSP430 in gcc4.9 ... enable interrupts?

2014-02-18 Thread David Brown
On 18/02/14 00:12, DJ Delorie wrote: >> I presume these will be part of the headers for the library >> distributed for msp430 gcc by TI/Redhat? > > I can't speak for TI's or Red Hat's plans. GNU's typical non-custom > embedded runtime is newlib/libgloss, which usually doesn't have that > much in