Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4789025ybf; Wed, 4 Mar 2020 10:41:04 -0800 (PST) X-Google-Smtp-Source: ADFU+vupq2XdppQHJQPNfSfAcMLwfRBq0aPOCrJiDLP/n5FwV8TXc4DGwzbe6HpITJ3vdoJAnu5c X-Received: by 2002:a05:6808:7dd:: with SMTP id f29mr2794201oij.67.1583347263744; Wed, 04 Mar 2020 10:41:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583347263; cv=none; d=google.com; s=arc-20160816; b=E+IbblgQGjmezztmDbiw9bOFoUNYMZuvWWBhUgyvHj5tKYxdfOPsJXuG4r4w6hyCBW 0tahH1sVXOhpY40CvMPTYHvSpwcbpbVTkZ0Zbg2Q9mAakRHGBJ5YvnrPuDROKE9IvrnW 7XmzuYDPT+imuJMTdPtooLS0EQzvYyNjiyPmdIPrYwG7k9PZvgmANIdJ3aUv1yuyBW5x qupcF2DEitQHZKq9eyh4ya7VIAcLonpaOcbwgjJqzSKXflaqbwfOwb6/hyFC8fZNPfFm TaaV4c7mhnueQfFcdolM6fGy6NlT9YGRCTFqhDFo62z1meOdFpaF26KUh25/V8r9c47d ymbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ZJMpc9iollxBffjBcTJQG4RbryBDk3Qk5uZhVzsznZg=; b=eq23BWGVAJstTbdlJgF06kp0Us7F833e4MKGzrooNSu8SqQHVWXIR9Tpe8xq0CB5Fl Nk8bOwQnMhzzJHLAHFmRj0yGZ7UeoTl+/dEFa0+XbfOBxG47Yh/TVsnrDeP7jYFswY3g BAAjfeQ+J1jdVqqZ6DvsQ/t1YxfeVOEGNYdp2PzXFe4PKC357uIp6RlucNWt4evmsvrD nD9zIHIuitEPTVotVf+MnFk6VWxEyHvEjAu3lipXN+380PGqljp17kX1myWzHucZDIIA 7QsbItGeOxR8tB4EQxWL1bmZZOSqqYfNBIMN7tUa3G+c5XXQj0lGptv8IpuS4S+fYVG5 q76A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si1811047otk.2.2020.03.04.10.40.51; Wed, 04 Mar 2020 10:41:03 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730278AbgCDSkP (ORCPT + 99 others); Wed, 4 Mar 2020 13:40:15 -0500 Received: from david.siemens.de ([192.35.17.14]:47634 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729702AbgCDSkO (ORCPT ); Wed, 4 Mar 2020 13:40:14 -0500 Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id 024IdxCw013234 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Mar 2020 19:39:59 +0100 Received: from [139.25.68.37] ([139.25.68.37]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 024Idx2V020732; Wed, 4 Mar 2020 19:39:59 +0100 Subject: Re: x2apic_wrmsr_fence vs. Intel manual To: Dave Hansen , x86 Cc: Linux Kernel Mailing List References: <783add60-f6c7-c8c6-b369-42e5ebfbf8c9@siemens.com> <602968e1-c1e4-0980-effa-e9c40b82c8c8@intel.com> From: Jan Kiszka Message-ID: <8421f726-0ef0-f253-4d98-ec8a4556cb8e@siemens.com> Date: Wed, 4 Mar 2020 19:39:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <602968e1-c1e4-0980-effa-e9c40b82c8c8@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04.03.20 19:27, Dave Hansen wrote: > On 3/2/20 8:11 AM, Jan Kiszka wrote: >> The former dates back to ce4e240c279a, but that commit does not mention >> why lfence is not needed. Did the manual read differently back then? Or >> why are we safe? To my reading of lfence, it also has a certain >> instruction serializing effect that mfence does not have. > > I asked around Intel about this. > > The old "SFENCE, or MFENCE" recommendation was deemed insufficient > because it has no impact on the ordering of WRMSR since it is not a > "load or store instruction". LFENCE's instruction-ordering semantic is > needed because it ensures later ordering of all instructions, not just > loads and stores. > > Jan, do you think you're seeing a bug resulting from WRMSR ordering? > Nope, not so far. I'm hunting a race between two guests over Jailhouse where the kick (sent as IPI) seems to come before the data, but changing the fences didn't solve it, unfortunately. Along that, I was reading code and manuals up and down and ran into this inconsistency. That's the story. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux