All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Christoph Lameter <clameter@sgi.com>
Cc: Andi Kleen <ak@suse.de>, Jeremy Fitzhardinge <jeremy@goop.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [patch 1/3] Percpu infrastructure to rebase the per cpu area to 0UL
Date: Sun, 2 Dec 2007 14:04:56 +1100	[thread overview]
Message-ID: <200712021404.57263.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20071130064359.604365398@sgi.com>

On Friday 30 November 2007 17:43:06 Christoph Lameter wrote:
> Support an option
>
> 	CONFIG_PERCPU_ZERO_BASED
>
> that makes offsets for per cpu variables start at zero.
>
> If a percpu area starts at zero then
>
> 1. We do not need RELOC_HIDE anymore

Hi Christoph,

    Why do you think this is true?  You're still doing arithmetic on variable 
addresses beyond the bound of the variable.

> 2. Indexes off the per cpu area for each processor are small
>
> 3. The percpu area "addresses" are offsets and we can then
>    have allocpercpu/cpu_alloc in the future also use these
>    offsets so that percpu functions can take any type of
>    percpu address if it is provided by a percpu variable
>    or a pointer obtained via allocpercpu/cpu_alloc.

This last point is orthogonal to offsetting at zero though...

> +#ifdef CONFIG_PERCPU_ZERO_BASED
> +extern char __per_cpu_load[];
> +extern char ____per_cpu_size[];
> +#define __per_cpu_size ((unsigned long)&____per_cpu_size)
> +#define __per_cpu_start ((char *)0)
> +#define __per_cpu_end ((char *)__per_cpu_size)
> +#else
>  extern char __per_cpu_start[], __per_cpu_end[];
> +#define __per_cpu_load __per_cpu_start
> +#define __per_cpu_size (__per_cpu_end - __per_cpu_start)
> +#endif

Hmm, can't you just define __per_cpu_start and __per_cpu_end in the linker 
script and fold this code back together again?

>  	for_each_possible_cpu(i) {
> -		start = (unsigned long) &__per_cpu_start + per_cpu_offset(i);
> -		end   = (unsigned long) &__per_cpu_start + PERCPU_ENOUGH_ROOM
> +		start = (unsigned long) __per_cpu_start + per_cpu_offset(i);
> +		end   = (unsigned long) __per_cpu_start + PERCPU_ENOUGH_ROOM
>  					+ per_cpu_offset(i);

I found the original clearer; why change it?

Cheers,
Rusty.

  reply	other threads:[~2007-12-03  9:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30  6:43 [patch 0/3] Per cpu relocation to ZERO and x86_32 percpu ops on x86_64 Christoph Lameter
2007-11-30  6:43 ` [patch 1/3] Percpu infrastructure to rebase the per cpu area to 0UL Christoph Lameter
2007-12-02  3:04   ` Rusty Russell [this message]
2007-12-02  3:13   ` Rusty Russell
2007-11-30  6:43 ` [patch 2/3] X86_64: Declare pda as per cpu data thereby moving it into the cpu area Christoph Lameter
2007-11-30  6:43 ` [patch 3/3] x86_64: Make the x86_32 percpu operations usable on x86_64 Christoph Lameter
2007-11-30 20:07   ` Christoph Lameter
2007-11-30 11:24 ` [patch 0/3] Per cpu relocation to ZERO and x86_32 percpu ops " Ingo Molnar
2007-11-30 11:26   ` Ingo Molnar
2007-11-30 17:08     ` Christoph Lameter
2007-11-30 17:19     ` Christoph Lameter
2007-11-30 18:00       ` Ingo Molnar
2007-11-30 18:24         ` Christoph Lameter
2007-11-30 18:35           ` Ingo Molnar
2007-11-30 18:47             ` Christoph Lameter
2007-11-30 19:45               ` Ingo Molnar
2007-11-30 19:59                 ` Christoph Lameter
2007-11-30 20:06                   ` Ingo Molnar
2007-11-30 20:09                     ` Christoph Lameter
2007-11-30 20:26                   ` Ingo Molnar
2007-11-30 20:43                     ` Ingo Molnar
2007-11-30 18:41           ` Ingo Molnar
2007-11-30 18:43             ` Christoph Lameter

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=200712021404.57263.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=ak@suse.de \
    --cc=clameter@sgi.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.