https://github.com/torvalds/linux
Revision 3d4248885b9fca818e7fe6b66328e714876d36ad authored by Linus Torvalds on 07 November 2006, 22:55:40 UTC, committed by Linus Torvalds on 07 November 2006, 22:55:40 UTC
* master.kernel.org:/home/rmk/linux-2.6-arm:
  [ARM] 3927/1: Allow show_mem() to work with holes in memory map.
  [ARM] 3926/1: make timer led handle HZ != 100
  [ARM] 3923/1: S3C24XX: update s3c2410_defconfig with new drivers
  [ARM] 3922/1: S3C24XX: update s3c2410_defconfig to 2.6.19-rc4
  [ARM] 3921/1: S3C24XX: remove bast_defconfig
  [ARM] 3920/1: S3C24XX: Remove smdk2410_defconfig
  [ARM] 3919/1: Fixed definition of some PXA270 CIF related registers
  [ARM] 3918/1: ixp4xx irq-chip rework
  [ARM] 3912/1: Make PXA270 advertise HWCAP_IWMMXT capability
  [ARM] 3915/1: S3C2412: Add s3c2410_gpio_getirq() to general gpio.c
  [ARM] 3917/1: Fix dmabounce symbol exports
2 parent s edd106f + 5e70982
Raw File
Tip revision: 3d4248885b9fca818e7fe6b66328e714876d36ad authored by Linus Torvalds on 07 November 2006, 22:55:40 UTC
Merge master.kernel.org:/home/rmk/linux-2.6-arm
Tip revision: 3d42488
smp_processor_id.c
/*
 * lib/smp_processor_id.c
 *
 * DEBUG_PREEMPT variant of smp_processor_id().
 */
#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/sched.h>

unsigned int debug_smp_processor_id(void)
{
	unsigned long preempt_count = preempt_count();
	int this_cpu = raw_smp_processor_id();
	cpumask_t this_mask;

	if (likely(preempt_count))
		goto out;

	if (irqs_disabled())
		goto out;

	/*
	 * Kernel threads bound to a single CPU can safely use
	 * smp_processor_id():
	 */
	this_mask = cpumask_of_cpu(this_cpu);

	if (cpus_equal(current->cpus_allowed, this_mask))
		goto out;

	/*
	 * It is valid to assume CPU-locality during early bootup:
	 */
	if (system_state != SYSTEM_RUNNING)
		goto out;

	/*
	 * Avoid recursion:
	 */
	preempt_disable();

	if (!printk_ratelimit())
		goto out_enable;

	printk(KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n", preempt_count(), current->comm, current->pid);
	print_symbol("caller is %s\n", (long)__builtin_return_address(0));
	dump_stack();

out_enable:
	preempt_enable_no_resched();
out:
	return this_cpu;
}

EXPORT_SYMBOL(debug_smp_processor_id);

back to top