mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 1/1] export cpu_online_map
@ 2005-10-26  4:20 akpm
  2005-10-27  3:50 ` Paul Jackson
  2005-10-28  2:49 ` Herbert Xu
  0 siblings, 2 replies; 12+ messages in thread
From: akpm @ 2005-10-26  4:20 UTC (permalink / raw)
  To: rajesh.shah; +Cc: mingo, pj, linux-kernel, akpm


From: Andrew Morton <akpm@osdl.org>

With CONFIG_SMP=n:

*** Warning: "cpu_online_map" [drivers/firmware/dcdbas.ko] undefined!

due to set_cpus_allowed().

Questions:

- Why isn't set_cpus_allowed() just a no-op on UP?  Or some trivial thing
  which tests for cpu #0?

- Why does cpu_online_map even exist on CONFIG_SMP=n?



Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 kernel/sched.c |    1 +
 1 files changed, 1 insertion(+)

diff -puN kernel/sched.c~export-cpu_online_map kernel/sched.c
--- devel/kernel/sched.c~export-cpu_online_map	2005-10-25 21:13:28.000000000 -0700
+++ devel-akpm/kernel/sched.c	2005-10-25 21:19:36.000000000 -0700
@@ -3879,6 +3879,7 @@ EXPORT_SYMBOL(cpu_present_map);
 
 #ifndef CONFIG_SMP
 cpumask_t cpu_online_map = CPU_MASK_ALL;
+EXPORT_SYMBOL(cpu_online_map);
 cpumask_t cpu_possible_map = CPU_MASK_ALL;
 #endif
 
_

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-26  4:20 [patch 1/1] export cpu_online_map akpm
@ 2005-10-27  3:50 ` Paul Jackson
  2005-10-27  4:08   ` Andrew Morton
  2005-10-27 10:48   ` Diego Calleja
  2005-10-28  2:49 ` Herbert Xu
  1 sibling, 2 replies; 12+ messages in thread
From: Paul Jackson @ 2005-10-27  3:50 UTC (permalink / raw)
  To: akpm; +Cc: rajesh.shah, mingo, linux-kernel, akpm

Andrew asked:
> - Why isn't set_cpus_allowed() just a no-op on UP?  Or some trivial thing
>   which tests for cpu #0?

I don't know.

By scanning random copies of kernels left on my drive, I can see that
it changed from a trivial "return 0" to the more interesting check using
cpu_online_map in one of your "linus.patch" patches in the release
2.6.11-rc1-mm2.

But I don't know how to get to the history at this point to see what
happened.

It looks like Linus started the git history at 2.6.12-rc2.

  Could someone clue me in on how to find Linux history BG (before-git)?

Since bk no longer works for me, I have no idea how to access any
history prior to about 2.6.12-rc2.  Ugh.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27  3:50 ` Paul Jackson
@ 2005-10-27  4:08   ` Andrew Morton
  2005-10-27  8:55     ` Paul Jackson
  2005-10-27 10:48   ` Diego Calleja
  1 sibling, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2005-10-27  4:08 UTC (permalink / raw)
  To: Paul Jackson; +Cc: rajesh.shah, mingo, linux-kernel

Paul Jackson <pj@sgi.com> wrote:
>
> Andrew asked:
> > - Why isn't set_cpus_allowed() just a no-op on UP?  Or some trivial thing
> >   which tests for cpu #0?
> 
> I don't know.
> 
> By scanning random copies of kernels left on my drive, I can see that
> it changed from a trivial "return 0" to the more interesting check using
> cpu_online_map in one of your "linus.patch" patches in the release
> 2.6.11-rc1-mm2.
> 
> But I don't know how to get to the history at this point to see what
> happened.
> 
> It looks like Linus started the git history at 2.6.12-rc2.
> 
>   Could someone clue me in on how to find Linux history BG (before-git)?
>
> Since bk no longer works for me, I have no idea how to access any
> history prior to about 2.6.12-rc2.  Ugh.

There's still bkbits.net:

http://linux.bkbits.net:8080/linux-2.6/diffs/include/linux/sched.h@1.271.1.6?nav=index.html|src/|src/include|src/include/linux|hist/include/linux/sched.h


From: Rusty Russell <rusty@rustcorp.com.au>

Return EINVAL for invalid sched_setaffinity on UP.  I was a little
surprised that sys_sched_setaffinity for CPU 1 didn't fail on my UP box. 
With CONFIG_SMP it would have.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/sched.h |    3 +++
 1 files changed, 3 insertions(+)

diff -puN include/linux/sched.h~sys_sched_setaffinity-on-up-should-fail-for-non-zero include/linux/sched.h
--- 25/include/linux/sched.h~sys_sched_setaffinity-on-up-should-fail-for-non-zero	2005-01-04 18:48:15.000000000 -0800
+++ 25-akpm/include/linux/sched.h	2005-01-04 20:24:20.010381184 -0800
@@ -13,6 +13,7 @@
 #include <linux/rbtree.h>
 #include <linux/thread_info.h>
 #include <linux/cpumask.h>
