[PATCH 1/3] efi: Use efi_mm in x86 as well as ARM

2017-12-16 Thread Sai Praneeth Prakhya
and readability. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Andy Lutomirski Cc: Michael S. Tsirkin Cc: Ricardo Neri Cc: Matt Fleming Cc: Ard Biesheuvel Cc: Ravi Shankar Tested-by: Bhupesh Sharma --- arch/x86/include/asm/efi.h | 4 arch

[PATCH 0/3] Use mm_struct and switch_mm() instead of manually

2017-12-16 Thread Sai Praneeth Prakhya
e.c | 9 -- drivers/firmware/efi/efi.c | 9 ++ include/linux/efi.h | 2 ++ 6 files changed, 57 insertions(+), 53 deletions(-) Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Andy Lutomirski Cc: Michael S. Tsirkin C

[PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3

2017-12-16 Thread Sai Praneeth Prakhya
return successfully. We can use efi_switch_mm() helper function only with x86_64 kernel and "efi=old_map" disabled because, x86_32 and efi=old_map doesn't use efi_pgd, rather they use swapper_pg_dir. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck

[PATCH 2/3] x86/efi: Replace efi_pgd with efi_mm.pgd

2017-12-16 Thread Sai Praneeth Prakhya
From: Sai Praneeth Since the previous patch added support for efi_mm, let's handle efi_pgd through efi_mm and remove global variable efi_pgd. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Andy Lutomirski Cc: Michael S. Tsirkin Cc: Bhupesh

[PATCH V2 2/3] x86/efi: Replace efi_pgd with efi_mm.pgd

2017-08-28 Thread Sai Praneeth Prakhya
From: Sai Praneeth Since the previous patch added support for efi_mm, let's handle efi_pgd through efi_mm and remove global variable efi_pgd. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Andy Lutomirski Cc: Michael S. Tsirkin Cc: Ricardo Neri

[PATCH V2 0/3] Use mm_struct and switch_mm() instead of manually

2017-08-28 Thread Sai Praneeth Prakhya
From: Sai Praneeth Presently, in x86, to invoke any efi function like efi_set_virtual_address_map() or any efi_runtime_service() the code path typically involves read_cr3() (save previous pgd), write_cr3() (write efi_pgd) and calling efi function. Likewise after returning from efi function the

[PATCH V2 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3

2017-08-28 Thread Sai Praneeth Prakhya
return successfully. We can use efi_switch_mm() helper function only with x86_64 kernel and "efi=old_map" disabled because, x86_32 and efi=old_map doesn't use efi_pgd, rather they use swapper_pg_dir. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck

[PATCH V2 1/3] efi: Use efi_mm in x86 as well as ARM

2017-08-28 Thread Sai Praneeth Prakhya
and readability. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Andy Lutomirski Cc: Michael S. Tsirkin Cc: Ricardo Neri Cc: Matt Fleming Cc: Ard Biesheuvel Cc: Ravi Shankar --- drivers/firmware/efi/arm-runtime.c | 9 - drivers/firmware/efi/efi.c

Re: [PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3

2017-08-23 Thread Sai Praneeth Prakhya
On Mon, 2017-08-21 at 08:23 -0700, Andy Lutomirski wrote: > > > On Aug 21, 2017, at 7:08 AM, Peter Zijlstra wrote: > > > >> On Mon, Aug 21, 2017 at 06:56:01AM -0700, Andy Lutomirski wrote: > >> > >> > >>> On Aug 21, 2017, at 3:33 AM, Peter Zijlstra wrote: > > > > Using a kernel

Re: [PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3

2017-08-24 Thread Sai Praneeth Prakhya
On Tue, 2017-08-15 at 14:46 -0700, Andy Lutomirski wrote: > On Tue, Aug 15, 2017 at 12:18 PM, Sai Praneeth Prakhya > wrote: > > +/* > > + * Makes the calling kernel thread switch to/from efi_mm context > > + * Can be used from SetVirtualAddressMap() or during efi run

Re: [PATCH V2 0/3] Use mm_struct and switch_mm() instead of manually

2017-09-05 Thread Sai Praneeth Prakhya
> I get a similar crash on Qemu with linus's master branch and the V2 > applied on top of it. Here are the details of my test environment: > > 1. I use the OVMF (EDK2) EFI firmware to launch the kernel: > edk2.git/ovmf-x64 > > 2. I used linus's master branch (HEAD - commit: >

Re: [PATCH V2 0/3] Use mm_struct and switch_mm() instead of manually

2017-09-05 Thread Sai Praneeth Prakhya
On Tue, 2017-09-05 at 19:21 -0700, Sai Praneeth Prakhya wrote: > > I get a similar crash on Qemu with linus's master branch and the V2 > > applied on top of it. Here are the details of my test environment: > > > > 1. I use the OVMF (EDK2) EFI firmware to launch the kerne

[PATCH 0/3] Use mm_struct and switch_mm() instead of manually

2017-08-15 Thread Sai Praneeth Prakhya
From: Sai Praneeth Presently, in x86, to invoke any efi function like efi_set_virtual_address_map() or any efi_runtime_service() the code path typically involves read_cr3() (save previous pgd), write_cr3() (write efi_pgd) and calling efi function. Likewise after returning from efi function the

[PATCH 1/3] efi: Use efi_mm in x86 as well as ARM

2017-08-15 Thread Sai Praneeth Prakhya
and readability. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Andy Lutomirski Cc: Michael S. Tsirkin Cc: Ricardo Neri Cc: Matt Fleming Cc: Ard Biesheuvel Cc: Ravi Shankar --- drivers/firmware/efi/arm-runtime.c | 9 - drivers/firmware/efi/efi.c | 9

[PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3

2017-08-15 Thread Sai Praneeth Prakhya
return successfully. We can use efi_switch_mm() only with x86_64 kernel and "efi=old_map" disabled because, x86_32 and efi=old_map doesn't use efi_pgd, rather they use swapper_pg_dir. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Andy Lutomirski Cc:

[PATCH 2/3] x86/efi: Replace efi_pgd with efi_mm.pgd

2017-08-15 Thread Sai Praneeth Prakhya
From: Sai Praneeth Since the previous patch added support for efi_mm, let's handle efi_pgd through efi_mm and remove global variable efi_pgd. Signed-off-by: Sai Praneeth Prakhya Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Andy Lutomirski Cc: Michael S. Tsirkin Cc: Ricardo Neri Cc: Matt

Re: [PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3

2017-08-15 Thread Sai Praneeth Prakhya
On Tue, 2017-08-15 at 14:46 -0700, Andy Lutomirski wrote: > On Tue, Aug 15, 2017 at 12:18 PM, Sai Praneeth Prakhya > wrote: > > +/* > > + * Makes the calling kernel thread switch to/from efi_mm context > > + * Can be used from SetVirtualAddressMap() or during efi run

[PATCH] x86: Use boot_cpu_has() instead of this_cpu_has() in build_cr3_noflush()

2018-04-04 Thread Sai Praneeth Prakhya
ffects MCE. Signed-off-by: Sai Praneeth Prakhya Reported-by: Linus Torvalds Cc: Lee Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Andy Lutomirski Cc: Michael S. Tsirkin Cc: Ricardo Neri Cc: Matt Fleming Cc: Ard Biesheuvel Cc: Ravi Shankar Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Peter Zi

[PATCH V2 3/3] efi: Use efi_rts_workqueue to invoke EFI Runtime Services

2018-03-05 Thread Sai Praneeth Prakhya
() except set_variable<>() and query_variable_info<>() Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark Rutland Cc: Bhupesh Sharma Cc: Ricardo Neri Cc: Ravi Shankar Cc: Ma

[PATCH V2 2/3] efi: Introduce efi_rts_workqueue and some infrastructure to invoke all efi_runtime_services()

2018-03-05 Thread Sai Praneeth Prakhya
() can be a value (of any type) or a pointer (of any type). Hence, efi_runtime_work has five void pointers to store these arguments. Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark

[PATCH V2 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization

2018-03-05 Thread Sai Praneeth Prakhya
efi_rts_wq and all the efi_runtime_services() will be called using efi_rts_wq. Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark Rutland Cc: Bhupesh Sharma Cc: Ricardo Neri Cc: Ravi

[PATCH V2 0/3] Use efi_rts_workqueue to invoke EFI Runtime Services

2018-03-05 Thread Sai Praneeth Prakhya
Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark Rutland Cc: Bhupesh Sharma Cc: Ricardo Neri Cc: Ravi Shankar Cc: Matt Fleming Cc: Peter Zijlstra Cc: Ard Biesheuvel Cc: Dan Williams -- 2.7.4

[PATCH V1 0/3] Use efi_rts_workqueue to invoke EFI Runtime Services

2018-02-24 Thread Sai Praneeth Prakhya
| 26 5 files changed, 253 insertions(+), 27 deletions(-) Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark Rutland Cc: Bhupesh Sharma Cc: Ricardo Neri Cc

[PATCH V1 2/3] efi: Introduce efi_rts_workqueue and necessary infrastructure to invoke all efi_runtime_services()

2018-02-24 Thread Sai Praneeth Prakhya
. Semantics followed by efi_call_rts() to understand efi_runtime_work: 1. If argument was a pointer, recast it from void pointer to original pointer type. 2. If argument was a value, recast it from void pointer to original pointer type and dereference it. Signed-off-by: Sai Praneeth Prakhya

[PATCH V1 3/3] efi: Use efi_rts_workqueue to invoke EFI Runtime Services

2018-02-24 Thread Sai Praneeth Prakhya
_info<>() Semantics to pack arguments in efi_runtime_work (has void pointers): 1. If argument is a pointer (of any type), pass it as is. 2. If argument is a value (of any type), address of the value is passed. Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee, Chun-Yi Cc:

[PATCH V1 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization

2018-02-24 Thread Sai Praneeth Prakhya
efi_rts_wq and all the efi_runtime_services() will be called using efi_rts_wq. Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark Rutland Cc: Bhupesh Sharma Cc: Ricardo Neri Cc: Ravi

Re: [PATCH v4 00/10] PCID and improved laziness

2017-09-12 Thread Sai Praneeth Prakhya
> From: Andy Lutomirski > Date: Thu, Jun 29, 2017 at 8:53 AM > Subject: [PATCH v4 00/10] PCID and improved laziness > To: x...@kernel.org > Cc: linux-kernel@vger.kernel.org, Borislav Petkov , > Linus Torvalds , Andrew Morton > , Mel Gorman , > "linux...@kvack.org" , Nadav Amit > , Rik van Riel ,

Re: [PATCH v4 00/10] PCID and improved laziness

2017-09-12 Thread Sai Praneeth Prakhya
> > > Hi Andy, > > I have booted Linus's tree (8fac2f96ab86b0e14ec4e42851e21e9b518bdc55) on > Skylake server and noticed that it reboots automatically. > > When I booted the same kernel with command line arg "nopcid" it works > fine. Please find below a snippet of dmesg. Please let me know if

[PATCH] fork: Improve error message for corrupted page tables

2019-07-30 Thread Sai Praneeth Prakhya
Cc: Andrew Morton Suggested-by/Acked-by: Dave Hansen Signed-off-by: Sai Praneeth Prakhya --- include/linux/mm_types_task.h | 7 +++ kernel/fork.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/linux/mm_types_task.h b/include/linux

[PATCH V3] fork: Improve error message for corrupted page tables

2019-08-06 Thread Sai Praneeth Prakhya
-by: Vlastimil Babka Acked-by: Dave Hansen Suggested-by: Dave Hansen Reviewed-by: Anshuman Khandual Signed-off-by: Sai Praneeth Prakhya --- Changes from V2 to V3: -- 1. Add comment that suggests to update resident_page_types[] if there are any changes to exisiting page types

Re: [PATCH V2] fork: Improve error message for corrupted page tables

2019-08-06 Thread Sai Praneeth Prakhya
On Tue, 2019-08-06 at 10:36 +0200, Michal Hocko wrote: > On Mon 05-08-19 20:05:27, Sai Praneeth Prakhya wrote: > > When a user process exits, the kernel cleans up the mm_struct of the user > > process and during cleanup, check_mm() checks the page tables of the user > > proces

[PATCH V2] x86/efi: Fix kernel panic when CONFIG_DEBUG_VIRTUAL is enabled

2015-10-16 Thread Sai Praneeth Prakhya
.org/r/5462999a.7090...@intel.com. So, before calling __pa() virtual addresses should be validated which results in skipping call to split_page_count() and that should be fine because it is used to keep track of everything *but* 1:1 mappings. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@

[PATCH] x86/efi: Fix kernel panic when CONFIG_DEBUG_VIRTUAL is enabled

2015-10-13 Thread Sai Praneeth Prakhya
ecause it is used to keep track of direct kernel mappings and not 1:1 mappings. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Reported-by: Dave Hansen <dave.han...@intel.com> Cc: Matt Fleming <matt.flem...@intel.com> Cc: Ricardo Neri <ricardo.n...@intel.

[PATCH] x86/efi-bgrt: Fix kernel panic when mapping BGRT data

2015-12-10 Thread Sai Praneeth Prakhya
RAM regions and not I/O regions. We also delete efi_lookup_mapped_addr() because it is impossible to use it without also doing the page table switch to efi_pgd. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Reported-by: Wendy Wang <wendy.w...@intel.com> Cc: Matt Fle

[PATCH] x86/mm/pageattr: Use _PAGE_GLOBAL bit for EFI page table mappings

2016-01-27 Thread Sai Praneeth Prakhya
<ravi.v.shan...@intel.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Matt Fleming <m...@codeblueprint.co.uk> Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> --- arch/x86/mm/pageattr.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/

Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings

2016-02-23 Thread Sai Praneeth Prakhya
On Tue, 2016-02-23 at 09:47 -0800, Andy Lutomirski wrote: > On Feb 23, 2016 1:09 AM, tip...@zytor.com@zytor.com> wrote: > > Something's wrong with tip-bot. This should say: > > > commit 397630150632639b3ca5b4414accd5011c45e276 > Author: Sai Praneeth

[PATCH] x86/fpu/xstate: Return error if xfeature bit is unset in XSAVES compacted-format buffer

2016-07-25 Thread Sai Praneeth Prakhya
eature (E.g: XFEATURE_MASK_PKRU) bit set), then fpu__xfeature_set_state() returns error. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Reported-by: Dave Hansen <dave.han...@intel.com> Suggested-by: Dave Hansen <dave.han...@intel.com> Cc: Dave Hansen <da

Re: [PATCH 0/4] UEFI: EFI_MEMORY_ATTRIBUTES_TABLE support for x86

2016-12-07 Thread Sai Praneeth Prakhya
On Wed, 2016-12-07 at 13:56 +, Matt Fleming wrote: > On Tue, 06 Dec, at 11:15:59AM, Sai Praneeth Prakhya wrote: > > From: Sai Praneeth <sai.praneeth.prak...@intel.com> > > > > UEFI v2.6 introduces EFI_MEMORY_ATTRIBUTES_TABLE which describes memory > > prote

Re: [PATCH 0/4] UEFI: EFI_MEMORY_ATTRIBUTES_TABLE support for x86

2016-12-07 Thread Sai Praneeth Prakhya
On Wed, 2016-12-07 at 20:04 +, Matt Fleming wrote: > On Wed, 07 Dec, at 11:01:06AM, Sai Praneeth Prakhya wrote: > > > > Thanks Matt! > > > > Would you like to see a new version of these patch series addressing > > your comments? Like > > 1. Dropping of

[PATCH 3/4] x86/efi: Add support for EFI_MEMORY_ATTRIBUTES_TABLE

2016-12-06 Thread Sai Praneeth Prakhya
check for EFI_MEMORY_ATTRIBUTES_TABLE and if it's present we update mappings according to this table and hence disregarding EFI_PROPERTIES_TABLE even if it's published by firmware. We consider EFI_PROPERTIES_TABLE only when EFI_MEMORY_ATTRIBUTES_TABLE is absent. Signed-off-by: Sai Praneeth P

[PATCH 2/4] efi: Introduce EFI_MEM_ATTR bit and set it from memory attributes table

2016-12-06 Thread Sai Praneeth Prakhya
d data regions by kernel. Allocate a EFI_XXX bit to keep track of whether this feature is published by firmware or not. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Ricardo Neri <ricar

[PATCH 4/4] efi: Skip parsing of EFI_PROPERTIES_TABLE if EFI_MEMORY_ATTRIBUTES_TABLE is detected

2016-12-06 Thread Sai Praneeth Prakhya
E and hence saving us from parsing EFI_PROPERTIES_TABLE again. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Ricardo Neri <ricardo.n...@intel.com> Cc: Matt Fleming <m...

[PATCH 1/4] efi: Make EFI_MEMORY_ATTRIBUTES_TABLE initialization common across all architectures

2016-12-06 Thread Sai Praneeth Prakhya
moves the EFI_MEMORY_ATTRIBUTES_TABLE initialization code to a more generic efi initialization path rather than ARM specific efi initialization. This is important because EFI_MEMORY_ATTRIBUTES_TABLE will be supported by x86 as well. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com

[PATCH 0/4] UEFI: EFI_MEMORY_ATTRIBUTES_TABLE support for x86

2016-12-06 Thread Sai Praneeth Prakhya
From: Sai Praneeth UEFI v2.6 introduces EFI_MEMORY_ATTRIBUTES_TABLE which describes memory protections that may be applied to EFI Runtime code and data regions by kernel. This helps kernel to map efi runtime regions more strictly and hence allowing only

[PATCH 0/3] Use mm_struct and switch_mm() instead of manually

2017-08-15 Thread Sai Praneeth Prakhya
From: Sai Praneeth Presently, in x86, to invoke any efi function like efi_set_virtual_address_map() or any efi_runtime_service() the code path typically involves read_cr3() (save previous pgd), write_cr3() (write efi_pgd) and calling efi function. Likewise after

[PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3

2017-08-15 Thread Sai Praneeth Prakhya
stolen by efi_mm) after the above calls return successfully. We can use efi_switch_mm() only with x86_64 kernel and "efi=old_map" disabled because, x86_32 and efi=old_map doesn't use efi_pgd, rather they use swapper_pg_dir. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.co

[PATCH 1/3] efi: Use efi_mm in x86 as well as ARM

2017-08-15 Thread Sai Praneeth Prakhya
proves code maintainability and readability. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Andy Lutomirski <l...@kernel.org> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Rica

[PATCH 2/3] x86/efi: Replace efi_pgd with efi_mm.pgd

2017-08-15 Thread Sai Praneeth Prakhya
From: Sai Praneeth <sai.praneeth.prak...@intel.com> Since the previous patch added support for efi_mm, let's handle efi_pgd through efi_mm and remove global variable efi_pgd. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> C

Re: [PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3

2017-08-15 Thread Sai Praneeth Prakhya
On Tue, 2017-08-15 at 14:46 -0700, Andy Lutomirski wrote: > On Tue, Aug 15, 2017 at 12:18 PM, Sai Praneeth Prakhya > <sai.praneeth.prak...@intel.com> wrote: > > +/* > > + * Makes the calling kernel thread switch to/from efi_mm context > > + * Can be used from SetVir

[PATCH] x86/efi: Add EFI_PGT_DUMP support for x86_32, kexec and efi=old_map

2017-05-10 Thread Sai Praneeth Prakhya
x86_64, so let's extend it to other efi configurations like kexec kernel, efi=old_map and to x86_32 as well. This doesn't effect normal boot path because this config option should be used only for debug purposes. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Borisl

Re: [PATCH] x86/efi: Add EFI_PGT_DUMP support for x86_32, kexec and efi=old_map

2017-05-11 Thread Sai Praneeth Prakhya
On Thu, 2017-05-11 at 13:18 +0200, Borislav Petkov wrote: > On Wed, May 10, 2017 at 03:49:05PM -0700, Sai Praneeth Prakhya wrote: > > From: Sai Praneeth <sai.praneeth.prak...@intel.com> > > > > EFI_PGT_DUMP, as the name suggests dumps efi page tables to dmesg during &g

[PATCH V2] x86/efi: Add EFI_PGT_DUMP support for x86_32, kexec

2017-05-11 Thread Sai Praneeth Prakhya
x86_64, so let's extend it to other efi configurations like kexec kernel, efi=old_map and to x86_32 as well. This doesn't effect normal boot path because this config option should be used only for debug purposes. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Borisl

Re: [PATCH] x86/efi: Fix kexec kernel panic when efi=old_map is enabled

2017-05-12 Thread Sai Praneeth Prakhya
On Fri, 2017-05-12 at 17:56 +0800, joeyli wrote: > On Mon, May 08, 2017 at 12:25:23PM -0700, Sai Praneeth Prakhya wrote: > > From: Sai Praneeth <sai.praneeth.prak...@intel.com> > > > > Booting kexec kernel with "efi=old_map" in kernel command line

[PATCH v2] x86/efi: Disable runtime services on kexec kernel if booted with efi=old_map

2017-05-16 Thread Sai Praneeth Prakhya
mething else is mapped at the virtual address we allocated for runtime service regions in the initial boot] - Matt Fleming Since kexec was never intended to work with efi=old_map, disable runtime services in kexec if booted with efi=old_map, so that we don't panic. Signed-off-by: Sai Praneeth Prak

Re: [PATCH v2] x86/efi: Disable runtime services on kexec kernel if booted with efi=old_map

2017-05-16 Thread Sai Praneeth Prakhya
On Wed, 2017-05-17 at 09:57 +0800, Dave Young wrote: > Hi Sai, > On 05/16/17 at 06:14pm, Sai Praneeth Prakhya wrote: > > From: Sai Praneeth <sai.praneeth.prak...@intel.com> > > > > Booting kexec kernel with "efi=old_map" in kernel command l

[PATCH] x86/efi: Fix kexec kernel panic when efi=old_map is enabled

2017-05-08 Thread Sai Praneeth Prakhya
ic in a regular kernel because it uses old_map_region() and not __map_region(). Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Ricardo Neri <ricardo.n...@intel.com> Cc: Matt Fleming <m...@codeblueprint.co.uk> Cc:

Re: [PATCH V2 0/3] Use mm_struct and switch_mm() instead of manually

2017-09-05 Thread Sai Praneeth Prakhya
> I get a similar crash on Qemu with linus's master branch and the V2 > applied on top of it. Here are the details of my test environment: > > 1. I use the OVMF (EDK2) EFI firmware to launch the kernel: > edk2.git/ovmf-x64 > > 2. I used linus's master branch (HEAD - commit: >

Re: [PATCH V2 0/3] Use mm_struct and switch_mm() instead of manually

2017-09-05 Thread Sai Praneeth Prakhya
On Tue, 2017-09-05 at 19:21 -0700, Sai Praneeth Prakhya wrote: > > I get a similar crash on Qemu with linus's master branch and the V2 > > applied on top of it. Here are the details of my test environment: > > > > 1. I use the OVMF (EDK2) EFI firmware to launch the kerne

Re: [PATCH v4 00/10] PCID and improved laziness

2017-09-12 Thread Sai Praneeth Prakhya
> > > Hi Andy, > > I have booted Linus's tree (8fac2f96ab86b0e14ec4e42851e21e9b518bdc55) on > Skylake server and noticed that it reboots automatically. > > When I booted the same kernel with command line arg "nopcid" it works > fine. Please find below a snippet of dmesg. Please let me know if

Re: [PATCH v4 00/10] PCID and improved laziness

2017-09-12 Thread Sai Praneeth Prakhya
> From: Andy Lutomirski > Date: Thu, Jun 29, 2017 at 8:53 AM > Subject: [PATCH v4 00/10] PCID and improved laziness > To: x...@kernel.org > Cc: linux-kernel@vger.kernel.org, Borislav Petkov , > Linus Torvalds , Andrew Morton >

[PATCH V2 2/3] x86/efi: Replace efi_pgd with efi_mm.pgd

2017-08-28 Thread Sai Praneeth Prakhya
From: Sai Praneeth <sai.praneeth.prak...@intel.com> Since the previous patch added support for efi_mm, let's handle efi_pgd through efi_mm and remove global variable efi_pgd. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> C

[PATCH V2 0/3] Use mm_struct and switch_mm() instead of manually

2017-08-28 Thread Sai Praneeth Prakhya
From: Sai Praneeth Presently, in x86, to invoke any efi function like efi_set_virtual_address_map() or any efi_runtime_service() the code path typically involves read_cr3() (save previous pgd), write_cr3() (write efi_pgd) and calling efi function. Likewise after

[PATCH V2 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3

2017-08-28 Thread Sai Praneeth Prakhya
stolen by efi_mm) after the above calls return successfully. We can use efi_switch_mm() helper function only with x86_64 kernel and "efi=old_map" disabled because, x86_32 and efi=old_map doesn't use efi_pgd, rather they use swapper_pg_dir. Signed-off-by: Sai Praneeth Prakhya <sai.praneet

[PATCH V2 1/3] efi: Use efi_mm in x86 as well as ARM

2017-08-28 Thread Sai Praneeth Prakhya
proves code maintainability and readability. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l...@intel.com> Cc: Andy Lutomirski <l...@kernel.org> Cc: Mic

Re: [PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3

2017-08-23 Thread Sai Praneeth Prakhya
On Mon, 2017-08-21 at 08:23 -0700, Andy Lutomirski wrote: > > > On Aug 21, 2017, at 7:08 AM, Peter Zijlstra wrote: > > > >> On Mon, Aug 21, 2017 at 06:56:01AM -0700, Andy Lutomirski wrote: > >> > >> > >>> On Aug 21, 2017, at 3:33 AM, Peter Zijlstra

Re: [PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with cr3

2017-08-24 Thread Sai Praneeth Prakhya
On Tue, 2017-08-15 at 14:46 -0700, Andy Lutomirski wrote: > On Tue, Aug 15, 2017 at 12:18 PM, Sai Praneeth Prakhya > <sai.praneeth.prak...@intel.com> wrote: > > +/* > > + * Makes the calling kernel thread switch to/from efi_mm context > > + * Can be used from SetVir

[PATCH 2/3] x86/efi: Replace efi_pgd with efi_mm.pgd

2017-12-16 Thread Sai Praneeth Prakhya
From: Sai Praneeth <sai.praneeth.prak...@intel.com> Since the previous patch added support for efi_mm, let's handle efi_pgd through efi_mm and remove global variable efi_pgd. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> C

[PATCH 1/3] efi: Use efi_mm in x86 as well as ARM

2017-12-16 Thread Sai Praneeth Prakhya
proves code maintainability and readability. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l...@intel.com> Cc: Andy Lutomirski <l...@kernel.org> Cc: Mic

[PATCH 0/3] Use mm_struct and switch_mm() instead of manually

2017-12-16 Thread Sai Praneeth Prakhya
drivers/firmware/efi/arm-runtime.c | 9 -- drivers/firmware/efi/efi.c | 9 ++ include/linux/efi.h | 2 ++ 6 files changed, 57 insertions(+), 53 deletions(-) Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j.

[PATCH 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3

2017-12-16 Thread Sai Praneeth Prakhya
stolen by efi_mm) after the above calls return successfully. We can use efi_switch_mm() helper function only with x86_64 kernel and "efi=old_map" disabled because, x86_32 and efi=old_map doesn't use efi_pgd, rather they use swapper_pg_dir. Signed-off-by: Sai Praneeth Prakhya <sai.praneet

[PATCH V3 3/3] efi: Use efi_rts_wq to invoke EFI Runtime Services

2018-05-21 Thread Sai Praneeth Prakhya
rvices() except set_variable<>() and query_variable_info<>(). Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l.

[PATCH V3 0/3] Use efi_rts_wq to invoke EFI Runtime Services

2018-05-21 Thread Sai Praneeth Prakhya
15 +- drivers/firmware/efi/arm-runtime.c | 3 + drivers/firmware/efi/efi.c | 25 drivers/firmware/efi/runtime-wrappers.c | 250 +--- include/linux/efi.h | 4 + 5 files changed, 271 insertions(+), 26 deletions(-) Signed-

[PATCH V3 1/3] x86/efi: Call efi_delete_dummy_variable() after creating efi_rts_wq

2018-05-21 Thread Sai Praneeth Prakhya
should be done after efi_rts_wq has been created. efi_delete_dummy_variable() calls set_variable(), hence efi_delete_dummy_variable() should be called after efi_rts_wq has been created. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...

[PATCH V3 2/3] efi: Introduce efi_queue_work() to queue any efi_runtime_service() on efi_rts_wq

2018-05-21 Thread Sai Praneeth Prakhya
Hence, efi_runtime_work has five void pointers to store these arguments. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <ton

[PATCH V4 0/3] Use efi_rts_wq to invoke EFI Runtime Services

2018-05-25 Thread Sai Praneeth Prakhya
tions(-) Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l...@intel.com> Cc: Will Deacon <will.dea...@arm.

[PATCH V4 3/3] efi: Use efi_rts_wq to invoke EFI Runtime Services

2018-05-25 Thread Sai Praneeth Prakhya
rvices() except set_variable<>() and query_variable_info<>(). Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <

[PATCH V4 2/3] efi: Create efi_rts_wq and efi_queue_work() to invoke all efi_runtime_services()

2018-05-25 Thread Sai Praneeth Prakhya
nts. 2. An argument of efi_runtime_service() can be a value (of any type) or a pointer (of any type). Hence, efi_runtime_work has five void pointers to store these arguments. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org>

[PATCH V4 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization

2018-05-25 Thread Sai Praneeth Prakhya
e most important reason for calling efi_delete_dummy_variable() late in the boot process is, if called before rest_init(), kernel prints stack trace with a warning "bad: scheduling from the idle thread!". Hence, call from efisubsys_init() which is called during rest_init(). Signed-off-

[PATCH V5 0/3] Use efi_rts_wq to invoke EFI Runtime Services

2018-05-28 Thread Sai Praneeth Prakhya
ntime Services arch/x86/platform/efi/quirks.c | 11 +- drivers/firmware/efi/efi.c | 14 ++ drivers/firmware/efi/runtime-wrappers.c | 218 +--- include/linux/efi.h | 3 + 4 files changed, 224 insertions(+), 22 deletions(-) S

[PATCH V5 2/3] efi: Create efi_rts_wq and efi_queue_work() to invoke all efi_runtime_services()

2018-05-28 Thread Sai Praneeth Prakhya
() can be a value (of any type) or a pointer (of any type). Hence, efi_runtime_work has five void pointers to store these arguments. Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark Rutland

[PATCH V5 3/3] efi: Use efi_rts_wq to invoke EFI Runtime Services

2018-05-28 Thread Sai Praneeth Prakhya
be used while in atomic context. Use of blocking variants like set_variable() and query_variable_info() while in atomic will issue a warning ("scheduling wile in atomic") and prints stack trace. Presently, pstore uses non-blocking variants and hence works fine. Signed-off-by: Sai Pranee

[PATCH V5 1/3] x86/efi: Make efi_delete_dummy_variable() use set_variable_nonblocking() instead of set_variable()

2018-05-28 Thread Sai Praneeth Prakhya
ts doesn't block. Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark Rutland Cc: Bhupesh Sharma Cc: Naresh Bhat Cc: Ricardo Neri Cc: Peter Zijlstra Cc: Ravi Shankar Cc: Matt Flemin

[PATCH 4/6] x86/efi: Free existing memory map before installing new memory map

2018-07-02 Thread Sai Praneeth Prakhya
efi_memmap_alloc(). Signed-off-by: Sai Praneeth Prakhya Suggested-by: Ard Biesheuvel Cc: Lee Chun-Yi Cc: Dave Young Cc: Borislav Petkov Cc: Laszlo Ersek Cc: Jan Kiszka Cc: Dave Hansen Cc: Bhupesh Sharma Cc: Nicolai Stange Cc: Naresh Bhat Cc: Ricardo Neri Cc: Peter Zijlstra Cc: Taku Izumi Cc: Ravi

[PATCH V4 0/3] Use mm_struct and switch_mm() instead of manually

2018-01-18 Thread Sai Praneeth Prakhya
6 files changed, 57 insertions(+), 52 deletions(-) Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l...@intel.com> Cc: Andy Lutomirski <l...@kernel.org> Cc: Mi

[PATCH V4 3/3] x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3

2018-01-18 Thread Sai Praneeth Prakhya
stolen by efi_mm) after the above calls return successfully. We can use efi_switch_mm() helper function only with x86_64 kernel and "efi=old_map" disabled because, x86_32 and efi=old_map doesn't use efi_pgd, rather they use swapper_pg_dir. Signed-off-by: Sai Praneeth Prakhya <sai.praneet

[PATCH V4 1/3] efi: Use efi_mm in x86 as well as ARM

2018-01-18 Thread Sai Praneeth Prakhya
proves code maintainability and readability. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l...@intel.com> Cc: Andy Lutomirski <l...@kernel.org> Cc: Mic

[PATCH V4 2/3] x86/efi: Replace efi_pgd with efi_mm.pgd

2018-01-18 Thread Sai Praneeth Prakhya
From: Sai Praneeth <sai.praneeth.prak...@intel.com> Since the previous patch added support for efi_mm, let's handle efi_pgd through efi_mm and remove global variable efi_pgd. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Cc: Lee, Chun-Yi <j...@suse.com> C

[PATCH V1 0/3] Use efi_rts_workqueue to invoke EFI Runtime Services

2018-02-24 Thread Sai Praneeth Prakhya
| 229 +--- include/linux/efi.h | 26 5 files changed, 253 insertions(+), 27 deletions(-) Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Bori

[PATCH V1 2/3] efi: Introduce efi_rts_workqueue and necessary infrastructure to invoke all efi_runtime_services()

2018-02-24 Thread Sai Praneeth Prakhya
ed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l...@intel.com> Cc: Will Deacon <will.dea...@arm.com> Cc: Da

[PATCH V1 3/3] efi: Use efi_rts_workqueue to invoke EFI Runtime Services

2018-02-24 Thread Sai Praneeth Prakhya
<>() and query_variable_info<>() Semantics to pack arguments in efi_runtime_work (has void pointers): 1. If argument is a pointer (of any type), pass it as is. 2. If argument is a value (of any type), address of the value is passed. Signed-off-by: Sai Praneeth Prakhya <sai.pra

[PATCH V1 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization

2018-02-24 Thread Sai Praneeth Prakhya
patch, this is the place where we create efi_rts_wq and all the efi_runtime_services() will be called using efi_rts_wq. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Pe

[PATCH V2] x86/speculation: Support Enhanced IBRS on future CPUs

2018-07-30 Thread Sai Praneeth Prakhya
/files/managed/1d/46/Retpoline-A-Branch-Target-Injection-Mitigation.pdf Signed-off-by: Sai Praneeth Prakhya Originally-by: David Woodhouse Cc: Tim C Chen Cc: Dave Hansen Cc: Thomas Gleixner Cc: Ravi Shankar Cc: Ingo Molnar --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm

[PATCH V3] x86/speculation: Support Enhanced IBRS on future CPUs

2018-08-01 Thread Sai Praneeth Prakhya
Branch-Target-Injection-Mitigation.pdf Both the documents are available at: https://bugzilla.kernel.org/show_bug.cgi?id=199511 Signed-off-by: Sai Praneeth Prakhya Originally-by: David Woodhouse Cc: Ingo Molnar Cc: Tim C Chen Cc: Dave Hansen Cc: Thomas Gleixner Cc: Ravi Shankar --- arch/x86/i

[PATCH] x86/speculation: Support Enhanced IBRS on future CPUs

2018-07-24 Thread Sai Praneeth Prakhya
managed/c5/63/336996-Speculative-Execution-Side-Channel-Mitigations.pdf Signed-off-by: Sai Praneeth Prakhya Originally-by: David Woodhouse Cc: Tim C Chen Cc: Dave Hansen Cc: Thomas Gleixner Cc: Ravi Shankar Cc: Ingo Molnar --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include

[PATCH V5 0/2] Add efi page fault handler to recover from page

2018-09-10 Thread Sai Praneeth Prakhya
ers/firmware/efi/runtime-wrappers.c | 61 +++--- include/linux/efi.h | 42 ++ 5 files changed, 147 insertions(+), 44 deletions(-) Tested-by: Bhupesh Sharma Suggested-by: Matt Fleming Based-on-code-from: Ricardo Neri Signed-off-by: Sai Praneeth Prakhya Cc: Al Stone

[PATCH] x86: Use boot_cpu_has() instead of this_cpu_has() in build_cr3_noflush()

2018-04-04 Thread Sai Praneeth Prakhya
is is still work in progress as it effects MCE. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Reported-by: Linus Torvalds <torva...@linux-foundation.org> Cc: Lee Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l...@inte

[PATCH V2 3/3] efi: Use efi_rts_workqueue to invoke EFI Runtime Services

2018-03-05 Thread Sai Praneeth Prakhya
used unconditionally for all the efi_runtime_services() except set_variable<>() and query_variable_info<>() Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@a

[PATCH V2 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization

2018-03-05 Thread Sai Praneeth Prakhya
patch, this is the place where we create efi_rts_wq and all the efi_runtime_services() will be called using efi_rts_wq. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Pe

[PATCH V2 0/3] Use efi_rts_workqueue to invoke EFI Runtime Services

2018-03-05 Thread Sai Praneeth Prakhya
+), 27 deletions(-) Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> Cc: Lee, Chun-Yi <j...@suse.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Tony Luck <tony.l...@intel.com> Cc: Will Deacon <will.de

[PATCH V2 2/3] efi: Introduce efi_rts_workqueue and some infrastructure to invoke all efi_runtime_services()

2018-03-05 Thread Sai Praneeth Prakhya
nts. 2. An argument of efi_runtime_service() can be a value (of any type) or a pointer (of any type). Hence, efi_runtime_work has five void pointers to store these arguments. Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> Suggested-by: Andy Lutomirski <l...@kernel.org> C

  1   2   >