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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 6C4B5C433DF for ; Tue, 19 May 2020 07:55:54 +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 3EC89206D4 for ; Tue, 19 May 2020 07:55:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EC89206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.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 1jax6E-0000aX-En; Tue, 19 May 2020 07:55:42 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jax6D-0000aS-BV for xen-devel@lists.xenproject.org; Tue, 19 May 2020 07:55:41 +0000 X-Inumbo-ID: 21460d00-99a6-11ea-a8e3-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 21460d00-99a6-11ea-a8e3-12813bfff9fa; Tue, 19 May 2020 07:55:39 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4309DAECE; Tue, 19 May 2020 07:55:41 +0000 (UTC) Subject: Re: [PATCH v3 1/5] x86: suppress XPTI-related TLB flushes when possible To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <3ce4ab2c-8cb6-1482-6ce9-3d5b019e10c1@suse.com> <20200518170904.GY54375@Air-de-Roger> From: Jan Beulich Message-ID: <748e3d53-779b-1529-73e8-37f3c2da6e57@suse.com> Date: Tue, 19 May 2020 09:55:38 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200518170904.GY54375@Air-de-Roger> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: , Cc: George Dunlap , "xen-devel@lists.xenproject.org" , Wei Liu , Andrew Cooper Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 18.05.2020 19:09, Roger Pau Monné wrote: > On Wed, Sep 25, 2019 at 05:23:11PM +0200, Jan Beulich wrote: >> @@ -310,7 +313,16 @@ int pv_domain_initialise(struct domain * >> /* 64-bit PV guest by default. */ >> d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0; >> >> - d->arch.pv.xpti = is_hardware_domain(d) ? opt_xpti_hwdom : opt_xpti_domu; >> + if ( is_hardware_domain(d) && opt_xpti_hwdom ) >> + { >> + d->arch.pv.xpti = true; >> + ++opt_xpti_hwdom; >> + } >> + if ( !is_hardware_domain(d) && opt_xpti_domu ) >> + { >> + d->arch.pv.xpti = true; >> + opt_xpti_domu = 2; > > I wonder whether a store fence is needed here in order to guarantee > that opt_xpti_domu is visible to flush_area_local before proceeding > any further with domain creation. The changed behavior of flush_area_local() becomes relevant only once the new domain runs. This being x86 code, the write can't remain invisible for longer than the very latest when the function returns, as the store can't be deferred past that (in reality it can't be deferred even until after the next [real] function call or the next barrier()). And due to x86'es cache coherent nature (for WB memory) the moment the store insn completes the new value is visible to all other CPUs. Jan