public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sanders <linux@sandersweb.net>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Cc: "the arch/x86 maintainers" <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: nops in virtual pc x86
Date: Fri, 12 Sep 2008 17:11:47 -0400	[thread overview]
Message-ID: <200809121711.48558.linux@sandersweb.net> (raw)

Well, I thought we determined that multibyte nops were causing virtual pc to 
die and removing them made it work fine.  Then why do I see this
$ cat /proc/cpuinfo | grep nopl

flags           : fpu vme pse tsc msr pae cx8 sep pge cmov acpi mmx fxsr sse 
sse2 constant_tsc up nopl lahf_lm
             
It seems the detection code in common.c is saying nops are supported.  Huh?

SO I ran this code:
#include <stdio.h>
#include <time.h>

int main()
{
	unsigned char nopl1[2] = { 0x90, 0xc3 };
	unsigned char nopl2[3] = { 0x66, 0x90, 0xc3 };
	unsigned char nopl3[4] = { 0x0f, 0x1f, 0x00, 0xc3 };
	unsigned char nopl4[5] = { 0x0f, 0x1f, 0x40, 0x00, 0xc3 };
	unsigned char nopl5[6] = { 0x0f, 0x1f, 0x44, 0x00, 0x00, 0xc3 };
	unsigned char nopl6[7] = { 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00, 0xc3 };
	unsigned char nopl7[8] = { 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc3 };
	unsigned char nopl8[9] = { 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 
0xc3 };
	
	int i;
	for (i=0;i<100000;i++) {
		((void (*)()) nopl1)();
		((void (*)()) nopl2)();
		((void (*)()) nopl3)();
		((void (*)()) nopl4)();
		((void (*)()) nopl5)();
		((void (*)()) nopl6)();
		((void (*)()) nopl7)();
		((void (*)()) nopl8)();
	}
	
	printf("Executed 800,000 NOPLs in %d ticks with no errors.\n", clock());
	return 0;
}

It seems I can run 800000 nopl's without anyone complaining in user space.

Could it perhaps depend on the context the nops appear in?


             reply	other threads:[~2008-09-12 21:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12 21:11 David Sanders [this message]
2008-09-12 21:20 ` nops in virtual pc x86 H. Peter Anvin
2008-09-12 22:04 ` Linus Torvalds
2008-09-12 22:20   ` H. Peter Anvin
2008-09-12 23:05   ` David Sanders
2008-09-12 23:15     ` H. Peter Anvin

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=200809121711.48558.linux@sandersweb.net \
    --to=linux@sandersweb.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --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