+#include <linux/errno.h>
 
 #include <asm/system.h>
 #include <asm/semaphore.h>
@@ -732,6 +733,8 @@ extern int set_cpus_allowed(task_t *p, c
 #else
 static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask)
 {
+	if (!cpus_intersects(new_mask, cpu_online_map))
+		return -EINVAL;
 	return 0;
 }
 #endif
_

Seems silly to use cpu_online_map to test for `1'?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27  4:08   ` Andrew Morton
@ 2005-10-27  8:55     ` Paul Jackson
  2005-10-27  9:35       ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Jackson @ 2005-10-27  8:55 UTC (permalink / raw)
  To: Andrew Morton; +Cc: rajesh.shah, mingo, linux-kernel

Andrew wrote:
> > Since bk no longer works for me, I have no idea how to access any
> > history prior to about 2.6.12-rc2.  Ugh.
> 
> There's still bkbits.net:
> 
> http://linux.bkbits.net:8080/linux-2.6/...

Ok - that helps.  Thanks.

There is also an hg (mercurial) web based Linux history at:

  http://www.kernel.org/hg/linux-2.6/

I still don't see something I can download into a local
hg or git repository -- if a lurker knows how that is done,
I'd be glad to know.


> Seems silly to use cpu_online_map to test for `1'?

Yeah - agreed.  The include/linux/cpumask.h stuff hardcodes
the UP (NR_CPUS==1) code to plain old 0's and 1's.  This
macro should do so as well.

I just sent a patch.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27  8:55     ` Paul Jackson
@ 2005-10-27  9:35       ` Andrew Morton
  2005-10-27 13:38         ` Paul Jackson
  2005-10-27 13:49         ` Paul Jackson
  0 siblings, 2 replies; 12+ messages in thread
From: Andrew Morton @ 2005-10-27  9:35 UTC (permalink / raw)
  To: Paul Jackson; +Cc: rajesh.shah, mingo, linux-kernel

Paul Jackson <pj@sgi.com> wrote:
>
> Andrew wrote:
> > > Since bk no longer works for me, I have no idea how to access any
> > > history prior to about 2.6.12-rc2.  Ugh.
> > 
> > There's still bkbits.net:
> > 
> > http://linux.bkbits.net:8080/linux-2.6/...
> 
> Ok - that helps.  Thanks.
> 
> There is also an hg (mercurial) web based Linux history at:
> 
>   http://www.kernel.org/hg/linux-2.6/
> 
> I still don't see something I can download into a local
> hg or git repository -- if a lurker knows how that is done,
> I'd be glad to know.
> 

I think there are ways of getting the entire kernel history in git too.

I usually just grep my patches directory, actually.  <looks>.  <egad>.
27,000 of them.

> 
> > Seems silly to use cpu_online_map to test for `1'?
> 
> Yeah - agreed.  The include/linux/cpumask.h stuff hardcodes
> the UP (NR_CPUS==1) code to plain old 0's and 1's.  This
> macro should do so as well.
> 
> I just sent a patch.
> 

Sweet, thanks.  Perhaps we can remove cpu_online_map from UP builds soon -
it's really wrong to have it there.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27  3:50 ` Paul Jackson
  2005-10-27  4:08   ` Andrew Morton
@ 2005-10-27 10:48   ` Diego Calleja
  2005-10-27 14:06     ` Paul Jackson
  1 sibling, 1 reply; 12+ messages in thread
From: Diego Calleja @ 2005-10-27 10:48 UTC (permalink / raw)
  To: Paul Jackson; +Cc: akpm, rajesh.shah, mingo, linux-kernel

El Wed, 26 Oct 2005 20:50:38 -0700,
Paul Jackson <pj@sgi.com> escribió:

> It looks like Linus started the git history at 2.6.12-rc2.
> 
>   Could someone clue me in on how to find Linux history BG (before-git)?
> 
> Since bk no longer works for me, I have no idea how to access any
> history prior to about 2.6.12-rc2.  Ugh.

Linus put the old BK history (2.5.0 - 2.6.12-rc2) in:
http://kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27  9:35       ` Andrew Morton
@ 2005-10-27 13:38         ` Paul Jackson
  2005-10-27 18:26           ` Andrew Morton
  2005-10-27 13:49         ` Paul Jackson
  1 sibling, 1 reply; 12+ messages in thread
From: Paul Jackson @ 2005-10-27 13:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: rajesh.shah, mingo, linux-kernel

Andrew wrote:
> Sweet, thanks.  Perhaps we can remove cpu_online_map from UP builds soon -
> it's really wrong to have it there.

Eh ... my gut reaction is different.   Even uni-processors have
online cpus - just not very many of them (and hot unplugging one
of them is frowned on).  Why make special cases when it serves no
purpose?

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27  9:35       ` Andrew Morton
  2005-10-27 13:38         ` Paul Jackson
@ 2005-10-27 13:49         ` Paul Jackson
  1 sibling, 0 replies; 12+ messages in thread
