License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 14:07:57 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2008-10-23 05:26:29 +00:00
|
|
|
#ifndef _ASM_X86_SMP_H
|
|
|
|
#define _ASM_X86_SMP_H
|
2008-03-03 17:12:29 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
2008-03-03 17:12:31 +00:00
|
|
|
#include <linux/cpumask.h>
|
2008-03-19 17:25:18 +00:00
|
|
|
#include <asm/percpu.h>
|
2008-03-03 17:12:31 +00:00
|
|
|
|
2008-03-27 17:06:00 +00:00
|
|
|
/*
|
|
|
|
* We need the APIC definitions automatically as part of 'smp.h'
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_X86_LOCAL_APIC
|
|
|
|
# include <asm/mpspec.h>
|
|
|
|
# include <asm/apic.h>
|
|
|
|
# ifdef CONFIG_X86_IO_APIC
|
|
|
|
# include <asm/io_apic.h>
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#include <asm/thread_info.h>
|
2009-01-10 06:50:24 +00:00
|
|
|
#include <asm/cpumask.h>
|
2008-03-27 17:06:00 +00:00
|
|
|
|
2008-03-03 17:12:31 +00:00
|
|
|
extern int smp_num_siblings;
|
|
|
|
extern unsigned int num_processors;
|
2008-03-03 17:12:29 +00:00
|
|
|
|
x86: Add read_mostly declaration/definition to variables from smp.h
Add "read-mostly" qualifier to the following variables in
smp.h:
- cpu_sibling_map
- cpu_core_map
- cpu_llc_shared_map
- cpu_llc_id
- cpu_number
- x86_cpu_to_apicid
- x86_bios_cpu_apicid
- x86_cpu_to_logical_apicid
As long as all the variables above are only written during the
initialization, this change is meant to prevent the false
sharing. More specifically, on vSMP Foundation platform
x86_cpu_to_apicid shared the same internode_cache_line with
frequently written lapic_events.
From the analysis of the first 33 per_cpu variables out of 219
(memories they describe, to be more specific) the 8 have read_mostly
nature (tlb_vector_offset, cpu_loops_per_jiffy, xen_debug_irq, etc.)
and 25 are frequently written (irq_stack_union, gdt_page,
exception_stacks, idt_desc, etc.).
Assuming that the spread of the rest of the per_cpu variables is
similar, identifying the read mostly memories will make more sense
in terms of long-term code maintenance comparing to identifying
frequently written memories.
Signed-off-by: Vlad Zolotarov <vlad@scalemp.com>
Acked-by: Shai Fultheim <shai@scalemp.com>
Cc: Shai Fultheim (Shai@ScaleMP.com) <Shai@scalemp.com>
Cc: ido@wizery.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1719258.EYKzE4Zbq5@vlad
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-06-11 09:56:52 +00:00
|
|
|
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
|
|
|
|
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_map);
|
2011-01-21 23:29:44 +00:00
|
|
|
/* cpus sharing the last level cache: */
|
x86: Add read_mostly declaration/definition to variables from smp.h
Add "read-mostly" qualifier to the following variables in
smp.h:
- cpu_sibling_map
- cpu_core_map
- cpu_llc_shared_map
- cpu_llc_id
- cpu_number
- x86_cpu_to_apicid
- x86_bios_cpu_apicid
- x86_cpu_to_logical_apicid
As long as all the variables above are only written during the
initialization, this change is meant to prevent the false
sharing. More specifically, on vSMP Foundation platform
x86_cpu_to_apicid shared the same internode_cache_line with
frequently written lapic_events.
From the analysis of the first 33 per_cpu variables out of 219
(memories they describe, to be more specific) the 8 have read_mostly
nature (tlb_vector_offset, cpu_loops_per_jiffy, xen_debug_irq, etc.)
and 25 are frequently written (irq_stack_union, gdt_page,
exception_stacks, idt_desc, etc.).
Assuming that the spread of the rest of the per_cpu variables is
similar, identifying the read mostly memories will make more sense
in terms of long-term code maintenance comparing to identifying
frequently written memories.
Signed-off-by: Vlad Zolotarov <vlad@scalemp.com>
Acked-by: Shai Fultheim <shai@scalemp.com>
Cc: Shai Fultheim (Shai@ScaleMP.com) <Shai@scalemp.com>
Cc: ido@wizery.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1719258.EYKzE4Zbq5@vlad
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-06-11 09:56:52 +00:00
|
|
|
DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map);
|
|
|
|
DECLARE_PER_CPU_READ_MOSTLY(u16, cpu_llc_id);
|
|
|
|
DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number);
|
x86: cleanup early per cpu variables/accesses v4
* Introduce a new PER_CPU macro called "EARLY_PER_CPU". This is
used by some per_cpu variables that are initialized and accessed
before there are per_cpu areas allocated.
["Early" in respect to per_cpu variables is "earlier than the per_cpu
areas have been setup".]
This patchset adds these new macros:
DEFINE_EARLY_PER_CPU(_type, _name, _initvalue)
EXPORT_EARLY_PER_CPU_SYMBOL(_name)
DECLARE_EARLY_PER_CPU(_type, _name)
early_per_cpu_ptr(_name)
early_per_cpu_map(_name, _idx)
early_per_cpu(_name, _cpu)
The DEFINE macro defines the per_cpu variable as well as the early
map and pointer. It also initializes the per_cpu variable and map
elements to "_initvalue". The early_* macros provide access to
the initial map (usually setup during system init) and the early
pointer. This pointer is initialized to point to the early map
but is then NULL'ed when the actual per_cpu areas are setup. After
that the per_cpu variable is the correct access to the variable.
The early_per_cpu() macro is not very efficient but does show how to
access the variable if you have a function that can be called both
"early" and "late". It tests the early ptr to be NULL, and if not
then it's still valid. Otherwise, the per_cpu variable is used
instead:
#define early_per_cpu(_name, _cpu) \
(early_per_cpu_ptr(_name) ? \
early_per_cpu_ptr(_name)[_cpu] : \
per_cpu(_name, _cpu))
A better method is to actually check the pointer manually. In the
case below, numa_set_node can be called both "early" and "late":
void __cpuinit numa_set_node(int cpu, int node)
{
int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map);
if (cpu_to_node_map)
cpu_to_node_map[cpu] = node;
else
per_cpu(x86_cpu_to_node_map, cpu) = node;
}
* Add a flag "arch_provides_topology_pointers" that indicates pointers
to topology cpumask_t maps are available. Otherwise, use the function
returning the cpumask_t value. This is useful if cpumask_t set size
is very large to avoid copying data on to/off of the stack.
* The coverage of CONFIG_DEBUG_PER_CPU_MAPS has been increased while
the non-debug case has been optimized a bit.
* Remove an unreferenced compiler warning in drivers/base/topology.c
* Clean up #ifdef in setup.c
For inclusion into sched-devel/latest tree.
Based on:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+ sched-devel/latest .../mingo/linux-2.6-sched-devel.git
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-12 19:21:12 +00:00
|
|
|
|
2011-01-21 23:29:44 +00:00
|
|
|
static inline struct cpumask *cpu_llc_shared_mask(int cpu)
|
|
|
|
{
|
|
|
|
return per_cpu(cpu_llc_shared_map, cpu);
|
|
|
|
}
|
|
|
|
|
x86: Add read_mostly declaration/definition to variables from smp.h
Add "read-mostly" qualifier to the following variables in
smp.h:
- cpu_sibling_map
- cpu_core_map
- cpu_llc_shared_map
- cpu_llc_id
- cpu_number
- x86_cpu_to_apicid
- x86_bios_cpu_apicid
- x86_cpu_to_logical_apicid
As long as all the variables above are only written during the
initialization, this change is meant to prevent the false
sharing. More specifically, on vSMP Foundation platform
x86_cpu_to_apicid shared the same internode_cache_line with
frequently written lapic_events.
From the analysis of the first 33 per_cpu variables out of 219
(memories they describe, to be more specific) the 8 have read_mostly
nature (tlb_vector_offset, cpu_loops_per_jiffy, xen_debug_irq, etc.)
and 25 are frequently written (irq_stack_union, gdt_page,
exception_stacks, idt_desc, etc.).
Assuming that the spread of the rest of the per_cpu variables is
similar, identifying the read mostly memories will make more sense
in terms of long-term code maintenance comparing to identifying
frequently written memories.
Signed-off-by: Vlad Zolotarov <vlad@scalemp.com>
Acked-by: Shai Fultheim <shai@scalemp.com>
Cc: Shai Fultheim (Shai@ScaleMP.com) <Shai@scalemp.com>
Cc: ido@wizery.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1719258.EYKzE4Zbq5@vlad
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-06-11 09:56:52 +00:00
|
|
|
DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid);
|
2016-06-30 15:56:36 +00:00
|
|
|
DECLARE_EARLY_PER_CPU_READ_MOSTLY(u32, x86_cpu_to_acpiid);
|
x86: Add read_mostly declaration/definition to variables from smp.h
Add "read-mostly" qualifier to the following variables in
smp.h:
- cpu_sibling_map
- cpu_core_map
- cpu_llc_shared_map
- cpu_llc_id
- cpu_number
- x86_cpu_to_apicid
- x86_bios_cpu_apicid
- x86_cpu_to_logical_apicid
As long as all the variables above are only written during the
initialization, this change is meant to prevent the false
sharing. More specifically, on vSMP Foundation platform
x86_cpu_to_apicid shared the same internode_cache_line with
frequently written lapic_events.
From the analysis of the first 33 per_cpu variables out of 219
(memories they describe, to be more specific) the 8 have read_mostly
nature (tlb_vector_offset, cpu_loops_per_jiffy, xen_debug_irq, etc.)
and 25 are frequently written (irq_stack_union, gdt_page,
exception_stacks, idt_desc, etc.).
Assuming that the spread of the rest of the per_cpu variables is
similar, identifying the read mostly memories will make more sense
in terms of long-term code maintenance comparing to identifying
frequently written memories.
Signed-off-by: Vlad Zolotarov <vlad@scalemp.com>
Acked-by: Shai Fultheim <shai@scalemp.com>
Cc: Shai Fultheim (Shai@ScaleMP.com) <Shai@scalemp.com>
Cc: ido@wizery.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1719258.EYKzE4Zbq5@vlad
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-06-11 09:56:52 +00:00
|
|
|
DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_bios_cpu_apicid);
|
2011-01-28 16:22:48 +00:00
|
|
|
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32)
|
x86: Add read_mostly declaration/definition to variables from smp.h
Add "read-mostly" qualifier to the following variables in
smp.h:
- cpu_sibling_map
- cpu_core_map
- cpu_llc_shared_map
- cpu_llc_id
- cpu_number
- x86_cpu_to_apicid
- x86_bios_cpu_apicid
- x86_cpu_to_logical_apicid
As long as all the variables above are only written during the
initialization, this change is meant to prevent the false
sharing. More specifically, on vSMP Foundation platform
x86_cpu_to_apicid shared the same internode_cache_line with
frequently written lapic_events.
From the analysis of the first 33 per_cpu variables out of 219
(memories they describe, to be more specific) the 8 have read_mostly
nature (tlb_vector_offset, cpu_loops_per_jiffy, xen_debug_irq, etc.)
and 25 are frequently written (irq_stack_union, gdt_page,
exception_stacks, idt_desc, etc.).
Assuming that the spread of the rest of the per_cpu variables is
similar, identifying the read mostly memories will make more sense
in terms of long-term code maintenance comparing to identifying
frequently written memories.
Signed-off-by: Vlad Zolotarov <vlad@scalemp.com>
Acked-by: Shai Fultheim <shai@scalemp.com>
Cc: Shai Fultheim (Shai@ScaleMP.com) <Shai@scalemp.com>
Cc: ido@wizery.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1719258.EYKzE4Zbq5@vlad
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-06-11 09:56:52 +00:00
|
|
|
DECLARE_EARLY_PER_CPU_READ_MOSTLY(int, x86_cpu_to_logical_apicid);
|
2011-01-23 13:37:30 +00:00
|
|
|
#endif
|
2008-03-19 17:25:18 +00:00
|
|
|
|
2012-04-20 13:05:42 +00:00
|
|
|
struct task_struct;
|
|
|
|
|
2008-03-03 17:12:32 +00:00
|
|
|
struct smp_ops {
|
|
|
|
void (*smp_prepare_boot_cpu)(void);
|
|
|
|
void (*smp_prepare_cpus)(unsigned max_cpus);
|
|
|
|
void (*smp_cpus_done)(unsigned max_cpus);
|
|
|
|
|
2010-10-11 21:37:08 +00:00
|
|
|
void (*stop_other_cpus)(int wait);
|
2016-10-11 20:54:23 +00:00
|
|
|
void (*crash_stop_other_cpus)(void);
|
2008-03-03 17:12:32 +00:00
|
|
|
void (*smp_send_reschedule)(int cpu);
|
2008-06-26 09:21:54 +00:00
|
|
|
|
2012-04-20 13:05:47 +00:00
|
|
|
int (*cpu_up)(unsigned cpu, struct task_struct *tidle);
|
2008-08-22 10:52:11 +00:00
|
|
|
int (*cpu_disable)(void);
|
|
|
|
void (*cpu_die)(unsigned int cpu);
|
|
|
|
void (*play_dead)(void);
|
|
|
|
|
2008-12-17 01:33:59 +00:00
|
|
|
void (*send_call_func_ipi)(const struct cpumask *mask);
|
2008-06-26 09:21:54 +00:00
|
|
|
void (*send_call_func_single_ipi)(int cpu);
|
2008-03-03 17:12:32 +00:00
|
|
|
};
|
|
|
|
|
2008-03-03 17:12:59 +00:00
|
|
|
/* Globals due to paravirt */
|
|
|
|
extern void set_cpu_sibling_map(int cpu);
|
|
|
|
|
2008-03-03 17:12:33 +00:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
extern struct smp_ops smp_ops;
|
2008-03-03 17:12:34 +00:00
|
|
|
|
2008-03-03 17:12:51 +00:00
|
|
|
static inline void smp_send_stop(void)
|
|
|
|
{
|
2010-10-11 21:37:08 +00:00
|
|
|
smp_ops.stop_other_cpus(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void stop_other_cpus(void)
|
|
|
|
{
|
|
|
|
smp_ops.stop_other_cpus(1);
|
2008-03-03 17:12:51 +00:00
|
|
|
}
|
|
|
|
|
2008-03-03 17:12:37 +00:00
|
|
|
static inline void smp_prepare_boot_cpu(void)
|
|
|
|
{
|
|
|
|
smp_ops.smp_prepare_boot_cpu();
|
|
|
|
}
|
|
|
|
|
2008-03-03 17:12:38 +00:00
|
|
|
static inline void smp_prepare_cpus(unsigned int max_cpus)
|
|
|
|
{
|
|
|
|
smp_ops.smp_prepare_cpus(max_cpus);
|
|
|
|
}
|
|
|
|
|
2008-03-03 17:12:39 +00:00
|
|
|
static inline void smp_cpus_done(unsigned int max_cpus)
|
|
|
|
{
|
|
|
|
smp_ops.smp_cpus_done(max_cpus);
|
|
|
|
}
|
|
|
|
|
2012-04-20 13:05:42 +00:00
|
|
|
static inline int __cpu_up(unsigned int cpu, struct task_struct *tidle)
|
2008-03-03 17:12:36 +00:00
|
|
|
{
|
2012-04-20 13:05:47 +00:00
|
|
|
return smp_ops.cpu_up(cpu, tidle);
|
2008-03-03 17:12:36 +00:00
|
|
|
}
|
|
|
|
|
2008-08-22 10:52:11 +00:00
|
|
|
static inline int __cpu_disable(void)
|
|
|
|
{
|
|
|
|
return smp_ops.cpu_disable();
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void __cpu_die(unsigned int cpu)
|
|
|
|
{
|
|
|
|
smp_ops.cpu_die(cpu);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void play_dead(void)
|
|
|
|
{
|
|
|
|
smp_ops.play_dead();
|
|
|
|
}
|
|
|
|
|
2008-03-03 17:12:34 +00:00
|
|
|
static inline void smp_send_reschedule(int cpu)
|
|
|
|
{
|
|
|
|
smp_ops.smp_send_reschedule(cpu);
|
|
|
|
}
|
2008-03-03 17:12:35 +00:00
|
|
|
|
2008-06-26 09:21:54 +00:00
|
|
|
static inline void arch_send_call_function_single_ipi(int cpu)
|
|
|
|
{
|
|
|
|
smp_ops.send_call_func_single_ipi(cpu);
|
|
|
|
}
|
|
|
|
|
2009-03-13 04:19:51 +00:00
|
|
|
static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
|
2008-03-03 17:12:35 +00:00
|
|
|
{
|
2009-03-13 04:19:51 +00:00
|
|
|
smp_ops.send_call_func_ipi(mask);
|
2008-03-03 17:12:35 +00:00
|
|
|
}
|
2008-03-03 17:12:36 +00:00
|
|
|
|
2008-08-22 10:52:14 +00:00
|
|
|
void cpu_disable_common(void);
|
2008-03-03 17:12:37 +00:00
|
|
|
void native_smp_prepare_boot_cpu(void);
|
2008-03-03 17:12:38 +00:00
|
|
|
void native_smp_prepare_cpus(unsigned int max_cpus);
|
2018-02-07 23:49:23 +00:00
|
|
|
void calculate_max_logical_packages(void);
|
2008-03-03 17:12:39 +00:00
|
|
|
void native_smp_cpus_done(unsigned int max_cpus);
|
2015-04-01 14:12:14 +00:00
|
|
|
void common_cpu_up(unsigned int cpunum, struct task_struct *tidle);
|
2012-04-20 13:05:47 +00:00
|
|
|
int native_cpu_up(unsigned int cpunum, struct task_struct *tidle);
|
2008-08-22 10:52:11 +00:00
|
|
|
int native_cpu_disable(void);
|
2015-02-25 19:42:15 +00:00
|
|
|
int common_cpu_die(unsigned int cpu);
|
2008-08-22 10:52:11 +00:00
|
|
|
void native_cpu_die(unsigned int cpu);
|
x86 / hibernate: Use hlt_play_dead() when resuming from hibernation
On Intel hardware, native_play_dead() uses mwait_play_dead() by
default and only falls back to the other methods if that fails.
That also happens during resume from hibernation, when the restore
(boot) kernel runs disable_nonboot_cpus() to take all of the CPUs
except for the boot one offline.
However, that is problematic, because the address passed to
__monitor() in mwait_play_dead() is likely to be written to in the
last phase of hibernate image restoration and that causes the "dead"
CPU to start executing instructions again. Unfortunately, the page
containing the address in that CPU's instruction pointer may not be
valid any more at that point.
First, that page may have been overwritten with image kernel memory
contents already, so the instructions the CPU attempts to execute may
simply be invalid. Second, the page tables previously used by that
CPU may have been overwritten by image kernel memory contents, so the
address in its instruction pointer is impossible to resolve then.
A report from Varun Koyyalagunta and investigation carried out by
Chen Yu show that the latter sometimes happens in practice.
To prevent it from happening, temporarily change the smp_ops.play_dead
pointer during resume from hibernation so that it points to a special
"play dead" routine which uses hlt_play_dead() and avoids the
inadvertent "revivals" of "dead" CPUs this way.
A slightly unpleasant consequence of this change is that if the
system is hibernated with one or more CPUs offline, it will generally
draw more power after resume than it did before hibernation, because
the physical state entered by CPUs via hlt_play_dead() is higher-power
than the mwait_play_dead() one in the majority of cases. It is
possible to work around this, but it is unclear how much of a problem
that's going to be in practice, so the workaround will be implemented
later if it turns out to be necessary.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=106371
Reported-by: Varun Koyyalagunta <cpudebug@centtech.com>
Original-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 01:55:23 +00:00
|
|
|
void hlt_play_dead(void);
|
2008-08-22 10:52:11 +00:00
|
|
|
void native_play_dead(void);
|
2008-08-22 10:52:13 +00:00
|
|
|
void play_dead_common(void);
|
2010-01-22 15:01:03 +00:00
|
|
|
void wbinvd_on_cpu(int cpu);
|
|
|
|
int wbinvd_on_all_cpus(void);
|
2008-08-22 10:52:11 +00:00
|
|
|
|
2008-12-17 01:33:59 +00:00
|
|
|
void native_send_call_func_ipi(const struct cpumask *mask);
|
2008-06-26 09:21:54 +00:00
|
|
|
void native_send_call_func_single_ipi(int cpu);
|
2012-04-20 13:05:48 +00:00
|
|
|
void x86_idle_thread_init(unsigned int cpu, struct task_struct *idle);
|
2008-03-03 17:12:40 +00:00
|
|
|
|
2012-11-13 19:32:41 +00:00
|
|
|
void smp_store_boot_cpu_info(void);
|
2008-03-19 17:25:05 +00:00
|
|
|
void smp_store_cpu_info(int id);
|
2008-03-19 17:25:58 +00:00
|
|
|
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
|
2016-06-30 15:56:36 +00:00
|
|
|
#define cpu_acpi_id(cpu) per_cpu(x86_cpu_to_acpiid, cpu)
|
2008-03-27 17:06:02 +00:00
|
|
|
|
2017-04-09 10:46:45 +00:00
|
|
|
/*
|
|
|
|
* This function is needed by all SMP systems. It must _always_ be valid
|
|
|
|
* from the initial startup. We map APIC_BASE very early in page_setup(),
|
|
|
|
* so this is correct in the x86 case.
|
|
|
|
*/
|
|
|
|
#define raw_smp_processor_id() (this_cpu_read(cpu_number))
|
|
|
|
|
|
|
|
#ifdef CONFIG_X86_32
|
|
|
|
extern int safe_smp_processor_id(void);
|
|
|
|
#else
|
|
|
|
# define safe_smp_processor_id() smp_processor_id()
|
|
|
|
#endif
|
|
|
|
|
2010-01-22 15:01:03 +00:00
|
|
|
#else /* !CONFIG_SMP */
|
|
|
|
#define wbinvd_on_cpu(cpu) wbinvd()
|
|
|
|
static inline int wbinvd_on_all_cpus(void)
|
|
|
|
{
|
|
|
|
wbinvd();
|
|
|
|
return 0;
|
|
|
|
}
|
2016-03-25 14:52:34 +00:00
|
|
|
#define smp_num_siblings 1
|
2008-09-29 22:29:42 +00:00
|
|
|
#endif /* CONFIG_SMP */
|
2008-03-27 17:06:02 +00:00
|
|
|
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-18 22:23:59 +00:00
|
|
|
extern unsigned disabled_cpus;
|
2008-04-04 19:41:44 +00:00
|
|
|
|
2008-03-27 17:05:58 +00:00
|
|
|
#ifdef CONFIG_X86_LOCAL_APIC
|
|
|
|
extern int hard_smp_processor_id(void);
|
|
|
|
|
|
|
|
#else /* CONFIG_X86_LOCAL_APIC */
|
2017-04-09 10:46:46 +00:00
|
|
|
#define hard_smp_processor_id() 0
|
2008-03-27 17:05:58 +00:00
|
|
|
#endif /* CONFIG_X86_LOCAL_APIC */
|
|
|
|
|
2011-10-13 19:14:26 +00:00
|
|
|
#ifdef CONFIG_DEBUG_NMI_SELFTEST
|
|
|
|
extern void nmi_selftest(void);
|
|
|
|
#else
|
|
|
|
#define nmi_selftest() do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
2008-03-03 17:12:29 +00:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2008-10-23 05:26:29 +00:00
|
|
|
#endif /* _ASM_X86_SMP_H */
|