From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752156AbdHKBPX (ORCPT ); Thu, 10 Aug 2017 21:15:23 -0400 Received: from mail-by2nam01on0091.outbound.protection.outlook.com ([104.47.34.91]:4128 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751469AbdHKBPV (ORCPT ); Thu, 10 Aug 2017 21:15:21 -0400 From: Jork Loeser To: Peter Zijlstra CC: KY Srinivasan , Simon Xiao , Haiyang Zhang , Stephen Hemminger , "torvalds@linux-foundation.org" , "luto@kernel.org" , "hpa@zytor.com" , "vkuznets@redhat.com" , "linux-kernel@vger.kernel.org" , "rostedt@goodmis.org" , "andy.shevchenko@gmail.com" , "tglx@linutronix.de" , "mingo@kernel.org" , "linux-tip-commits@vger.kernel.org" Subject: RE: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Thread-Topic: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Thread-Index: AQHTEgYxsK2uGstlkkue6l5rqOBtoqJ98McAgAAAr4CAAAHF0IAABjAAgABTKHA= Date: Fri, 11 Aug 2017 01:15:18 +0000 Message-ID: References: <20170802160921.21791-8-vkuznets@redhat.com> <20170810185646.GI6524@worktop.programming.kicks-ass.net> <20170810192742.GJ6524@worktop.programming.kicks-ass.net> In-Reply-To: <20170810192742.GJ6524@worktop.programming.kicks-ass.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Ref=https://api.informationprotection.azure.com/api/72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=jloeser@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-08-10T18:15:16.3236861-07:00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [50.125.164.196] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR21MB0151;6:gQGGF9xjyWsu0OQRZPRr1rLXUNO9ohuYZVRFDOo+ZcvGlQq3pvDGkQatfe0oCiN5tmJbpTdhSv4a+Vi9BSQuXYjdYDyg2VzRpwEDqI7HaOv7tVw2J62DlZfKjmQ5AmaAKrrdvGGuTaO9+btf1A5QNrP8KY5+5rsxMO4KBcERkDkFZvZ48fF9NzKA7CEoudik3+1VbuWeD3ZOX1fRVmbKKWlO9gd18BntJjFhVyr9EgF+VSrU7iiwQRIoFJJG361lOYihd/VXhZV3cW/NxO7n7ErhFce+h+dP+hvTUhdcFjRFogVo3ZgSzyDe657/doGzISoQ1eYoXC7fLvxgS6hpzA==;5:wrscxGKb4sbCbtBEN1EW5mU7UxNdmY6M2KlEmcQ92hMvbT7P5XVEHMEeeU15RcY/9+5WFcQncaSMtsrSfpVTtYRaD24dHb/ByKWBSfp3onKLbZiPdzuhlBTIF6qX91W9F6FMgV0vEDMIBzDEvlFkjA==;24:1a2F7vTacpR7Uwnpu9FgNC/60OtnVZoNFUeRWCrdKECWSM9g9tNICDwZDYfkh3YKTNbK76/Bzg4Aa2Apol2DW8Nw55yha9Jisvsi+mvkEfI=;7:17AVzxh22oZqj83jbMQexHTDN4lCMVFeJPYKJDThiVKgMiM+xDupUJGWX+Z8oJ0wZINKqgQKJxLzT6muo2G6/UhV5c5n5pYGmG5cjDM+iAYt6DghiyxfcBoTCVgoIXldecnlp59Xbf1VzxupgWkWJbYS+X+nIkgvXNPf1OJb6beAvM6q/u5JNbDXEKViHtjTVsfogK+k8Mw4aHoTH77GtWt7MHZYRIaGlePMEcQC/Fg= x-ms-office365-filtering-correlation-id: 03c8786b-5361-4d15-e3a3-08d4e0566e32 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603135)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY4PR21MB0151; x-ms-traffictypediagnostic: CY4PR21MB0151: x-exchange-antispam-report-test: UriScan:(89211679590171)(9452136761055); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123558100)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR21MB0151;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR21MB0151; x-forefront-prvs: 03965EFC76 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(47760400005)(189002)(13464003)(199003)(39060400002)(53546010)(189998001)(74316002)(106356001)(72206003)(478600001)(105586002)(2950100002)(68736007)(10290500003)(9686003)(6916009)(25786009)(6116002)(99286003)(55016002)(305945005)(7416002)(14454004)(5660300001)(7736002)(3846002)(102836003)(54906002)(6436002)(3280700002)(54356999)(76176999)(50986999)(53936002)(101416001)(7696004)(3660700001)(6506006)(2900100001)(86612001)(86362001)(5005710100001)(8676002)(110136004)(66066001)(4326008)(97736004)(8990500004)(93886004)(6246003)(10090500001)(2906002)(229853002)(8936002)(81156014)(81166006)(33656002)(77096006);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0151;H:CY4PR21MB0631.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jork.Loeser@microsoft.com; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Aug 2017 01:15:18.5158 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0151 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v7B1FTZU028849 > -----Original Message----- > From: Peter Zijlstra [mailto:peterz@infradead.org] > Sent: Thursday, August 10, 2017 12:28 > To: Jork Loeser > Cc: KY Srinivasan ; Simon Xiao ; > Haiyang Zhang ; Stephen Hemminger > ; torvalds@linux-foundation.org; luto@kernel.org; > hpa@zytor.com; vkuznets@redhat.com; linux-kernel@vger.kernel.org; > rostedt@goodmis.org; andy.shevchenko@gmail.com; tglx@linutronix.de; > mingo@kernel.org; linux-tip-commits@vger.kernel.org > Subject: Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush > > > > Hold on.. if we don't IPI for TLB invalidation. What serializes > > > > our software page table walkers like fast_gup() ? > > > > > > Hypervisor may implement this functionality via an IPI. > > > > > > K. Y > > > > HvFlushVirtualAddressList() states: > > This call guarantees that by the time control returns back to the > > caller, the observable effects of all flushes on the specified virtual > > processors have occurred. > > > > HvFlushVirtualAddressListEx() refers to HvFlushVirtualAddressList() as adding > sparse target VP lists. > > > > Is this enough of a guarantee, or do you see other races? > > That's nowhere near enough. We need the remote CPU to have completed any > guest IF section that was in progress at the time of the call. > > So if a host IPI can interrupt a guest while the guest has IF cleared, and we then > process the host IPI -- clear the TLBs -- before resuming the guest, which still has > IF cleared, we've got a problem. > > Because at that point, our software page-table walker, that relies on IF being > clear to guarantee the page-tables exist, because it holds off the TLB invalidate > and thereby the freeing of the pages, gets its pages ripped out from under it. I see, IF is used as a locking mechanism for the pages. Would CONFIG_HAVE_RCU_TABLE_FREE be an option for x86? There are caveats (statically enabled, RCU for page-free), yet if the resulting perf is still a gain it would be worthwhile for Hyper-V targeted kernels. Regards, Jork