Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3704744imd; Mon, 29 Oct 2018 11:02:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5dbodY8JRcAMMpnKG3eKTWFubhKNBBd1YzzxS29njCWWYnRyeeDU+BUGdBWUYZ4VkYrST3I X-Received: by 2002:a63:5705:: with SMTP id l5mr121723pgb.118.1540836145708; Mon, 29 Oct 2018 11:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540836145; cv=none; d=google.com; s=arc-20160816; b=o8YBtFqQlzFMf/n+TxMYHr+QC9vbK7ImfEp+LJycIKYXl3+Uqd6SzJH/K+iEx7EMo2 dDe0gf08es0CKSIsh9Yiq8ntr7U1hipwL9xvujH5m6SZCiS+jjNICRQckzaMzNP1iCBh SDKCLUVOu8yWI5efj41RoSAgMkZlFfLqBuHhdU8vSYyU8o3RcNSqHo74sirVGjySsbzD nGZ+A8QsedCHVDFWKD0EI2dZFse3Obs9qoI+1SNgtBNjK/knSBSaOKjKUfMEpBb1O10c xql9lrlt59h5kPAEFEiCLupRR4l47iqogobKO3C9JchAjBguPZYznxV0RBEj+lZTkJPy vtYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=TNn3I6jw5HTWw13XDuJzze/4EcgR5Sj5+gj/PhDfrqE=; b=bEfL7op4ZRw6Ai6Prc2ZDmTHByxbA2sS1CvZQpRturfOGHoekLANrVT2dT2t7HPM3C XZPggX6bcr6joMsXz+YT6QDOR6u7ZulGOIwaGJn59jm9+q3v0K9hN1GfHBwjsKQk2Ogv D9uCecyMjoCWjKlQqYSCiV93C3UQIdeANAtQWEsLDWzqwwsYskvpeS5iVVCCcEm5JaIV D2YFRaw/kpthRr6oab+V8hZkGIVHEaj611at1nfSD1Y/a8NOVTpDUbInshaDj1ZykXjp GiXKk8nCns+7DBtzkP5Ip4hbYw1+nqz19WbcMhQpLA496OI392vOPlwHz6QvbRtQ7A/l 3S2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4-v6si21678707pff.140.2018.10.29.11.02.10; Mon, 29 Oct 2018 11:02:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728283AbeJ3CvK convert rfc822-to-8bit (ORCPT + 99 others); Mon, 29 Oct 2018 22:51:10 -0400 Received: from mga05.intel.com ([192.55.52.43]:28052 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727772AbeJ3CvK (ORCPT ); Mon, 29 Oct 2018 22:51:10 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2018 11:01:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,441,1534834800"; d="scan'208";a="99735193" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga002.fm.intel.com with ESMTP; 29 Oct 2018 11:01:28 -0700 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.128]) by ORSMSX103.amr.corp.intel.com ([169.254.5.166]) with mapi id 14.03.0415.000; Mon, 29 Oct 2018 11:01:28 -0700 From: "Prakhya, Sai Praneeth" To: Thomas Gleixner CC: "linux-efi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , Borislav Petkov , "Ingo Molnar" , Andy Lutomirski , "Hansen, Dave" , Bhupesh Sharma , Peter Zijlstra , Ard Biesheuvel Subject: RE: [PATCH V2 1/2] x86/efi: Unmap EFI boot services code/data regions from efi_pgd Thread-Topic: [PATCH V2 1/2] x86/efi: Unmap EFI boot services code/data regions from efi_pgd Thread-Index: AQHUbXSDlG5yxQFZuUKIGr9tlrL5CKU27+KAgAACRID//5GH4A== Date: Mon, 29 Oct 2018 18:01:27 +0000 Message-ID: References: <20181026213845.28166-1-sai.praneeth.prakhya@intel.com> <20181026213845.28166-2-sai.praneeth.prakhya@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzU5ZWQ3ZWMtODczMC00YWRiLWE0ZjYtM2JmODU0NGY0ZGY3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaG1DRW9NRDRNQzQ3UnhyY2gyYk1uTmh6QU9SZUY3dXNIeFJrbTFHOFwvWXdHU2FpbmZ3RjViNXZGQjVXWFRGUTEifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.22.254.140] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas and Peter, [off the mailing list because I wasn't sure if it's a good idea to spam others with my questions] > > > + /* > > > + * The typical sequence for unmapping is to find a pte through > > > + * lookup_address_in_pgd() (ideally, it should never return NULL > because > > > + * the address is already mapped) and change it's protections. > > > + * As pfn is the *target* of a mapping, it's not useful while unmapping. > > > + */ > > > + struct cpa_data cpa = { > > > + .vaddr = &address, > > > + .pgd = pgd, > > > + .numpages = numpages, > > > + .mask_set = __pgprot(0), > > > + .mask_clr = __pgprot(_PAGE_PRESENT | _PAGE_RW), > > > + .flags = 0, > > > + }; > > > + > > > + retval = __change_page_attr_set_clr(&cpa, 0); > > > + __flush_tlb_all(); > > > > So this looks like you copied it from kernel_map_pages_in_pgd() which > > has been discussed before to be not sufficient, but it can't be > > changed right now due to locking issues. > > Managed to confuse myself. The place which cannot be changed is a different > one, but still for your call site __flush_tlb_all() might not be sufficient. Since the mappings are changed, I thought a flush_tlb() might be needed. But, (to be honest), I don't completely understand the x86/mm code. So, could you please elaborate the issue more for my better understanding? So some questions I have are, 1. What did Peter Z mean here? "How is that not a TLB invalidation bug ?" 2. I assumed kernel_map_pages_in_pgd() to be a good code but you said that it has some locking issues. So, could you please elaborate more on that. Or, could you please provide me some pointers in the source code that I can take a look at so that I could understand the issue much better. Regards, Sai