From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: davidm@hpl.hp.com, linux-kernel@vger.kernel.org,
torvalds@transmeta.com, rth@twiddle.net
Subject: Re: [PATCH] 2.5.1-pre5: per-cpu areas
Date: Thu, 14 Mar 2002 00:05:41 -0500 [thread overview]
Message-ID: <3C902FA5.5010208@mandrakesoft.com> (raw)
In-Reply-To: <E16lMzi-0002bb-00@wagner.rustcorp.com.au>
Rusty Russell wrote:
>In message <15504.7958.677592.908691@napali.hpl.hp.com> you write:
>
>>OK, I see this. Unfortunately, HIDE_RELOC() causes me problems
>>because it prevents me from taking the address of a per-CPU variable.
>>This is useful when you have a per-CPU structure (e.g., cpu_info).
>>Perhaps there should/could be a version of HIDE_RELOC() that doesn't
>>dereference the resulting address?
>>
>
>Yep, valid point. Patch below: please play.
>
>diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.7-pre1/include/linux/compiler.h working-2.5.7-pre1-nfarp/include/linux/compiler.h
>--- linux-2.5.7-pre1/include/linux/compiler.h Fri Mar 8 14:49:29 2002
>+++ working-2.5.7-pre1-nfarp/include/linux/compiler.h Thu Mar 14 15:32:38 2002
>@@ -13,10 +13,4 @@
> #define likely(x) __builtin_expect((x),1)
> #define unlikely(x) __builtin_expect((x),0)
>
>-/* This macro obfuscates arithmetic on a variable address so that gcc
>- shouldn't recognize the original var, and make assumptions about it */
>-#define RELOC_HIDE(var, off) \
>- ({ __typeof__(&(var)) __ptr; \
>- __asm__ ("" : "=g"(__ptr) : "0"((void *)&(var) + (off))); \
>- *__ptr; })
> #endif /* __LINUX_COMPILER_H */
>diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.7-pre1/include/linux/percpu.h working-2.5.7-pre1-nfarp/include/linux/percpu.h
>--- linux-2.5.7-pre1/include/linux/percpu.h Thu Jan 1 10:00:00 1970
>+++ working-2.5.7-pre1-nfarp/include/linux/percpu.h Thu Mar 14 15:32:44 2002
>@@ -0,0 +1,28 @@
>+#ifndef __LINUX_PERCPU_H
>+#define __LINUX_PERCPU_H
>+
>+/* This macro obfuscates arithmetic on a variable address so that gcc
>+ shouldn't recognize the original var, and make assumptions about it */
>+#define RELOC_HIDE(ptr, off) \
>+ ({ __typeof__(ptr) __ptr; \
>+ __asm__ ("" : "=g"(__ptr) : "0"((void *)(ptr) + (off))); \
>+ __ptr; })
>
Your other changes look good, but RELOC_HIDE really does belong in
compiler.h... and percpu.h is a particularly poor choice of destination.
Why not satisfy DavidM's objection by creating (or stating you allow
the creation of) __RELOC_HIDE or similar. Or perhaps call your version
__RELOC_HIDE, if yours is not the normal case?
It really shouldn't be moved from where it belongs, linux/compiler.h...
Jeff
next prev parent reply other threads:[~2002-03-14 5:06 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <15504.7958.677592.908691@napali.hpl.hp.com>
2002-03-14 4:37 ` [PATCH] 2.5.1-pre5: per-cpu areas Rusty Russell
2002-03-14 5:05 ` Jeff Garzik [this message]
2002-03-14 11:14 ` Rusty Russell
2002-03-14 11:26 ` Jeff Garzik
2002-03-14 12:16 ` Rusty Russell
2002-03-14 12:25 ` Jeff Garzik
2002-03-15 1:00 ` Richard Henderson
2002-03-14 9:37 ` Richard Henderson
2002-03-14 18:06 ` David Mosberger
[not found] <15504.7958.677592.908691@napali.hpl.hp.com.suse.lists.linux.kernel>
[not found] ` <E16lMzi-0002bb-00@wagner.rustcorp.com.au.suse.lists.linux.kernel>
2002-03-14 8:39 ` Andi Kleen
2002-03-14 11:09 ` Rusty Russell
2002-03-14 11:14 ` Andi Kleen
2002-03-14 19:48 ` H. Peter Anvin
2002-03-14 18:04 ` David Mosberger
2002-03-14 18:51 ` Andi Kleen
2002-03-15 4:07 ` Rusty Russell
2002-03-15 9:13 ` Andi Kleen
2002-03-17 7:17 ` Rusty Russell
2002-03-18 7:35 ` Andi Kleen
2002-03-19 0:02 ` Rusty Russell
2002-03-19 0:08 ` J.A. Magallon
2002-03-19 0:15 ` Andi Kleen
2002-03-19 17:05 ` Richard Henderson
2002-03-15 4:19 ` David Mosberger
2002-03-15 5:52 ` Rusty Russell
2001-12-05 22:09 Rusty Russell
2001-12-06 7:21 ` Keith Owens
2001-12-06 8:07 ` David S. Miller
2001-12-06 9:18 ` Chris Wedgwood
2001-12-07 15:03 ` Pavel Machek
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=3C902FA5.5010208@mandrakesoft.com \
--to=jgarzik@mandrakesoft.com \
--cc=davidm@hpl.hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rth@twiddle.net \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@transmeta.com \
/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).