From: Paul Jackson @ 2005-10-27 13:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: rajesh.shah, mingo, linux-kernel

Andrew wrote:
> I think there are ways of getting the entire kernel history in git too.

If I knew where a history was, perhaps I could put it into git (or the
one I prefer - hg).

The only 3 histories I can find are:
 1) web based bk
 2) web based hg
 3) locked forever inside my dead bk repositories


> I usually just grep my patches directory, actually.  <looks>.  <egad>.
> 27,000 of them.

Well - I've got my email archives from the mm-commits email list,
but that only goes back to July of 2005 .. a mere 4547 of them.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27 10:48   ` Diego Calleja
@ 2005-10-27 14:06     ` Paul Jackson
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Jackson @ 2005-10-27 14:06 UTC (permalink / raw)
  To: Diego Calleja; +Cc: akpm, rajesh.shah, mingo, linux-kernel

Diego wrote:
> Linus put the old BK history (2.5.0 - 2.6.12-rc2) in:
> http://kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git

Lurkers to the rescue.  Thank-you.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27 13:38         ` Paul Jackson
@ 2005-10-27 18:26           ` Andrew Morton
  2005-10-27 19:08             ` Paul Jackson
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2005-10-27 18:26 UTC (permalink / raw)
  To: Paul Jackson; +Cc: rajesh.shah, mingo, linux-kernel

Paul Jackson <pj@sgi.com> wrote:
>
> Andrew wrote:
> > Sweet, thanks.  Perhaps we can remove cpu_online_map from UP builds soon -
> > it's really wrong to have it there.
> 
> Eh ... my gut reaction is different.   Even uni-processors have
> online cpus - just not very many of them (and hot unplugging one
> of them is frowned on).

That's daft.  A uniprocessor machine has one and only one CPU and it's
always online!   An online_map is only needed for MP.

Now conceptually, yes, we should be able to query and perhaps set the
onlineness of a CPU.  But that doesn't mean that we should have storage
which idiotically remembers something which was known at compile time.

>  Why make special cases when it serves no purpose?

Ths presence of cpu_online_map in UP builds _is_ a special case.  The
kernel's overall approach to such things is to optimise them away at
compile time for !SMP builds.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-27 18:26           ` Andrew Morton
@ 2005-10-27 19:08             ` Paul Jackson
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Jackson @ 2005-10-27 19:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: rajesh.shah, mingo, linux-kernel

> That's daft.

 <grin>

Ok - guess I'll let someone else handle the patches for that
change then.  Looks like I am not not singing in key on this
one.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.650.933.1373, 1.925.600.0401

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 1/1] export cpu_online_map
  2005-10-26  4:20 [patch 1/1] export cpu_online_map akpm
  2005-10-27  3:50 ` Paul Jackson
@ 2005-10-28  2:49 ` Herbert Xu
  1 sibling, 0 replies; 12+ messages in thread
From: Herbert Xu @ 2005-10-28  2:49 UTC (permalink / raw)
  To: akpm; +Cc: rajesh.shah, mingo, pj, linux-kernel

akpm@osdl.org wrote:
> 
> - Why isn't set_cpus_allowed() just a no-op on UP?  Or some trivial thing
>  which tests for cpu #0?

It's still needed to weed out bogus masks that have CPU 0 turned off.

You're right that it doesn't need to check cpu_online_map though.
Here is a patch to make it check for CPU 0 instead.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/include/linux/sched.h b/include/linux/sched.h
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -895,7 +895,7 @@ extern int set_cpus_allowed(task_t *p, c
 #else
 static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask)
 {
-	if (!cpus_intersects(new_mask, cpu_online_map))
+	if (!cpu_isset(0, new_mask))
 		return -EINVAL;
 	return 0;
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-10-28  2:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-26  4:20 [patch 1/1] export cpu_online_map akpm
2005-10-27  3:50 ` Paul Jackson
2005-10-27  4:08   ` Andrew Morton
2005-10-27  8:55     ` Paul Jackson
2005-10-27  9:35       ` Andrew Morton
2005-10-27 13:38         ` Paul Jackson
2005-10-27 18:26           ` Andrew Morton
2005-10-27 19:08             ` Paul Jackson
2005-10-27 13:49         ` Paul Jackson
2005-10-27 10:48   ` Diego Calleja
2005-10-27 14:06     ` Paul Jackson
2005-10-28  2:49 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome