public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Vegard Nossum <vegard.nossum@gmail.com>
Subject: Re: [PATCH] cputopology: Always define CPU topology information [4th try]
Date: Wed, 4 Jun 2008 21:47:15 -0700	[thread overview]
Message-ID: <20080604214715.bbebe325.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080604154454.GD11300@solarflare.com>

On Wed, 4 Jun 2008 16:44:56 +0100 Ben Hutchings <bhutchings@solarflare.com> wrote:

> Not all architectures and configurations define CPU topology information.
> This can result in an empty topology directory in sysfs, and requires
> in-kernel users to protect all uses with #ifdef - see
> <http://marc.info/?l=linux-netdev&m=120639033904472&w=2>.
> 
> The documentation of CPU topology specifies what the defaults should be
> if only partial information is available from the hardware.  So we can
> provide these defaults as a fallback.
> 
> This patch:
> 
> - Adds default definitions of the 4 topology macros to <linux/topology.h>
> - Changes drivers/base/topology.c to use the topology macros unconditionally
>   and to cope with definitions that aren't lvalues
> - Updates documentation accordingly

See, this is what I meant.  After your patch we have:

#ifdef arch_provides_topology_pointers
#define define_siblings_show_map(name)					\
static ssize_t show_##name(struct sys_device *dev, char *buf)	\
{									\
	unsigned int cpu = dev->id;					\
	cpumask_t siblings = topology_##name(cpu);			\
	return show_cpumap(0, &siblings, buf);				\
}

#define define_siblings_show_list(name)					\
static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \
{									\
	unsigned int cpu = dev->id;					\
	cpumask_t siblings = topology_##name(cpu);			\
	return show_cpumap(1, &siblings, buf);				\
}

#else
#define define_siblings_show_map(name)					\
static ssize_t show_##name(struct sys_device *dev, char *buf)	\
{									\
	unsigned int cpu = dev->id;					\
	cpumask_t mask = topology_##name(cpu);				\
	return show_cpumap(0, &mask, buf);				\
}

#define define_siblings_show_list(name)					\
static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \
{									\
	unsigned int cpu = dev->id;					\
	cpumask_t mask = topology_##name(cpu);				\
	return show_cpumap(1, &mask, buf);				\
}
#endif

they're the same!

  reply	other threads:[~2008-06-05  4:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 15:44 [PATCH] cputopology: Always define CPU topology information [4th try] Ben Hutchings
2008-06-05  4:47 ` Andrew Morton [this message]
2008-06-05 12:08   ` Ben Hutchings
2008-06-05 16:28     ` Andrew Morton
2008-06-05 16:37       ` [PATCH] cputopology: Always define CPU topology information [5th try] Ben Hutchings
2008-06-13  5:16         ` Ingo Molnar
2008-06-13 10:15           ` Ben Hutchings
2008-06-13 11:02             ` Ingo Molnar
2008-06-13 15:36               ` Ben Hutchings
2008-07-16 21:37 ` [PATCH] cputopology: Always define CPU topology information [4th try] Nathan Lynch
2008-07-16 22:49   ` Ben Hutchings

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=20080604214715.bbebe325.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bhutchings@solarflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=vegard.nossum@gmail.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