Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp646730imj; Thu, 7 Feb 2019 09:38:32 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ5MkjxpIPewWuCNivhr0ByrPt+a37gOdb8fDMzYgi/dW24O/oYanZ9bmPRVdENQi3kzCZa X-Received: by 2002:a63:a41:: with SMTP id z1mr11088351pgk.117.1549561112833; Thu, 07 Feb 2019 09:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549561112; cv=none; d=google.com; s=arc-20160816; b=nxPb0h8oGXWiVqwvKI9xsirFsGKA8XAw48JKV7In8Mjo9yaZwLzbUoxGDsZS5fnTrp RHRB5GRpeBGAptQlWr3+tJz3AlhvqbPQUEvPHjxUYS5SC5jx8ctZg5BW4tb/6P/uZrGQ M79QIzzT6uR4DVzoGk88Ozr3ur/CL+mAHeSAaVt3Um1QpERt3XskMrgH3h5W8fbHR8bu 3ro5x5bQLdAzWBdBRPS6o3UfyXzI5HsE3QK9igpCmN/XHuWKjAYtNvgAhpsmkhxDeudM jGFzQ68X6dABeEBJBqJHAZSi/9ZT2E9KvDDquGgtD0fcB9Or0lFKggwsasyLkZ2WWXtN 1GBQ== 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=NzYuHHZ4JSCmGKqVMxR4AcLG23rVitKfIMKO9jeXQ3o=; b=t6YtHFTJxQqidWTXFzAX75zHbvDX14Ut+yhP9ey29XVYT+pEEVFKO+Xpy3Uq36/grX JNmaAig/5yXWzidknQNSJvR+tXd0zWwzc5PyOpBggKi0DIEvT6M4TBrkDhw31+C8hXyh iH2ZU+bZWXwp0otZXGwyk9ZnHRJvLoXWjwumSw3ms9uMUZfMfJGxKuwupTcgbX3Buoq7 LQWFSxtfI7yXgEuqAL4fY9r9cwlrsKRiso5l9B9IIJUNMSh7pP6Sn1GaG25Lo4IDAyEq fU3NJBgA0v5+rGIBV/4tA+xirVTenTz0NF6sXO/xwUrUjb73Mp+1Kwu+zuhFvbn/lZKi 0maw== 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 bg7si9314574plb.149.2019.02.07.09.38.16; Thu, 07 Feb 2019 09:38:32 -0800 (PST) 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 S1726941AbfBGRgB (ORCPT + 99 others); Thu, 7 Feb 2019 12:36:01 -0500 Received: from mga12.intel.com ([192.55.52.136]:2626 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbfBGRgB (ORCPT ); Thu, 7 Feb 2019 12:36:01 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2019 09:36:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,344,1544515200"; d="scan'208";a="141533042" Received: from agluck-desk.sc.intel.com (HELO agluck-desk) ([10.3.52.160]) by fmsmga002.fm.intel.com with ESMTP; 07 Feb 2019 09:35:59 -0800 Date: Thu, 7 Feb 2019 09:36:00 -0800 From: "Luck, Tony" To: Peter Zijlstra Cc: Linus Torvalds , Dan Williams , Ingo Molnar , Linux List Kernel Mailing , Dave Hansen , Andy Lutomirski , Borislav Petkov , Thomas Gleixner , Rik van Riel Subject: Re: [GIT PULL] x86/mm changes for v4.21 Message-ID: <20190207173600.GA15682@agluck-desk> References: <20181224231106.GA27438@gmail.com> <20190207001737.GA32096@agluck-desk> <20190207101846.GB32511@hirez.programming.kicks-ass.net> <20190207140131.GB32477@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190207140131.GB32477@hirez.programming.kicks-ass.net> 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 Thu, Feb 07, 2019 at 03:01:31PM +0100, Peter Zijlstra wrote: > On Thu, Feb 07, 2019 at 11:50:52AM +0000, Linus Torvalds wrote: > > If you re-generate the canonical address in __cpa_addr(), now we'll > > actually have the real virtual address around for a lot of code-paths > > (pte lookup etc), which was what people wanted to avoid in the first > > place. > > Note that it's an 'unsigned long' address, not an actual pointer, and > (afaict) non of the code paths use it as a pointer. This _should_ avoid > the CPU from following said pointer and doing a deref on it. The type doesn't matter. You want to avoid having the true value in the register as long as possible. Ideal spot would be the instruction before the TLB is flushed. The speculative issue is that any branch you encounter while you have the address in a register may be mispredicted. You might also get a bogus hit in the branch target cache and speculatively jump into the weeds. While there you could find an instruction that loads using that register, and even though it is speculative and the instruction won't retire, a machine check log will be created in a bank (no machine check is signalled). Once the TLB is updated, you are safe. A speculative access to an uncached address will not load or log anything. -Tony