public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Kees Cook <keescook@chromium.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] x86/math-emu: Add support for FCMOVcc and F[U]COMI[P] insns
Date: Sun, 20 Sep 2015 10:13:40 +0200	[thread overview]
Message-ID: <20150920081340.GA8571@gmail.com> (raw)
In-Reply-To: <55FC255F.4070202@redhat.com>


* Denys Vlasenko <dvlasenk@redhat.com> wrote:

> >>  arch/x86/math-emu/fpu_aux.c     |  70 ++++++++++++++++++++++
> >>  arch/x86/math-emu/fpu_entry.c   |  49 +++++++++------
> >>  arch/x86/math-emu/fpu_proto.h   |  12 ++++
> >>  arch/x86/math-emu/reg_compare.c | 128 ++++++++++++++++++++++++++++++++++++++++
> >>  4 files changed, 241 insertions(+), 18 deletions(-)
> > 
> > I wanted to apply this patch, but noticed the following problem: why are two 
> > instruction families added in a single patch?
> 
> They were introduced at the same time in the CPU evolution
> (when CMOV feature was added).
> 
> The idea is that there may be programs which assume that "cmov"
> in /proc/cpuinfo means both these insns are safe to use,
> which is true for all real CPUs.

I see, that makes sense - and this makes bisection of any bugs in the emulator 
implementation harder.

Still, it cannot hurt I suppose.

Btw., has anyone explored the possibility to have an emulator 'runtime test' on 
FPU-capable CPUs: to run in FPU emulation and to run the emulation code, but to 
also run the real hardware instruction(s) against that context and double check 
that the two FPU register sets match up, bit for bit?

If the emulator is perfect then the two would always match: the hardware 
instruction generates the exact same result as software emulation.

This would slows down emulation a bit (but emulation is slow anyway due to trap 
overhead), but makes it a lot more obvious that the emulator is correct.

It's not a trivial feature though I suspect, exceptions would have to be taken 
care of, etc.

The motivation would be to make it much easier to extend the emulator, which would 
be useful to run modern Linux distros on future low-power x86 designs that have no 
FPU circuitry altogether.

Thanks,

	Ingo

      reply	other threads:[~2015-09-20  8:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 19:48 [PATCH 1/2] x86/math-emu: Add support for FCMOVcc and F[U]COMI[P] insns Denys Vlasenko
2015-09-16 19:48 ` [PATCH 2/2] x86/math-emu: Remove define layer for undocumented opcodes Denys Vlasenko
2015-09-18  7:36   ` Ingo Molnar
2015-09-16 19:51 ` [PATCH 1/2] x86/math-emu: Add support for FCMOVcc and F[U]COMI[P] insns Denys Vlasenko
2015-09-17  7:22   ` Ingo Molnar
2015-09-18  7:33 ` Ingo Molnar
2015-09-18 14:53   ` Denys Vlasenko
2015-09-20  8:13     ` Ingo Molnar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150920081340.GA8571@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox