On Wed, Jan 13, 2016 at 06:25:21PM +0200, Michael S. Tsirkin wrote:> Which flag do you refer to, exactly?All the flags in rFLAGS which ADD modifies: OF,SF,ZF,AF,PF,CF -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.
On Wed, Jan 13, 2016 at 05:33:31PM +0100, Borislav Petkov wrote:> On Wed, Jan 13, 2016 at 06:25:21PM +0200, Michael S. Tsirkin wrote: > > Which flag do you refer to, exactly? > > All the flags in rFLAGS which ADD modifies: OF,SF,ZF,AF,PF,CFOh, I think this means we need a "cc" clobber. This also seems to be a bug on !XMM CPUs. cmpxchg.h gets it right. I'll send a patch.> -- > Regards/Gruss, > Boris. > > ECO tip #101: Trim your mails when you reply.
On Wed, Jan 13, 2016 at 06:42:48PM +0200, Michael S. Tsirkin wrote:> Oh, I think this means we need a "cc" clobber.Btw, does your microbenchmark do it too? Because, the "cc" clobber should cause additional handling of flags, depending on the context. It won't matter if the context doesn't need rFLAGS handling in the benchmark but if we start using LOCK; ADD in the kernel, I can imagine some places where mb() is used and rFLAGS are live, causing gcc to either reorder code or stash them away... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.
On Wed, Jan 13, 2016 at 8:42 AM, Michael S. Tsirkin <mst at redhat.com> wrote:> > Oh, I think this means we need a "cc" clobber.It's probably a good idea to add one. Historically, gcc doesn't need one on x86, and always considers flags clobbered. We are probably missing the cc clobber in a *lot* of places for this reason. But even if not necessary, it's probably a good thing to add for documentation, and in case gcc semantcs ever change. Linus