From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751732AbeAZVQr (ORCPT ); Fri, 26 Jan 2018 16:16:47 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:52691 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257AbeAZVQp (ORCPT ); Fri, 26 Jan 2018 16:16:45 -0500 X-Google-Smtp-Source: AH8x226axBmf2UnksJKBDfDfSmjkdyDzBwAhGwsbl1qGryWwfWTHA66AzR+UP7bqy7P7It5mphEs8Q== Date: Fri, 26 Jan 2018 21:16:43 +0000 From: Matt Fleming To: Sai Praneeth Prakhya Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" , Borislav Petkov , Tony Luck , Andy Lutomirski , "Michael S. Tsirkin" , Ricardo Neri , Ard Biesheuvel , Ravi Shankar Subject: Re: [PATCH V4 0/3] Use mm_struct and switch_mm() instead of manually Message-ID: <20180126211643.GB6520@codeblueprint.co.uk> References: <1516309264-23926-1-git-send-email-sai.praneeth.prakhya@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516309264-23926-1-git-send-email-sai.praneeth.prakhya@intel.com> User-Agent: Mutt/1.5.24+42 (6e565710a064) (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Jan, at 01:01:04PM, Sai Praneeth Prakhya wrote: > 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 code path typically involves read_cr3() (save efi_pgd), > write_cr3() (write previous pgd). We do this couple of times in efi > subsystem of Linux kernel, instead we can use helper function > efi_switch_mm() to do this. This improves readability and maintainability. > Also, instead of maintaining a separate struct "efi_scratch" to store/restore > efi_pgd, we can use mm_struct to do this. FWIW this series looks OK to me. Reviewed-by: Matt Fleming