Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1188756ybb; Fri, 20 Mar 2020 15:12:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsijxqTuzAtlZc57BP9hiaRvTKCE/7m1vqNnY9cA09cYiKTK8f5wm0k23zaK5aZ6DFBrvHR X-Received: by 2002:aca:5508:: with SMTP id j8mr8664095oib.71.1584742365990; Fri, 20 Mar 2020 15:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584742365; cv=none; d=google.com; s=arc-20160816; b=f8ij62fhm90RP+WqImxA+Av1LXMZlS55/0MeekDwWVtRvl14iHyFdLXnjgls1gN9xO D4u2GVkB4cPDP2owxxywPcuKX0ocF8A6ooGiRUNZ1170B+Q/dOgAcgqRyAW4qlp7hkVE 1H7a/1SzzzaZntvM2jjOFf5N4idPzPv1/KZd4pOJ2vZ1a8BYjPHnSyd4L+TgFkcX9ery hGk1ZyYpFjSbVjZi/Tv+HEtSTc6Y5sw7yis6ns9znMw8VNN5++rHWsvJ3X2pCou2G/LP 0MPdc8ac3TcuTKvJ2N2cfMZZbVby5wdoSIidmkimyVslB1V2eSQsjJcfjnXi474pxQle y/Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OMHni43yQ3jtIp+EWODPD6yLIKM0bpiCP+448w5P0Po=; b=aIKEgEmpORM2kmxCbQIMQjU+i817EP30qECRamiuSWT+XvWaNZgcNOt684eS2n2b8W Gi/Wrivfnu+a3EhEzCfB1FWM8ChiCivav+5iM3HT9xH8jkRGPJeiHnmXC6s6ZdkQMyUI arfbvSazTRkB9jTTMRfW64K4qt84ya3LLpB8+mIadfOe0mdaMW3CCV3Wmsu+jiWw0wj4 wNpO+A/WKdxvUuUjX6CnM9vpKPNOI58Lb6q/99jSJtM07kptidA1OAfMLLEH0LaRBKh7 fUuREqjUVNESE1VBpjcxVuoA2hXuzMDex1jO5mTOVbv5wyWdUmjE3VrI2r5z0FA417rt mc+A== 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=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17si3417408otr.109.2020.03.20.15.12.32; Fri, 20 Mar 2020 15:12:45 -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=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727269AbgCTWMQ (ORCPT + 99 others); Fri, 20 Mar 2020 18:12:16 -0400 Received: from 8bytes.org ([81.169.241.247]:54690 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726840AbgCTWMQ (ORCPT ); Fri, 20 Mar 2020 18:12:16 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id C15F24CA; Fri, 20 Mar 2020 23:12:14 +0100 (CET) Date: Fri, 20 Mar 2020 23:12:13 +0100 From: Joerg Roedel To: Dave Hansen Cc: David Rientjes , x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: Re: [PATCH 21/70] x86/boot/compressed/64: Add function to map a page unencrypted Message-ID: <20200320221213.GK5122@8bytes.org> References: <20200319091407.1481-1-joro@8bytes.org> <20200319091407.1481-22-joro@8bytes.org> <8a50c19f-aaf8-90bd-a415-0e3b71e5a010@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8a50c19f-aaf8-90bd-a415-0e3b71e5a010@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 20, 2020 at 02:02:13PM -0700, Dave Hansen wrote: > It *never* flushes global pages. For a generic function like this, that > seems pretty dangerous because the PTEs it goes after could quite easily > be Global. It's also not _obviously_ correct if PCIDs are in play > (which I don't think they are on AMD). > > A flush_tlb_global() is probably more appropriate. Better yet, is there > a reason not to use flush_tlb_kernel_range()? I don't think it's > necessary to whack the entire TLB for one PTE set. This code runs before the actual kernel image is decompressed, so there is no PCID and no global pages (I think CR4.PGE is still 0). So a cr3-write is enough to flush the TLB. Also the TLB-flush helpers of the running kernel are not available here. Regards, Joerg