Received: by 10.223.185.116 with SMTP id b49csp3215368wrg; Mon, 5 Mar 2018 16:44:56 -0800 (PST) X-Google-Smtp-Source: AG47ELvGSIaWUGDAgCe2MgJIPXa84sRwzWMOlqExETISg8cbH+rEqqW4VaA7W1rACl67LzqGwEMj X-Received: by 10.99.126.17 with SMTP id z17mr13620703pgc.218.1520297096357; Mon, 05 Mar 2018 16:44:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520297096; cv=none; d=google.com; s=arc-20160816; b=emrTh0W/LsoNaZbwv6zN8TPKIGSPMAQva64RdK8n1g4D2Ynp9yzu+OsOL3lbe7nDMv tregfMhd7FaOXSOkipYqx71bVOQhURa7KFUSQkLy6uNTXbreMoVdA3ODBpR6Yr8isJl5 hyEl6VGkAP4dYBoD8oBgcR+rdT4ZkDlqgX+BFp4Pu6M18ZRqYYz4fDX3ARq9LL/XJyif uwafl1qlodksXX8ej5U6bQW9yB6cwYUZhyL39+ZiDNgaigD2tfZnVQkqAaySzlTgYaMX +aygs4z5Xb0D/ERYcAsh34kHeiYnr8MEzkUcOLdPHHfV0ZQFoKj7GhIpnanhbtXaJqbj 5mHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=EYjdlQxWzFl+5jjhOI1n2TJyVOrQr3k1kaxdqSH0Mnc=; b=I5kPh5vpwdUse/BQ9jz3Rn0SvPdDxU0LSJvUoB3o/PF4gQlZVNPDRuVFS01XCO+xKs crA6ikxYHp+ydX6dGK4uj4EfOD9lW8ZwJ7BI+voTmW7hiXxOaNBqL0QoOvC4kww483td NxW8B6MtdoAtBpU/33FhlX/9p4PZS8Zni67LC28CO8CEGp/QMYiIxQvQQkfzUF1Iwfj0 Th3xYUPzGvjef606WN70Zjdz2dTrw6OUYzlDusszoknCQE1paVGub3D0LKUDkXhmOgVx UBpz+QHmQs3SnNJw13PJ1eleBq4jR7ODaevU+CFQ8sDMYnQeWIk1QQA2nQci4TZsjbx4 G8kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=u4qMecUA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7-v6si10190483pls.331.2018.03.05.16.44.42; Mon, 05 Mar 2018 16:44:56 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=u4qMecUA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933510AbeCFAli (ORCPT + 99 others); Mon, 5 Mar 2018 19:41:38 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:42558 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932773AbeCFA0F (ORCPT ); Mon, 5 Mar 2018 19:26:05 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260MTJl074262; Tue, 6 Mar 2018 00:26:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=EYjdlQxWzFl+5jjhOI1n2TJyVOrQr3k1kaxdqSH0Mnc=; b=u4qMecUACQoQ2/Wu2KZucwsk+MKUC19hN/DU0f6gxvG7yrcfM6NwrLXOlkktiWyRQAv8 bEcc88esE8gMVgfb8pv/QZzsudZB4sIB+2K9SNxNUX943Dl1TqbaPz2fppI8pGh2lABL 3PSmZH0USQpmgRfaVdDJmCfhl7vYjFBalDng2tE83NlxfkME9KHOz026QFnDwmDQ99Xn fE/1i69wJUVp+uvN371WP1RbsQJSPk8NCCJahSnjO34JGoiDVN3hzftmpzzP6KS/iwZs SYMfkXxHswa0F0OX25D+40EsZfTlSUhG9BqQrmUzX6879UaFvmRzLlpFZQyr+E0Ch0r7 vw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2ghe5xgeye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:25:59 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w260PwdN028756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:25:58 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w260Pwah032591; Tue, 6 Mar 2018 00:25:58 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:25:57 -0800 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, Alexander.Levin@microsoft.com, dan.j.williams@intel.com, sathyanarayanan.kuppuswamy@intel.com, pankaj.laxminarayan.bharadiya@intel.com, akuster@mvista.com, cminyard@mvista.com, pasha.tatashin@oracle.com, gregkh@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH 4.1 02/65] x86/mm: Fix INVPCID asm constraint Date: Mon, 5 Mar 2018 19:24:35 -0500 Message-Id: <20180306002538.1761-3-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306002538.1761-1-pasha.tatashin@oracle.com> References: <20180306002538.1761-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060003 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov commit e2c7698cd61f11d4077fdb28148b2d31b82ac848 upstream. So we want to specify the dependency on both @pcid and @addr so that the compiler doesn't reorder accesses to them *before* the TLB flush. But for that to work, we need to express this properly in the inline asm and deref the whole desc array, not the pointer to it. See clwb() for an example. This fixes the build error on 32-bit: arch/x86/include/asm/tlbflush.h: In function __invpcid arch/x86/include/asm/tlbflush.h:26:18: error: memory input 0 is not directly addressable which gcc4.7 caught but 5.x didn't. Which is strange. :-\ Signed-off-by: Borislav Petkov Cc: Andrew Morton Cc: Andrey Ryabinin Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Luis R. Rodriguez Cc: Michael Matz Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Toshi Kani Cc: linux-mm@kvack.org Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 04ec428b15f161ce8449756fb64b6f380c8d95fd) Signed-off-by: Pavel Tatashin --- arch/x86/include/asm/tlbflush.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 995937999e1f..ed2317f19ec7 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -10,7 +10,7 @@ static inline void __invpcid(unsigned long pcid, unsigned long addr, unsigned long type) { - u64 desc[2] = { pcid, addr }; + struct { u64 d[2]; } desc = { { pcid, addr } }; /* * The memory clobber is because the whole point is to invalidate @@ -22,7 +22,7 @@ static inline void __invpcid(unsigned long pcid, unsigned long addr, * invpcid (%rcx), %rax in long mode. */ asm volatile (".byte 0x66, 0x0f, 0x38, 0x82, 0x01" - : : "m" (desc), "a" (type), "c" (desc) : "memory"); + : : "m" (desc), "a" (type), "c" (&desc) : "memory"); } #define INVPCID_TYPE_INDIV_ADDR 0 -- 2.16.2