Skip to contentSkip to conversation

pae: tlbflush linear page table updates

PATCH Tian, Kevin 3 participants 4 messages Aug 12, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 16 lines

From: [email protected] [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Wednesday, August 10, 2005 9:12 PM

Quoted 11 lines · Gerd Knorr
Quoted 1 line

Sure? The patch below fixes it for me.

Uhm, well, it doesn't really fix it.

Quoted 2 lines

The tlbflush stuff is red herring btw, the real difference is optimization. Build with "optimize=n" boot fine, others don't.

While looking into this I've noticed the bug comes and goes away with the optimization level. Building with -O1 works fine, building with -O2 breaks (both with the patch mailed applied).

Quoted 7 lines
Quoted 1 line

There might be something wrong with the inline assembler ...

See the fix I just this minute checked in :-)

Hopefully it should fix all these weirdnesses....

-- Keir

Is similar fix also required by __put_user_64?

#define __put_user_u64(x, addr, retval, errret)                 \
	...
	: "=r"(retval)                                  \
    : "A" (x), "r" (addr), "i"(errret), "0"(retval))

I'm not sure exact rules for compiler to choose registers. But once compiler optimizes retval or addr to reuse eax/edx under some condition, user will also see either incorrect return value, or incorrect content written to incorrect address. Can we assume such optimization never happen?

Thanks,
Kevin

#1 lore raw
Quoted 1 line · Kevin

Is similar fix also required by __put_user_64?

No.

Quoted 10 lines
#define __put_user_u64(x, addr, retval, errret)                 \
	...
	: "=r"(retval)                                  \
    : "A" (x), "r" (addr), "i"(errret), "0"(retval))

I'm not sure exact rules for compiler to choose registers. But once compiler optimizes retval or addr to reuse eax/edx under some condition, user will also see either incorrect return value, or incorrect content written to incorrect address. Can we assume such optimization never happen?

The compiler will never alias inputs. In this case it is forced to alias the output constraint with input retval, and so the output cannot alias with any other input (which would be an error).

-- Keir

#2 lore raw
Quoted 4 lines · Keir Fraser

The compiler will never alias inputs. In this case it is forced to alias the output constraint with input retval, and so the output cannot alias with any other input (which would be an error).

Actually it will sometimes. That is what the "early clobber" (&) prevents. Perhaps it should be used here.

-Andi

#3 lore raw
Quoted 6 lines · Andi Kleen
Quoted 3 lines

The compiler will never alias inputs. In this case it is forced to alias the output constraint with input retval, and so the output cannot alias with any other input (which would be an error).

Actually it will sometimes. That is what the "early clobber" (&) prevents. Perhaps it should be used here.

Do you have an example?

-- Keir