Vikas Shivappa
de016df88f
x86/intel_rdt: Update schemata read to show data in tabular format
...
The schemata file displays data from different resources on all
domains. Its cumbersome to read since they are not tabular and data/names
could be of different widths. Make the schemata file to display data in a
tabular format thereby making it nice and simple to read.
Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com >
Cc: ravi.v.shankar@intel.com
Cc: tony.luck@intel.com
Cc: fenghua.yu@intel.com
Cc: peterz@infradead.org
Cc: vikas.shivappa@intel.com
Cc: h.peter.anvin@intel.com
Link: http://lkml.kernel.org/r/1491255857-17213-4-git-send-email-vikas.shivappa@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-04-05 17:22:31 +02:00
Tony Luck
c4026b7b95
x86/intel_rdt: Implement "update" mode when writing schemata file
...
The schemata file can have multiple lines and it is cumbersome to update
all lines.
Remove code that requires that the user provides values for every resource
(in the right order). If the user provides values for just a few
resources, update them and leave the rest unchanged.
Side benefit: we now check which values were updated and only send IPIs to
cpus that actually have updates.
Signed-off-by: Tony Luck <tony.luck@intel.com >
Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com >
Tested-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com >
Cc: ravi.v.shankar@intel.com
Cc: fenghua.yu@intel.com
Cc: peterz@infradead.org
Cc: vikas.shivappa@intel.com
Cc: h.peter.anvin@intel.com
Link: http://lkml.kernel.org/r/1491255857-17213-3-git-send-email-vikas.shivappa@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-04-05 17:22:31 +02:00
Bhupesh Sharma
6e7300cff1
efi/bgrt: Enable ACPI BGRT handling on arm64
...
Now that the ACPI BGRT handling code has been made generic, we can
enable it for arm64.
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com >
[ Updated commit log to reflect that BGRT is only enabled for arm64, and added
missing 'return' statement to the dummy acpi_parse_bgrt() function. ]
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170404160245.27812-8-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-04-05 12:27:25 +02:00
Joerg Roedel
cfac6dfa42
x86/signals: Fix lower/upper bound reporting in compat siginfo
...
Put the right values from the original siginfo into the
userspace compat-siginfo.
This fixes the 32-bit MPX "tabletest" testcase on 64-bit kernels.
Signed-off-by: Joerg Roedel <jroedel@suse.de >
Acked-by: Dave Hansen <dave.hansen@linux.intel.com >
Cc: <stable@vger.kernel.org > # v4.8+
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Borislav Petkov <bp@suse.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: Dmitry Safonov <0x7f454c46@gmail.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Fixes: a4455082dc
('x86/signals: Add missing signal_compat code for x86 features')
Link: http://lkml.kernel.org/r/1491322501-5054-1-git-send-email-joro@8bytes.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-04-05 10:16:43 +02:00
Kirill A. Shutemov
1d33b21956
x86/espfix: Add support for 5-level paging
...
We don't need extra virtual address space for ESPFIX, so it stays within
one PUD page table for both 4- and 5-level paging.
Redefining ESPFIX_BASE_ADDR using P4D_SHIFT instead of PGDIR_SHIFT would
make it stay in the same place regarding of paging mode.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170330080731.65421-8-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-04-04 08:22:34 +02:00
Kirill A. Shutemov
335437fbf7
x86/paravirt: Add 5-level support to the paravirt code
...
Add operations to allocate/release p4ds.
Xen requires more work. We will need to come back to it.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170330080731.65421-5-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-04-04 08:22:34 +02:00
Linus Torvalds
3ccfcdc9ef
Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
...
Pull RAS fix from Thomas Gleixner:
"Prevent dmesg from being spammed when MCE logging is active"
* 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/mce: Don't print MCEs when mcelog is active
2017-04-03 08:36:24 -07:00
Ingo Molnar
7f75540ff2
Merge tag 'v4.11-rc5' into x86/mm, to refresh the branch
...
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-04-03 16:36:32 +02:00
Peter Zijlstra
b5effd3815
debug: Fix __bug_table[] in arch linker scripts
...
The kbuild test robot reported this build failure on a number
of architectures:
> make.cross ARCH=arm
> lib/lib.a(bug.o): In function `find_bug':
> >> lib/bug.c:135: undefined reference to `__start___bug_table'
> >> lib/bug.c:135: undefined reference to `__stop___bug_table'
Caused by:
19d436268d
("debug: Add _ONCE() logic to report_bug()")
Which moved the BUG_TABLE from RO_DATA_SECTION() to RW_DATA_SECTION(),
but a number of architectures don't use RW_DATA_SECTION(), so they
ended up with no __bug_table[] ...
Ideally all those would use RW_DATA_SECTION() in their linker scripts,
but that's for another day.
Signed-off-by: Peter Zijlstra <peterz@infradead.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: kbuild test robot <fengguang.wu@intel.com >
Cc: kbuild-all@01.org
Cc: tipbuild@zytor.com
Link: http://lkml.kernel.org/r/20170330154927.o6qmgfp4bdhrajbm@hirez.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-04-03 10:22:40 +02:00
Linus Torvalds
496dcc5091
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
...
Pull x86 fixes from Thomas Gleixner:
"This update provides:
- prevent KASLR from randomizing EFI regions
- restrict the usage of -maccumulate-outgoing-args and document when
and why it is required.
- make the Global Physical Address calculation for UV4 systems work
correctly.
- address a copy->paste->forgot-edit problem in the MCE exception
table entries.
- assign a name to AMD MCA bank 3, so the sysfs file registration
works.
- add a missing include in the boot code"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/boot: Include missing header file
x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs
x86/build: Mostly disable '-maccumulate-outgoing-args'
x86/mm/KASLR: Exclude EFI region from KASLR VA space randomization
x86/mce: Fix copy/paste error in exception table entries
x86/platform/uv: Fix calculation of Global Physical Address
2017-04-02 09:27:02 -07:00
Dmitry Safonov
ada26481df
x86/mm: Make in_compat_syscall() work during exec
...
The x86 mmap() code selects the mmap base for an allocation depending on
the bitness of the syscall. For 64bit sycalls it select mm->mmap_base and
for 32bit mm->mmap_compat_base.
On execve the registers of the task invoking exec() are copied to the child
pt_regs. So child->pt_regs->orig_ax contains the execve syscall number of the
parent.
exec() calls mmap() which in turn uses in_compat_syscall() to check whether
the mapping is for a 32bit or a 64bit task. The decision is made on the
following criteria:
ia32 child->thread.status & TS_COMPAT
x32 child->pt_regs.orig_ax & __X32_SYSCALL_BIT
ia64 !ia32 && !x32
child->thread.status is corretly set up in set_personality_*(), but the
syscall number in child->pt_regs.orig_ax is left unmodified.
Therefore the parent/child combinations work or fail in the following way:
Parent Child Child->thread_status child->pt_regs.orig_ax in_compat() Works
ia64 ia64 TS_COMPAT == 0 __X32_SYSCALL_BIT == 0 false Y
ia64 ia32 TS_COMPAT == 1 __X32_SYSCALL_BIT == 0 true Y
ia64 x32 TS_COMPAT == 0 __X32_SYSCALL_BIT == 0 false N
ia32 ia64 TS_COMPAT == 0 __X32_SYSCALL_BIT == 0 false Y
ia32 ia32 TS_COMPAT == 1 __X32_SYSCALL_BIT == 0 true Y
ia32 x32 TS_COMPAT == 0 __X32_SYSCALL_BIT == 0 false N
x32 ia64 TS_COMPAT == 0 __X32_SYSCALL_BIT == 1 true N
x32 ia32 TS_COMPAT == 1 __X32_SYSCALL_BIT == 1 true Y
x32 x32 TS_COMPAT == 0 __X32_SYSCALL_BIT == 1 true Y
Make set_personality_*() store the syscall number incl. __X32_SYSCALL_BIT
which corresponds to the newly started ELF executable in the childs
pt_regs, i.e. pretend that the exec was invoked from a task with the same
executable format.
So both thread.status and pt_regs.orig_ax correspond to the new ELF format
and in_compat_syscall() returns the correct result.
[ tglx: Rewrote changelog ]
Fixes: commit 1b028f784e
("x86/mm: Introduce mmap_compat_base() for 32-bit mmap()")
Reported-by: Adam Borowski <kilobyte@angband.pl >
Suggested-by: H. Peter Anvin <hpa@zytor.com >
Suggested-by: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: 0x7f454c46@gmail.com
Cc: linux-mm@kvack.org
Cc: Andrei Vagin <avagin@gmail.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Cyrill Gorcunov <gorcunov@openvz.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com >
Link: http://lkml.kernel.org/r/20170331111137.28170-1-dsafonov@virtuozzo.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-31 16:53:02 +02:00
Geliang Tang
352ef03ca0
x86/pci-calgary: Use setup_timer() instead of open coding it.
...
Use setup_timer() instead of init_timer() to simplify the code.
Signed-off-by: Geliang Tang <geliangtang@gmail.com >
Cc: iommu@lists.linux-foundation.org
Cc: Jon Mason <jdmason@kudzu.us >
Cc: Muli Ben-Yehuda <mulix@mulix.org >
Link: http://lkml.kernel.org/r/e4f1888b9e4a87f6a6345f86ed23071483763b22.1490340972.git.geliangtang@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-31 10:21:04 +02:00
Yazen Ghannam
29f72ce3e4
x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs
...
MCA bank 3 is reserved on systems pre-Fam17h, so it didn't have a name.
However, MCA bank 3 is defined on Fam17h systems and can be accessed
using legacy MSRs. Without a name we get a stack trace on Fam17h systems
when trying to register sysfs files for bank 3 on kernels that don't
recognize Scalable MCA.
Call MCA bank 3 "decode_unit" since this is what it represents on
Fam17h. This will allow kernels without SMCA support to see this bank on
Fam17h+ and prevent the stack trace. This will not affect older systems
since this bank is reserved on them, i.e. it'll be ignored.
Tested on AMD Fam15h and Fam17h systems.
WARNING: CPU: 26 PID: 1 at lib/kobject.c:210 kobject_add_internal
kobject: (ffff88085bb256c0): attempted to be registered with empty name!
...
Call Trace:
kobject_add_internal
kobject_add
kobject_create_and_add
threshold_create_device
threshold_init_device
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com >
Signed-off-by: Borislav Petkov <bp@suse.de >
Link: http://lkml.kernel.org/r/1490102285-3659-1-git-send-email-Yazen.Ghannam@amd.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-31 10:09:44 +02:00
Josh Poimboeuf
3f135e57a4
x86/build: Mostly disable '-maccumulate-outgoing-args'
...
The GCC '-maccumulate-outgoing-args' flag is enabled for most configs,
mostly because of issues which are no longer relevant. For most
configs, and with most recent versions of GCC, it's no longer needed.
Clarify which cases need it, and only enable it for those cases. Also
produce a compile-time error for the ftrace graph + mcount + '-Os' case,
which will otherwise cause runtime failures.
The main benefit of '-maccumulate-outgoing-args' is that it prevents an
ugly prologue for functions which have aligned stacks. But removing the
option also has some benefits: more readable argument saves, smaller
text size, and (presumably) slightly improved performance.
Here are the object size savings for 32-bit and 64-bit defconfig
kernels:
text data bss dec hex filename
10006710 3543328 1773568 15323606 e9d1d6 vmlinux.x86-32.before
9706358 3547424 1773568 15027350 e54c96 vmlinux.x86-32.after
text data bss dec hex filename
10652105 4537576 843776 16033457 f4a6b1 vmlinux.x86-64.before
10639629 4537576 843776 16020981 f475f5 vmlinux.x86-64.after
That comes out to a 3% text size improvement on x86-32 and a 0.1% text
size improvement on x86-64.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andrew Lutomirski <luto@kernel.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Pavel Machek <pavel@ucw.cz >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/20170316193133.zrj6gug53766m6nn@treble
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-30 11:53:04 +02:00
Ingo Molnar
73fa1362a7
Merge branch 'x86/cpu' into x86/mm, before applying dependent patch
...
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-30 09:07:54 +02:00
Steven Rostedt (VMware)
2b87965a1e
ftrace/x86: Do no run CPU sync when there is only one CPU online
...
Moving enabling of function tracing to early boot, even before scheduling is
enabled, means that it is not safe to enable interrupts. When function
tracing was enabled at boot up, it use to happen after scheduling and the
other CPUs were brought up. That required running a sync across all CPUs
when modifying the function hook locations in the code. To do the
synchronization, interrupts had to be enabled. Now function tracing can be
started before the other CPUs are brought up, and enabling interrupts in
that case is dangerous. As only tho boot CPU is active, there is no reason
to run the synchronization. If the online CPU count is one, do not bother
doing the synchronization. This removes the need to enable interrupts.
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
2017-03-28 12:35:16 -04:00
Borislav Petkov
32b40a82e8
x86/mce: Do not register notifiers with invalid prio
...
This is just a defensive precaution: do not register notifiers with a
priority which would disrupt the error handling in the notifiers with
prio higher than MCE_PRIO_EDAC.
Signed-off-by: Borislav Petkov <bp@suse.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170327093304.10683-7-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-28 08:55:15 +02:00
Tony Luck
5de97c9f6d
x86/mce: Factor out and deprecate the /dev/mcelog driver
...
Move all code relating to /dev/mcelog to a separate source file.
/dev/mcelog driver can now operate from the machine check notifier with
lowest prio.
Signed-off-by: Tony Luck <tony.luck@intel.com >
[ Move the mce_helper and trigger functionality behind CONFIG_X86_MCELOG_LEGACY. ]
Signed-off-by: Borislav Petkov <bp@suse.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170327093304.10683-6-bp@alien8.de
[ Renamed CONFIG_X86_MCELOG to CONFIG_X86_MCELOG_LEGACY. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-28 08:55:01 +02:00
Borislav Petkov
011d826111
RAS: Add a Corrected Errors Collector
...
Introduce a simple data structure for collecting correctable errors
along with accessors. More detailed description in the code itself.
The error decoding is done with the decoding chain now and
mce_first_notifier() gets to see the error first and the CEC decides
whether to log it and then the rest of the chain doesn't hear about it -
basically the main reason for the CE collector - or to continue running
the notifiers.
When the CEC hits the action threshold, it will try to soft-offine the
page containing the ECC and then the whole decoding chain gets to see
the error.
Signed-off-by: Borislav Petkov <bp@suse.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170327093304.10683-5-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-28 08:54:48 +02:00
Borislav Petkov
e64edfcce9
x86/mce: Rename mce_log to mce_log_buffer
...
It is confusing when staring at "struct mce_log mcelog" and then there's
also a function called mce_log(). So call the buffer what it is.
No functionality change.
Signed-off-by: Borislav Petkov <bp@suse.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170327093304.10683-4-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-28 08:54:42 +02:00
Borislav Petkov
fe3ed20fdd
x86/mce: Rename mce_log()'s argument
...
We call it everywhere "struct mce *m". Adjust that here too to avoid
confusion.
No functionality change.
Signed-off-by: Borislav Petkov <bp@suse.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170327093304.10683-3-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-28 08:54:38 +02:00
Ingo Molnar
4a96d1a5f0
Merge branch 'ras/urgent' into ras/core, to pick up fix
...
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-28 08:54:25 +02:00
Andi Kleen
cc66afea58
x86/mce: Don't print MCEs when mcelog is active
...
Since:
cd9c57cad3
("x86/MCE: Dump MCE to dmesg if no consumers")
all MCEs are printed even when mcelog is running. Fix the regression to
not print to dmesg when mcelog is running as it is a consumer too.
Signed-off-by: Andi Kleen <ak@linux.intel.com >
[ Massage commit message. ]
Signed-off-by: Borislav Petkov <bp@suse.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: linux-edac <linux-edac@vger.kernel.org >
Cc: stable@vger.kernel.org # 4.10..
Fixes: cd9c57cad3
("x86/MCE: Dump MCE to dmesg if no consumers")
Link: http://lkml.kernel.org/r/20170327093304.10683-2-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-28 08:53:52 +02:00
Peter Zijlstra
9a93848fe7
x86/debug: Implement __WARN() using UD0
...
By using "UD0" for WARN()s we remove the function call and its possible
__FILE__ and __LINE__ immediate arguments from the instruction stream.
Total image size will not change much, what we win in the instruction
stream we'll lose because of the __bug_table entries. Still, saves on
I$ footprint and the total image size does go down a bit.
text data filename
10702123 4530992 defconfig-build/vmlinux.orig
10682460 4530992 defconfig-build/vmlinux.patched
(UML didn't seem to use GENERIC_BUG at all, so remove it)
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Richard Weinberger <richard.weinberger@gmail.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-27 10:20:28 +02:00
Kirill A. Shutemov
f2a6a70501
x86: Convert the rest of the code to support p4d_t
...
This patch converts x86 to use proper folding of a new (fifth) page table level
with <asm-generic/pgtable-nop4d.h>.
That's a bit of a kitchen sink patch, but I don't see how to split it further
without hurting bisectability.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170317185515.8636-7-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-27 08:56:58 +02:00
Kirill A. Shutemov
7f68904182
x86/kexec: Add 5-level paging support
...
Handle additional page table level in the kexec code.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170317185515.8636-2-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-27 08:56:13 +02:00
Steven Rostedt (VMware)
1fa9d67a2f
x86/ftrace: Use Makefile logic instead of #ifdef for compiling ftrace_*.o
...
Currently ftrace_32.S and ftrace_64.S are compiled even when
CONFIG_FUNCTION_TRACER is not set. This means there's an unnecessary #ifdef
to protect the code. Instead of using preprocessor directives, only compile
those files when FUNCTION_TRACER is defined.
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com >
Reviewed-by: Ingo Molnar <mingo@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Link: http://lkml.kernel.org/r/20170316210043.peycxdxktwwn6cid@treble
Link: http://lkml.kernel.org/r/20170323143446.217684991@goodmis.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-24 10:14:08 +01:00
Steven Rostedt (VMware)
644e0e8dc7
x86/ftrace: Add -mfentry support to x86_32 with DYNAMIC_FTRACE set
...
x86_64 has had fentry support for some time. I did not add support to x86_32
as I was unsure if it will be used much in the future. It is still very much
used, and there's issues with function graph tracing with gcc playing around
with the mcount frames, causing function graph to panic. The fentry code
does not have this issue, and is able to cope as there is no frame to mess
up.
Note, this only adds support for fentry when DYNAMIC_FTRACE is set. There's
really no reason to not have that set, because the performance of the
machine drops significantly when it's not enabled.
Keep !DYNAMIC_FTRACE around to test it off, as there's still some archs
that have FTRACE but not DYNAMIC_FTRACE.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org >
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com >
Reviewed-by: Ingo Molnar <mingo@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Link: http://lkml.kernel.org/r/20170323143446.052202377@goodmis.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-24 10:14:07 +01:00
Steven Rostedt (VMware)
ff04b440d2
x86/ftrace: Clean up ftrace_regs_caller
...
When ftrace_regs_caller was created, it was designed to preserve flags as
much as possible as it needed to act just like a breakpoint triggered on the
same location. But the design is over complicated as it treated all
operations as modifying flags. But push, mov and lea do not modify flags.
This means the code can become more simplified by allowing flags to be
stored further down.
Making ftrace_regs_caller simpler will also be useful in implementing fentry
logic.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org >
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com >
Reviewed-by: Ingo Molnar <mingo@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andrew Morton <akpm@linux-foundation.org >
Link: http://lkml.kernel.org/r/20170316135328.36123c3e@gandalf.local.home
Link: http://lkml.kernel.org/r/20170323143445.917292592@goodmis.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-24 10:14:07 +01:00
Steven Rostedt (VMware)
e6928e58d4
x86/ftrace: Add stack frame pointer to ftrace_caller
...
The function hook ftrace_caller does not create its own stack frame, and
this causes the ftrace stack trace to miss the first function when doing
stack traces.
# echo schedule:stacktrace > /sys/kernel/tracing/set_ftrace_filter
Before:
<idle>-0 [002] .N.. 29.865807: <stack trace>
=> cpu_startup_entry
=> start_secondary
=> startup_32_smp
<...>-7 [001] .... 29.866509: <stack trace>
=> kthread
=> ret_from_fork
<...>-1 [000] .... 29.865377: <stack trace>
=> poll_schedule_timeout
=> do_select
=> core_sys_select
=> SyS_select
=> do_fast_syscall_32
=> entry_SYSENTER_32
After:
<idle>-0 [002] .N.. 31.234853: <stack trace>
=> do_idle
=> cpu_startup_entry
=> start_secondary
=> startup_32_smp
<...>-7 [003] .... 31.235140: <stack trace>
=> rcu_gp_kthread
=> kthread
=> ret_from_fork
<...>-1819 [000] .... 31.264172: <stack trace>
=> schedule_hrtimeout_range
=> poll_schedule_timeout
=> do_sys_poll
=> SyS_ppoll
=> do_fast_syscall_32
=> entry_SYSENTER_32
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com >
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org >
Reviewed-by: Ingo Molnar <mingo@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Link: http://lkml.kernel.org/r/20170323143445.771707773@goodmis.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-24 10:14:07 +01:00
Steven Rostedt (VMware)
3d82c59c6e
x86/ftrace: Move the ftrace specific code out of entry_32.S
...
The function tracing hook code for ftrace is not an entry point from
userspace and does not belong in the entry_*.S files. It has already been
moved out of entry_64.S.
Move it out of entry_32.S into its own ftrace_32.S file.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Reviewed-by: Ingo Molnar <mingo@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Link: http://lkml.kernel.org/r/20170323143445.645218946@goodmis.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-24 10:14:07 +01:00
Steven Rostedt (VMware)
db65d7b6dc
x86/ftrace: Rename mcount_64.S to ftrace_64.S
...
With the advent of -mfentry that uses the new "fentry" hook over mcount,
the mcount name is obsolete. Having the code file that ftrace hooks into
called "mcount*.S" is rather misleading. Rename it to ftrace_64.S and
remove the file name reference.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Reviewed-by: Ingo Molnar <mingo@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Link: http://lkml.kernel.org/r/20170323143445.490601451@goodmis.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-24 10:14:06 +01:00
Ingo Molnar
1f9ca18404
Merge branch 'x86/process' into x86/mm, to create new base for further patches
...
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-23 08:28:19 +01:00
Andy Lutomirski
b23adb7d3f
x86/xen/gdt: Use X86_FEATURE_XENPV instead of globals for the GDT fixup
...
Xen imposes special requirements on the GDT. Rather than using a
global variable for the pgprot, just use an explicit special case
for Xen -- this makes it clearer what's going on. It also debloats
64-bit kernels very slightly.
Signed-off-by: Andy Lutomirski <luto@kernel.org >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Juergen Gross <jgross@suse.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Garnier <thgarnie@google.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/e9ea96abbfd6a8c87753849171bb5987ecfeb523.1490218061.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-23 08:25:08 +01:00
Andy Lutomirski
23b2a4ddeb
x86/boot/32: Defer resyncing initial_page_table until per-cpu is set up
...
The x86 smpboot trampoline expects initial_page_table to have the
GDT mapped. If the GDT ends up in a virtually mapped per-cpu page,
then it won't be in the page tables at all until perc-pu areas are
set up. The result will be a triple fault the first time that the
CPU attempts to access the GDT after LGDT loads the perc-pu GDT.
This appears to be an old bug, but somehow the GDT fixmap rework
is triggering it. This seems to have something to do with the
memory layout.
Signed-off-by: Andy Lutomirski <luto@kernel.org >
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Juergen Gross <jgross@suse.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Garnier <thgarnie@google.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/a553264a5972c6a86f9b5caac237470a0c74a720.1490218061.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-23 08:25:08 +01:00
Andy Lutomirski
aa4ea67552
x86/gdt: Fix setup_fixmap_gdt() to use the correct PA
...
__pa() cannot be used on percpu pointers because they may be
virtually mapped. Use per_cpu_ptr_to_phys() instead.
This fixes a boot crash on a some 32-bit configurations. I assume
this is related to which allocation strategy is chosen by the percpu
core.
Signed-off-by: Andy Lutomirski <luto@kernel.org >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Juergen Gross <jgross@suse.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Garnier <thgarnie@google.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Fixes: 69218e4799
x86: ("Remap GDT tables in the fixmap section")
Link: http://lkml.kernel.org/r/22e0069c29fba31998f193201e359eebfdac4960.1490218061.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-23 08:25:07 +01:00
Peter Zijlstra
698eff6355
sched/clock, x86/perf: Fix "perf test tsc"
...
People reported that commit:
5680d8094f
("sched/clock: Provide better clock continuity")
broke "perf test tsc".
That commit added another offset to the reported clock value; so
take that into account when computing the provided offset values.
Reported-by: Adrian Hunter <adrian.hunter@intel.com >
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org >
Tested-by: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Mike Galbraith <efault@gmx.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Fixes: 5680d8094f
("sched/clock: Provide better clock continuity")
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-23 07:31:49 +01:00
Dave Airlie
65d1086c44
BackMerge tag 'v4.11-rc3' into drm-next
...
Linux 4.11-rc3 as requested by Daniel
2017-03-23 12:05:13 +10:00
Mike Travis
ad4830051a
x86/platform/uv: Fix calculation of Global Physical Address
...
The calculation of the global physical address (GPA) on UV4 is
incorrect. The gnode_extra/upper global offset should only be
applied for fixed address space systems (UV1..3).
Tested-by: John Estabrook <john.estabrook@hpe.com >
Signed-off-by: Mike Travis <mike.travis@hpe.com >
Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com >
Cc: John Estabrook <estabrook@sgi.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Russ Anderson <russ.anderson@hpe.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/20170321231646.667689538@asylum.americas.sgi.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-22 07:41:10 +01:00
Lu Baolu
1b5aeebf3a
x86/earlyprintk: Add support for earlyprintk via USB3 debug port
...
Add support for earlyprintk by writing debug messages to the
USB3 debug port. Users can use this type of early printk by
specifying the kernel parameter of "earlyprintk=xdbc". This
gives users a chance of providing debugging output.
The hardware for USB3 debug port requires DMA memory blocks.
This requires to delay setting up debugging hardware and
registering boot console until the memblocks are filled.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Mathias Nyman <mathias.nyman@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: linux-usb@vger.kernel.org
Link: http://lkml.kernel.org/r/1490083293-3792-4-git-send-email-baolu.lu@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-21 12:30:16 +01:00
Lu Baolu
dd759d93f4
x86/timers: Add simple udelay calibration
...
Add a simple udelay calibration in x86 architecture-specific
boot-time initializations. This will get a workable estimate
for loops_per_jiffy. Hence, udelay() could be used after this
initialization.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Brian Gerst <brgerst@gmail.com >
Cc: Denys Vlasenko <dvlasenk@redhat.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Mathias Nyman <mathias.nyman@linux.intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: linux-usb@vger.kernel.org
Link: http://lkml.kernel.org/r/1490083293-3792-2-git-send-email-baolu.lu@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-03-21 12:28:45 +01:00
Kyle Huey
e9ea1e7f53
x86/arch_prctl: Add ARCH_[GET|SET]_CPUID
...
Intel supports faulting on the CPUID instruction beginning with Ivy Bridge.
When enabled, the processor will fault on attempts to execute the CPUID
instruction with CPL>0. Exposing this feature to userspace will allow a
ptracer to trap and emulate the CPUID instruction.
When supported, this feature is controlled by toggling bit 0 of
MSR_MISC_FEATURES_ENABLES. It is documented in detail in Section 2.3.2 of
https://bugzilla.kernel.org/attachment.cgi?id=243991
Implement a new pair of arch_prctls, available on both x86-32 and x86-64.
ARCH_GET_CPUID: Returns the current CPUID state, either 0 if CPUID faulting
is enabled (and thus the CPUID instruction is not available) or 1 if
CPUID faulting is not enabled.
ARCH_SET_CPUID: Set the CPUID state to the second argument. If
cpuid_enabled is 0 CPUID faulting will be activated, otherwise it will
be deactivated. Returns ENODEV if CPUID faulting is not supported on
this system.
The state of the CPUID faulting flag is propagated across forks, but reset
upon exec.
Signed-off-by: Kyle Huey <khuey@kylehuey.com >
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: linux-kselftest@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com >
Cc: Robert O'Callahan <robert@ocallahan.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Len Brown <len.brown@intel.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: David Matlack <dmatlack@google.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: linux-fsdevel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com >
Link: http://lkml.kernel.org/r/20170320081628.18952-9-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-20 16:10:34 +01:00
Kyle Huey
90218ac77d
x86/cpufeature: Detect CPUID faulting support
...
Intel supports faulting on the CPUID instruction beginning with Ivy Bridge.
When enabled, the processor will fault on attempts to execute the CPUID
instruction with CPL>0. This will allow a ptracer to emulate the CPUID
instruction.
Bit 31 of MSR_PLATFORM_INFO advertises support for this feature. It is
documented in detail in Section 2.3.2 of
https://bugzilla.kernel.org/attachment.cgi?id=243991
Detect support for this feature and expose it as X86_FEATURE_CPUID_FAULT.
Signed-off-by: Kyle Huey <khuey@kylehuey.com >
Reviewed-by: Borislav Petkov <bp@suse.de >
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: linux-kselftest@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com >
Cc: Robert O'Callahan <robert@ocallahan.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Len Brown <len.brown@intel.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: David Matlack <dmatlack@google.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: linux-fsdevel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com >
Link: http://lkml.kernel.org/r/20170320081628.18952-8-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-20 16:10:34 +01:00
Kyle Huey
79170fda31
x86/syscalls/32: Wire up arch_prctl on x86-32
...
Hook up arch_prctl to call do_arch_prctl() on x86-32, and in 32 bit compat
mode on x86-64. This allows to have arch_prctls that are not specific to 64
bits.
On UML, simply stub out this syscall.
Signed-off-by: Kyle Huey <khuey@kylehuey.com >
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: linux-kselftest@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com >
Cc: Robert O'Callahan <robert@ocallahan.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Len Brown <len.brown@intel.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: David Matlack <dmatlack@google.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: linux-fsdevel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com >
Link: http://lkml.kernel.org/r/20170320081628.18952-7-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-20 16:10:33 +01:00
Kyle Huey
b0b9b01401
x86/arch_prctl: Add do_arch_prctl_common()
...
Add do_arch_prctl_common() to handle arch_prctls that are not specific to 64
bit mode. Call it from the syscall entry point, but not any of the other
callsites in the kernel, which all want one of the existing 64 bit only
arch_prctls.
Signed-off-by: Kyle Huey <khuey@kylehuey.com >
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: linux-kselftest@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com >
Cc: Robert O'Callahan <robert@ocallahan.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Len Brown <len.brown@intel.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: David Matlack <dmatlack@google.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: linux-fsdevel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com >
Link: http://lkml.kernel.org/r/20170320081628.18952-6-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-20 16:10:33 +01:00
Kyle Huey
17a6e1b8e8
x86/arch_prctl/64: Rename do_arch_prctl() to do_arch_prctl_64()
...
In order to introduce new arch_prctls that are not 64 bit only, rename the
existing 64 bit implementation to do_arch_prctl_64(). Also rename the
second argument of that function from 'addr' to 'arg2', because it will no
longer always be an address.
Signed-off-by: Kyle Huey <khuey@kylehuey.com >
Reviewed-by: Andy Lutomirski <luto@kernel.org >
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: linux-kselftest@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com >
Cc: Robert O'Callahan <robert@ocallahan.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: Len Brown <len.brown@intel.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: David Matlack <dmatlack@google.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: linux-fsdevel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com >
Link: http://lkml.kernel.org/r/20170320081628.18952-5-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-20 16:10:32 +01:00
Kyle Huey
ff3f097eef
x86/arch_prctl/64: Use SYSCALL_DEFINE2 to define sys_arch_prctl()
...
Use the SYSCALL_DEFINE2 macro instead of manually defining it.
Signed-off-by: Kyle Huey <khuey@kylehuey.com >
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: linux-kselftest@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com >
Cc: Robert O'Callahan <robert@ocallahan.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Len Brown <len.brown@intel.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: David Matlack <dmatlack@google.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: linux-fsdevel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com >
Link: http://lkml.kernel.org/r/20170320081628.18952-4-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-20 16:10:32 +01:00
Kyle Huey
dd93938a92
x86/arch_prctl: Rename 'code' argument to 'option'
...
The x86 specific arch_prctl() arbitrarily changed prctl's 'option' to
'code'. Before adding new options, rename it.
Signed-off-by: Kyle Huey <khuey@kylehuey.com >
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: linux-kselftest@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com >
Cc: Robert O'Callahan <robert@ocallahan.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Len Brown <len.brown@intel.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: David Matlack <dmatlack@google.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: linux-fsdevel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com >
Link: http://lkml.kernel.org/r/20170320081628.18952-3-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-20 16:10:32 +01:00
Kyle Huey
ab6d946863
x86/msr: Rename MISC_FEATURE_ENABLES to MISC_FEATURES_ENABLES
...
This matches the only public Intel documentation of this MSR, in the
"Virtualization Technology FlexMigration Application Note"
(preserved at https://bugzilla.kernel.org/attachment.cgi?id=243991 )
Signed-off-by: Kyle Huey <khuey@kylehuey.com >
Cc: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Andi Kleen <andi@firstfloor.org >
Cc: linux-kselftest@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com >
Cc: Robert O'Callahan <robert@ocallahan.org >
Cc: Richard Weinberger <richard@nod.at >
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Len Brown <len.brown@intel.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: user-mode-linux-user@lists.sourceforge.net
Cc: David Matlack <dmatlack@google.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Dmitry Safonov <dsafonov@virtuozzo.com >
Cc: linux-fsdevel@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com >
Link: http://lkml.kernel.org/r/20170320081628.18952-2-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-20 16:10:32 +01:00
Andy Lutomirski
5b781c7e31
x86/tls: Forcibly set the accessed bit in TLS segments
...
For mysterious historical reasons, struct user_desc doesn't indicate
whether segments are accessed. set_thread_area() has always programmed
segments as non-accessed, so the first write will set the accessed bit.
This will fault if the GDT is read-only.
Fix it by making TLS segments start out accessed.
If this ends up breaking something, we could, in principle, leave TLS
segments non-accessed and fix them up when we get the page fault. I'd be
surprised, though -- AFAIK all the nasty legacy segmented programs (DOSEMU,
Wine, things that run on DOSEMU and Wine, etc.) do their nasty segmented
things using the LDT and not the GDT. I assume this is mainly because old
OSes (Linux and otherwise) didn't historically provide APIs to do nasty
things in the GDT.
Fixes: 45fc8757d1
("x86: Make the GDT remapping read-only on 64-bit")
Signed-off-by: Andy Lutomirski <luto@kernel.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Thomas Garnier <thgarnie@google.com >
Link: http://lkml.kernel.org/r/62b7748542df0164af7e0a5231283b9b13858c45.1489900519.git.luto@kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2017-03-19 12:14:35 +01:00