Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3725003imd; Mon, 29 Oct 2018 11:19:34 -0700 (PDT) X-Google-Smtp-Source: AJdET5cwf6GZkvMLRN1RX9jzGw7btOu01m/+aVtuwgAmRRYrkEf+hrnRQ6OxO5uXAYNq1FEB7TrP X-Received: by 2002:a63:9712:: with SMTP id n18-v6mr15127290pge.182.1540837174510; Mon, 29 Oct 2018 11:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540837174; cv=none; d=google.com; s=arc-20160816; b=krs/sjpFl/4KXw1lqKePdnyFyEPMT54taWeCeoE52x5Be0vLV8ke0sApxYfUpwJRtj AGf8zTdoQItgT3QEBC38HQPnJorVYL4eZuAYn6HBFklWazV6gRfLjTJR7ph3JbnxAg3x iOWfSsQS+vzVvtdHMexpx6bIq3Ni9hKNQA4k57iOVTOs2KyELKdfpQ9+XTHmwJ5BlwUU Vr8Yreb06Q89BoxwU+NLdSgLEgcNGAjhu+79RAwUyBDGyofHZy8MwIEg+VDsMRfxFAIL UMqLI/b9BxE596JNOltD30X3ALBAFbJyAfAAs/49iUizaz/r7H2vZJOg4hyo2FsS0oBR O1DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=g8/9qkQ6j2wLVep+YCjxEtuspjDh1TnrKk+WRBVy6zM=; b=aytoy4L/P0XutVtW0gcro45kTsBiP9jV7OYjN92ekfWVHPsQ7P3v2isxOlbjTL0M8/ Rt5totyMdS09CHCpE0H33CPzekU5WrsULhmxOJefSGV+N7hTJG9yVUEf/iVMBX8ll3IJ cWRrjb7IQ65Tzk028e2OgSGn64ZkGIgG95WdFLSnj+CqYQy8ji6ppriwtQzd/PI3NeIA uWIURpmCR4F/3fKmzhemQL/aZSMBHx/d9Dn4AzzoPwDCsr1G6FldrK+yKpdhiZlEoC5c uaRAlwL80q4eRMBWIOY3AWGY5VCf9BfhIXxZn0DhTL+veqO4JQT9uy7lx3xzhHVyz6lV jf5A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26-v6si3835608pfe.218.2018.10.29.11.19.19; Mon, 29 Oct 2018 11:19:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729280AbeJ3DIp (ORCPT + 99 others); Mon, 29 Oct 2018 23:08:45 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:52541 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729261AbeJ3DIo (ORCPT ); Mon, 29 Oct 2018 23:08:44 -0400 Received: from tmo-115-37.customers.d1-online.com ([80.187.115.37] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gHC7n-0000S3-Qk; Mon, 29 Oct 2018 19:18:52 +0100 Date: Mon, 29 Oct 2018 19:18:50 +0100 (CET) From: Thomas Gleixner To: "Prakhya, Sai Praneeth" 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 In-Reply-To: Message-ID: References: <20181026213845.28166-1-sai.praneeth.prakhya@intel.com> <20181026213845.28166-2-sai.praneeth.prakhya@intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sai, On Mon, 29 Oct 2018, Thomas Gleixner wrote: > On Mon, 29 Oct 2018, Prakhya, Sai Praneeth wrote: > > > 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] > > In general it's good to do on list because others can learn from the > answers as well. So you somehow managed to keep everyone and the lists in CC nevertheless. Did not pay attention to the CC list until I got my reply on the list :) > > > > > + 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 ?" > > __flush_tlb_all() flushes only the mapping on the current CPU. So in a SMP > environment it's not sufficient. > > > 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. > > I corrected myself. It's the other function which cannot use the proper > cpa_flush.*() functions. > > > 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. > > I'll have a second look at the whole thing and reply on list. So actually for the problem at hand __flush_tlb_all() works, because that is called way before the secondary CPUs are up. Ditto for kernel_map_pages_in_pgd(). But both functions want to be marked __init and aside of that they both should contain a warning when they are called after the secondary CPUs have been brought up. Thanks, tglx