Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4776870imm; Sun, 26 Aug 2018 03:29:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYo6LnzseOB21ib53MPkODNVXXTo4SkKvq5ELzPTrBQ6FeKKndpC6lSoxR6hBx+vcEzgki6 X-Received: by 2002:a62:959a:: with SMTP id c26-v6mr9313115pfk.234.1535279351936; Sun, 26 Aug 2018 03:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535279351; cv=none; d=google.com; s=arc-20160816; b=sOfHbpPmqmXhnc5OBPDE3Y7IB/CZ5xJznX+vNAaQW2i9c3nr4BLgImW1//DCaaC7zx V13NOEn2x0vS01HY0i+hXzgoV7vrOpTY+rbqelA+V0cKrX3dN/Plk2K4ATsysNWG7hsg LA+vlROGHgYd41sK/m0P8aYTw4kjEfSe7zTfpt1mmYVErEb5KAV4g0Ftug6377LRqCjL ovI3uNOUTxd0xcUv3/Q8jMQXrE3qCb2rf6Kp9Uxs0O+p3C0xD1OhToCr11l7EPlDA4Qu yw8ym/oOmL3fgbQYQUNrOTdCIP2qFUrOK3Bu5yPxeFTh9I/Dgz/V85tVT+q8gf0Hn688 MwRg== 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 :arc-authentication-results; bh=bcjVjjNbd8Es6sV7J1xu3Fai6APCp+ej+gAR1K1z+cI=; b=tdBCJbqpiMP7YXQHCbCiymp8j7Y/NeolCeukAH17v1J6JjwxmbO5/b0vzRoKbYj5oh bQRRcCIpeppyFgKNcfHahP4cW/HbDyFqFPSZcvO1ObiXvHIVv6dL2siiijf6oTAEx+Ly ahiZFwspWN6a3yBzvfKiPCjQzdEE8w3PYK5XPVzt1PYGnf2pv67fit0bZTt6HA38WiHY 7dj8NTZauxG1QS+hdgIhZD4fO4kTZBZIyhBf/SdkvCBwqrH1Pu3KosY0o/Y3aDGq/pBh 4FF93W0mrRmdz1T61VU919Dygv7Hz3p6Xry2OXlm1RhL7phmKositQJ3DKq/pwl+Rd+A ZFHQ== 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 b89-v6si8997408plb.273.2018.08.26.03.28.23; Sun, 26 Aug 2018 03:29:11 -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 S1726771AbeHZOHe (ORCPT + 99 others); Sun, 26 Aug 2018 10:07:34 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:41679 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbeHZOHe (ORCPT ); Sun, 26 Aug 2018 10:07:34 -0400 Received: from p4fea45ac.dip0.t-ipconnect.de ([79.234.69.172] helo=[192.168.0.145]) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1ftsER-000384-HF; Sun, 26 Aug 2018 12:25:19 +0200 Date: Sun, 26 Aug 2018 12:25:09 +0200 (CEST) From: Thomas Gleixner To: Juergen Gross cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org, boris.ostrovsky@oracle.com, hpa@zytor.com, mingo@redhat.com Subject: Re: [PATCH v2 2/2] x86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear In-Reply-To: <20180821153755.30462-3-jgross@suse.com> Message-ID: References: <20180821153755.30462-1-jgross@suse.com> <20180821153755.30462-3-jgross@suse.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 On Tue, 21 Aug 2018, Juergen Gross wrote: > Using only 32-bit writes for the pte will result in an intermediate > L1TF vulnerable PTE. When running as a Xen PV guest this will at once > switch the guest to shadow mode resulting in a loss of performance. > > Use arch_atomic64_xchg() instead which will perform the requested > operation atomically with all 64 bits. > > Some performance considerations according to: > > https://software.intel.com/sites/default/files/managed/ad/dc/Intel-Xeon-Scalable-Processor-throughput-latency.pdf > > The main number should be the latency, as there is no tight loop around > native_ptep_get_and_clear(). > > "lock cmpxchg8b" has a latency of 20 cycles, while "lock xchg" (with a > memory operand) isn't mentioned in that document. "lock xadd" (with xadd > having 3 cycles less latency than xchg) has a latency of 11, so we can > assume a latency of 14 for "lock xchg". > > Signed-off-by: Juergen Gross Reviewed-by: Thomas Gleixner