From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AB3CC433E0 for ; Tue, 30 Jun 2020 12:52:20 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BCD22068F for ; Tue, 30 Jun 2020 12:52:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pvVxXlQZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BCD22068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jqFk9-0002Aj-6e; Tue, 30 Jun 2020 12:52:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jqFk7-0002Aa-M0 for xen-devel@lists.xenproject.org; Tue, 30 Jun 2020 12:52:07 +0000 X-Inumbo-ID: 80d19c3a-bad0-11ea-bb8b-bc764e2007e4 Received: from mail-ed1-x543.google.com (unknown [2a00:1450:4864:20::543]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 80d19c3a-bad0-11ea-bb8b-bc764e2007e4; Tue, 30 Jun 2020 12:52:07 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id d15so16046682edm.10 for ; Tue, 30 Jun 2020 05:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:thread-index :content-language; bh=3gN6LhDZ3WO6b+v/EAtB65ovPUJ5OfHHriG5/WGDqaI=; b=pvVxXlQZy7X4EJVdzbjqo3BIRxt6u29gGnuOO/VTKYY2G83axV0OzfN9FXfO5Uc+eE zLGPBPO8Ml8WC1y7aejwbzilb50BmrLAQd8Q+BqF9sVrohi8OAvnCRMoIE8Rf8goLS08 0N2Zk38utjgxxzn5EoghB7eJPHuyt6cmIxKQPYb/4kBgxGIeOyFxAdAuqCasmi2EV2Vj h4PoSnYNNKgF28TJSzVC9OwP4EMdHtDLwUv2V6sPuEMGhncglH6poFdzylpdH6dzOiJC z5Vp5cikBbUWCalfzLhTYrR2FI2DSAP2cLq2s3bd6Sq1Bgrb5uwV+xPmnF+7Muf/cIgo pTSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to :subject:date:message-id:mime-version:content-transfer-encoding :thread-index:content-language; bh=3gN6LhDZ3WO6b+v/EAtB65ovPUJ5OfHHriG5/WGDqaI=; b=JJodXoJ/MenPBaJgyMiAcFQt4AwaOT2lFpfBCIsNlCzfOq/BH0wFlJQ+PJ0phIBZlT TvwNT2bwBVlohxpngWsvPnR83tCvYmdm2H30Cqiy5BhGqO2pofGj5wVijXytr/sHl12c 49+Hhcq0KTbD0pJzI5jBF1tst/5ryXr93TFR39gX3ZLTdqR+4DxspysZBd2TU8cnZBFN 1gZXMlTtthWW6DnkAOVJGJ1OyK2aLMphfh+1/WXDbjYjtqGWpcNt2VUQw8pnNcxsB6d1 Kacu56AfL3GWewhJXiRkzCjrK0xHRoL0Wpbgb81MQEi7Mpd/xJ4TjFDWtZtuPhinfb/e 3l+A== X-Gm-Message-State: AOAM531bPMPuYOglpG9kZIBa/ur5mWvH8f7c9w9ISPMKbAJ7dm/9L08w slNoeVDOviqje89PiypPZY8= X-Google-Smtp-Source: ABdhPJwDX5d7ICGG+Ej8J7zNh0awLsjM3HqQWK3MzQtsZ6k8NXYYtE3xXXRRAMosSEm3Z6yf1O8oZA== X-Received: by 2002:a50:8143:: with SMTP id 61mr23160507edc.202.1593521526254; Tue, 30 Jun 2020 05:52:06 -0700 (PDT) Received: from CBGR90WXYV0 (54-240-197-238.amazon.com. [54.240.197.238]) by smtp.gmail.com with ESMTPSA id h2sm2753569edk.54.2020.06.30.05.52.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2020 05:52:05 -0700 (PDT) From: Paul Durrant X-Google-Original-From: "Paul Durrant" To: "'Julien Grall'" , "'Roger Pau Monne'" , References: <20200626155723.91558-1-roger.pau@citrix.com> In-Reply-To: Subject: RE: [PATCH for-4.14 v4] x86/tlb: fix assisted flush usage Date: Tue, 30 Jun 2020 13:52:04 +0100 Message-ID: <000301d64edd$41fa4cf0$c5eee6d0$@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQEPrqt6NsU03o2hOfg+V497vZFhIwIMPTDRqm37HcA= Content-Language: en-gb X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Reply-To: paul@xen.org Cc: 'Stefano Stabellini' , 'Wei Liu' , 'Andrew Cooper' , 'Ian Jackson' , 'George Dunlap' , 'Jan Beulich' , 'Volodymyr Babchuk' Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" > -----Original Message----- > From: Julien Grall > Sent: 30 June 2020 13:48 > To: Roger Pau Monne ; = xen-devel@lists.xenproject.org > Cc: paul@xen.org; Stefano Stabellini ; = Volodymyr Babchuk > ; Andrew Cooper = ; George Dunlap > ; Ian Jackson ; = Jan Beulich ; > Wei Liu > Subject: Re: [PATCH for-4.14 v4] x86/tlb: fix assisted flush usage >=20 > Hi Roger, >=20 > On 26/06/2020 16:57, Roger Pau Monne wrote: > > Commit e9aca9470ed86 introduced a regression when avoiding sending > > IPIs for certain flush operations. Xen page fault handler > > (spurious_page_fault) relies on blocking interrupts in order to > > prevent handling TLB flush IPIs and thus preventing other CPUs from > > removing page tables pages. Switching to assisted flushing avoided = such > > IPIs, and thus can result in pages belonging to the page tables = being > > removed (and possibly re-used) while __page_fault_type is being > > executed. > > > > Force some of the TLB flushes to use IPIs, thus avoiding the = assisted > > TLB flush. Those selected flushes are the page type change (when > > switching from a page table type to a different one, ie: a page that > > has been removed as a page table) and page allocation. This sadly = has > > a negative performance impact on the pvshim, as less assisted = flushes > > can be used. Note the flush in grant-table code is also switched to > > use an IPI even when not strictly needed. This is done so that a > > common arch_flush_tlb_mask can be introduced and always used in = common > > code. > > > > Introduce a new flag (FLUSH_FORCE_IPI) and helper to force a TLB = flush > > using an IPI (flush_tlb_mask_sync, x86 only). Note that the flag is > > only meaningfully defined when the hypervisor supports PV or shadow > > paging mode, as otherwise hardware assisted paging domains are in > > charge of their page tables and won't share page tables with Xen, = thus > > not influencing the result of page walks performed by the spurious > > fault handler. > > > > Just passing this new flag when calling flush_area_mask prevents the > > usage of the assisted flush without any other side effects. > > > > Note the flag is not defined on Arm. > > > > Fixes: e9aca9470ed86 ('x86/tlb: use Xen L0 assisted TLB flush when = available') > > Reported-by: Andrew Cooper > > Signed-off-by: Roger Pau Monn=C3=A9 >=20 > Acked-by: Julien Grall >=20 And... Release-acked-by: Paul Durrant