Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp78469ybl; Tue, 27 Aug 2019 16:09:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvVeR4LJOL+AWli6MsgB3kyuD99M4bbjTd9au1CVTl6Krqug5M99nCKQqmbEXxOmDeHgM8 X-Received: by 2002:a17:902:b905:: with SMTP id bf5mr1274657plb.342.1566947375243; Tue, 27 Aug 2019 16:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566947375; cv=none; d=google.com; s=arc-20160816; b=oNJCWi6MXk4fdWqXrTsA8c475Kn4ly5Xe0cfGZoF0sR6TYP21hQonZcOXNdRTKrsvB X7tyu/LicV2S3NcDA6S0S/Vb4TvNo8YnQ05A+dHpxwIGUXKqpfiSeIaX9qLgUmUiSa10 Cw5zn3zsswVX0L6N8OenLwow/bG2lEXFaA0UAmbuunPHW/sbeYHZLOP8CDBiyRWMimyV ukKFy7U1IGlT6wk2z9dOU/HHNWSxcbzuaJSRa3/DU4iFD+8WqzQYM97lfPJu9CWWTCTu lU7rHa7mk6AfvP4GX/waF3c22AsIfioqepM03Cts91B2ZCuaIO+/V4eTnkXvF/1B5DG3 PoKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DoyixmxiMip9rliPOuEYv6cI/N0rhEgrR3/wPJ0nXys=; b=DkOemcTlLYkDE8P20dM328pPb+B1C2E2Gwa+/TXS7hP745XwZJsMgoF5DV20FxF4hA hYuEzoNsXGNGxPaggukEwZ6vN0bxzfzLkIRsyZ7o5sGYDH3nWHe399Xj3cWoA23Kx7HV Gk+5WxIbD/Cw1DSuX1RFqxljgqDOa6TzVHh2AvicsZ1ZjrwuXb7WTdw67nv7CoiEjA8e mllNJHjwWvRa+5tev0spo/Xb4E7JA41YnTaZjdHWrggOJwrw3ZEvr2Zg2O8c8fLhaEIY MUUR+pP4Tvd2dMGe4Hx7pGYjqdahJcaGOPeP2KBS7NyUPDgD4pYnMdxPpcvj+K1TaxoV qLqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Tt+XgRGC; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si625652pgh.416.2019.08.27.16.09.11; Tue, 27 Aug 2019 16:09:35 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Tt+XgRGC; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726264AbfH0XIK (ORCPT + 99 others); Tue, 27 Aug 2019 19:08:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:39806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbfH0XIK (ORCPT ); Tue, 27 Aug 2019 19:08:10 -0400 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3BA6422CF4 for ; Tue, 27 Aug 2019 23:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566947289; bh=esY6YjPvfKmvAp/kVRaTfdsUoSPjd12Fm5ETVPcKaGk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Tt+XgRGClLul3gO6DAKl61su1kaD7LBGAvpe/PWqJj0fKj/A4nEtdnEy04EQrIZON Vikvp1KrXf6b2A9nwhDzyZPu3y0xIgiA6xLH8wa2cWE6QmoUsyNfDDmmQumT74RxJ3 f3AAIyaQRLJqhx9DdluNTv3jNwK/FjOWe+f9HJp4= Received: by mail-wm1-f49.google.com with SMTP id o4so725923wmh.2 for ; Tue, 27 Aug 2019 16:08:09 -0700 (PDT) X-Gm-Message-State: APjAAAW7IChsUUgn2Hs0tH0gcvabIigsYJhmSMjXehZU9VoJp88ZY57o eQf/61VrOxr4nN18LEXxuy0dU/6h1wC67dXTfVX8rg== X-Received: by 2002:a05:600c:22d7:: with SMTP id 23mr915368wmg.0.1566947287673; Tue, 27 Aug 2019 16:08:07 -0700 (PDT) MIME-Version: 1.0 References: <20190823225248.15597-1-namit@vmware.com> <20190823225248.15597-4-namit@vmware.com> In-Reply-To: <20190823225248.15597-4-namit@vmware.com> From: Andy Lutomirski Date: Tue, 27 Aug 2019 16:07:55 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 3/3] x86/mm/tlb: Avoid deferring PTI flushes on shootdown To: Nadav Amit Cc: Andy Lutomirski , Dave Hansen , X86 ML , LKML , Peter Zijlstra , Thomas Gleixner , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 23, 2019 at 11:13 PM Nadav Amit wrote: > > When a shootdown is initiated, the initiating CPU has cycles to burn as > it waits for the responding CPUs to receive the IPI and acknowledge it. > In these cycles it is better to flush the user page-tables using > INVPCID, instead of deferring the TLB flush. > > The best way to figure out whether there are cycles to burn is arguably > to expose from the SMP layer when an acknowledgment is received. > However, this would break some abstractions. > > Instead, use a simpler solution: the initiating CPU of a TLB shootdown > would not defer PTI flushes. It is not always a win, relatively to > deferring user page-table flushes, but it prevents performance > regression. > > Signed-off-by: Nadav Amit > --- > arch/x86/include/asm/tlbflush.h | 1 + > arch/x86/mm/tlb.c | 10 +++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h > index da56aa3ccd07..066b3804f876 100644 > --- a/arch/x86/include/asm/tlbflush.h > +++ b/arch/x86/include/asm/tlbflush.h > @@ -573,6 +573,7 @@ struct flush_tlb_info { > unsigned int initiating_cpu; > u8 stride_shift; > u8 freed_tables; > + u8 shootdown; I find the name "shootdown" to be confusing. How about "more_than_one_cpu"?