All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Dave Jones <davej@codemonkey.org.uk>,
	Mike Travis <travis@sgi.com>, Ingo Molnar <mingo@elte.hu>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Jack Steiner <steiner@sgi.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>,
	Lennert Buytenhek <kernel@wantstofly.org>,
	Paul Jackson <pj@sgi.com>, Tony Luck <tony.luck@intel.com>,
	Tigran Aivazian <tigran@aivazian.fsnet.co.uk>,
	Paul Mackerras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Robert Richter <robert.richter@amd.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Sam Creasey <sammy@sammy.net>, Greg Banks <gnb@sgi.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Adrian Bunk <bunk@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andreas Schwab <schwab@suse.de>,
	Johannes Weiner <hannes@saeurebad.de>
Subject: Re: [PATCH 1/1] cpumask: Change cpumask_of_cpu to use	cpumask_of_cpu_map
Date: Wed, 30 Jul 2008 11:37:52 -0700	[thread overview]
Message-ID: <4890B500.7040100@sgi.com> (raw)
In-Reply-To: <4890A0A8.4000502@sgi.com>

Mike Travis wrote:
> Dave Jones wrote:
>> On Wed, Jul 23, 2008 at 10:18:42AM -0700, Mike Travis wrote:
>>  >   * The previous "lvalue replacement for cpumask_of_cpu()" was not usable
>>  >     in certain situations and generally added unneeded complexity.  So
>>  >     this patch replaces the cpumask_of_cpu_ptr* macros with a generic
>>  >     cpumask_of_cpu_map[].  The only config option is whether this is a
>>  >     static map, or allocated at boot up time:
>>
>> I've lost the plot on what's going on with these cpumask patches.
>> But I just saw this on -rc1.
>>
>> arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c:206:33: error: not addressable
>> arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c:274:32: error: not addressable
>> arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c:352:34: error: not addressable
>>
>> 	Dave
>>
> 
> It looks like some old code is still there (patch dropped?).  I'll send a fix asap.
> 
> Thanks,
> Mike

After I recreated linux-next the changes all appear to be there now.
One problem though, is !SMP config does not build (something about
DECLARE_BITMAP with NR_CPUS=1.)  I wasn't sure how to create a constant
"(cpumask_t)1" that worked as an lvalue, so the following patch is
somewhat a kluge, but fulfills the requirements.

If anyone has a better suggestion, please let me know.

Subject: [PATCH] cpmask: add cpumask_of_cpu(0) for non-SMP

  * Fix cpumask_of_cpu(0) when CONFIG_SMP is not set by providing a
    pointer to a cpumask_t with cpu 0 bit set.

Signed-of-by: Mike Travis <travis@sgi.com
---
 include/linux/cpumask.h |    6 ++++++
 kernel/cpu.c            |    7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

--- linux-2.6.tip.orig/include/linux/cpumask.h
+++ linux-2.6.tip/include/linux/cpumask.h
@@ -265,6 +265,7 @@ static inline void __cpus_shift_left(cpu
 	bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
 }
 
+#ifdef CONFIG_SMP
 /*
  * Special-case data structure for "single bit set only" constant CPU masks.
  *
@@ -288,6 +289,11 @@ static inline const cpumask_t *get_cpu_m
  * variable created:
  */
 #define cpumask_of_cpu(cpu)	(*get_cpu_mask(cpu))
+#else
+
+extern const cpumask_t cpu_bit_bitmap_of_one;
+#define cpumask_of_cpu(cpu)	cpu_bit_bitmap_of_one
+#endif
 
 
 #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
--- linux-2.6.tip.orig/kernel/cpu.c
+++ linux-2.6.tip/kernel/cpu.c
@@ -35,6 +35,8 @@ EXPORT_SYMBOL(cpu_online_map);
 cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL;
 EXPORT_SYMBOL(cpu_possible_map);
 
+const cpumask_t cpu_bit_bitmap_of_one = { { [0] = 1 } };
+
 #else /* CONFIG_SMP */
 
 /* Serializes the updates to cpu_online_map, cpu_present_map */
@@ -454,8 +456,6 @@ out:
 }
 #endif /* CONFIG_PM_SLEEP_SMP */
 
-#endif /* CONFIG_SMP */
-
 /*
  * cpu_bit_bitmap[] is a special, "compressed" data structure that
  * represents all NR_CPUS bits binary values of 1<<nr.
@@ -480,3 +480,6 @@ const unsigned long cpu_bit_bitmap[BITS_
 #endif
 };
 EXPORT_SYMBOL_GPL(cpu_bit_bitmap);
+
+#endif /* CONFIG_SMP */
+


  reply	other threads:[~2008-07-30 18:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23 17:18 [PATCH 0/1] cpumask: Change cpumask_of_cpu to use cpumask_of_cpu_map Mike Travis
2008-07-23 17:18 ` [PATCH 1/1] " Mike Travis
2008-07-24  2:45   ` Rusty Russell
2008-07-24 17:56     ` Mike Travis
2008-07-25  0:37       ` Mike Travis
2008-07-24 11:46   ` Ingo Molnar
2008-07-24 17:11     ` Mike Travis
2008-07-24 19:12       ` Mike Travis
2008-07-24 12:56   ` Bert Wesarg
2008-07-24 17:15     ` Mike Travis
2008-07-25  0:27       ` Mike Travis
2008-07-25  1:26         ` Paul Jackson
2008-07-30 16:55   ` Dave Jones
2008-07-30 17:11     ` Mike Travis
2008-07-30 18:37       ` Mike Travis [this message]
2008-07-30 18:50         ` Dave Jones
2008-07-30 19:25           ` Mike Travis
2008-07-30 19:50             ` Dave Jones
2008-07-30 20:02   ` [PATCH 1/1] cpumask: Change cpumask_of_cpu to use cpumask_of_cpu_map - build breakage Tim Bird
2008-07-30 21:24     ` Mike Travis
2008-07-30 22:03       ` Tim Bird
2008-07-30 23:48         ` Stephen Rothwell
2008-07-31  0:11           ` Tim Bird

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=4890B500.7040100@sgi.com \
    --to=travis@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=bunk@kernel.org \
    --cc=cl@linux-foundation.org \
    --cc=davej@codemonkey.org.uk \
    --cc=ebiederm@xmission.com \
    --cc=gnb@sgi.com \
    --cc=hannes@saeurebad.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=kernel@wantstofly.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=pj@sgi.com \
    --cc=robert.richter@amd.com \
    --cc=rusty@rustcorp.com.au \
    --cc=sammy@sammy.net \
    --cc=schwab@suse.de \
    --cc=schwidefsky@de.ibm.com \
    --cc=steiner@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=tigran@aivazian.fsnet.co.uk \
    --cc=tony.luck@intel.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 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.