linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@transmeta.com>
To: Andi Kleen <ak@muc.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Alternative patching for prefetches & cleanup
Date: Sat, 26 Apr 2003 20:09:45 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0304262005460.25292-100000@home.transmeta.com> (raw)
In-Reply-To: <20030427021958.GA27897@averell>


On Sun, 27 Apr 2003, Andi Kleen wrote:
> 
> It also adds nop types for various CPUs straight from their optimization 
> manuals. Now you can always get the fastest nops for K7,K8 and Intel.
> I moved them into the include files to make it easy to use them
> for padding alternative()s. Some cleanups in the patch function to use this.

Please, this part I definitely want cleaned up.

> +++ linux-gencpu/arch/i386/kernel/setup.c	2003-04-27 04:12:32.000000000 +0200
> @@ -795,41 +795,42 @@
>  		pci_mem_start = low_mem_size;
>  }
>  
> +asm("nops: " 
> +    ASM_NOP1 ASM_NOP2 ASM_NOP3 ASM_NOP4 ASM_NOP5 ASM_NOP6
> +    ASM_NOP7 ASM_NOP8); 
> +

This in particular is just too ugly for words. Why can't you just have a

	static const char *intel_nops[] = {
		NULL,
		INOP1, INOP2, INOP3, INOP4, INOP5, INOP6, INOP7, INOP8
	};

	static const char *k7_nops[] = {
		NULL,
		K7NOP1, K7NOP2, ...
	}

	....

	/*
	 * This will be overridden at boot once we find out what kind of 
	 * CPU we actually have
	 */
	static char **nops = intel_nops;

and then just use

	.. nops[size] ..

when you want a nop of size "size".

		Linus


  reply	other threads:[~2003-04-27  2:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-27  2:19 [PATCH] Alternative patching for prefetches & cleanup Andi Kleen
2003-04-27  3:09 ` Linus Torvalds [this message]
2003-04-27  3:14   ` Andi Kleen
2003-04-27  3:22     ` Linus Torvalds
2003-04-27  3:27       ` Andi Kleen
2003-04-27  3:32       ` William Lee Irwin III
2003-04-27  8:50       ` Rene Herman

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=Pine.LNX.4.44.0304262005460.25292-100000@home.transmeta.com \
    --to=torvalds@transmeta.com \
    --cc=ak@muc.de \
    --cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).