[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] mini-os: x86_64: crash passing double arguments
>>> On 02.07.14 at 13:39, <Ian.Campbell@xxxxxxxxxx> wrote: > On Wed, 2014-07-02 at 12:32 +0100, Jan Beulich wrote: >> >>> On 02.07.14 at 13:16, <talex5@xxxxxxxxx> wrote: >> > On 2 July 2014 11:36, Jan Beulich <JBeulich@xxxxxxxx> wrote: >> >>>>> On 02.07.14 at 12:17, <talex5@xxxxxxxxx> wrote: >> >>> Subtracting 8 bytes from thread->sp when creating a new thread fixes >> >>> it (patch attached), but I'm not sure whether this is the right >> >>> solution, or whether there's a problem elsewhere (I know very little >> >>> about x86). >> >> >> >> Considering that this really is kernel code, passing >> >> -mpreferred-stack-boundary=2 to gcc would seem like the better >> >> option to me, or else someone might run into a similar issue again >> >> trying to use %ymm or %zmm registers in their MiniOS incarnation. >> > >> > Could you explain this a bit further? It looks like using >> > -mpreferred-stack-boundary=2 just means that the code won't compile >> > ("error: -mpreferred-stack-boundary=2 is not between 4 and 12"). >> >> Yeah, I should have written "3" (2 is for ix86). Linux uses 3, so it >> certainly works (but without checking I can't immediately say >> whether that's perhaps tied to the use of -mcmodel=kernel). >> >> > Although Mini-OS applications run in kernel mode, they can still be >> > full applications, and need to use all the processor's features. >> >> Right, and that option doesn't preclude that use. It's just that >> the compiler will take care to align the stack suitably in each >> function when it's told that the to be expected alignment is less >> strict than the one needed, or to use instructions not requiring >> full alignment. > > Wouldn't it be more efficient to simply arrange that the thread's > initial stack meets the necessary preconditions for the standard > alignments like Thomas has done though? Especially given the trivial > nature of the patch. But that can't be done once and forever, as pointed out before: If in the future someone wants his MiniOS incarnation to use AVX or AVX512, the now enforced 16-byte alignment would still not be enough, it would need growing to 32 or 64 bytes. By using the named command line option one can make the compiler take care of this. Of course an option would be to use his patch to ensure 16-byte alignment and -mpreferred-stack-boundary=4 to cover eventual use of the wider registers. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |