Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp725693ybh; Sat, 3 Aug 2019 08:29:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJ2IKP3ujresS7WtCKajAos1P9FeySFVdE6LFeBAUMcZ/mcYG3gRsvyTD8aPOHRhkayJGP X-Received: by 2002:a17:90a:3401:: with SMTP id o1mr9648996pjb.7.1564846181479; Sat, 03 Aug 2019 08:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564846181; cv=none; d=google.com; s=arc-20160816; b=O7VZytY19TZ8HgGslTK+FrakV48XMDm1iEu1lj5uaDWPF+GzR30JOGaL0iSbhi7lkr 5zVsT5iq2w9ULie1sadiQjYR0EvTRKOZ7PB3tsY8nrAWRqz+2Pnq6AHHIbIN4Lq0IfeY X2LinF6Sa9e1BRv8u5bo3PJP3J5Mq/2AGjk4aSwbQ03riiLBqURqyQLM5NughOVe0m8J R3ona7P06ai9jr5jG2728y8kS1qWuXT0Ahn8hl+RZzpkuQaay1fgxs3Jnv27ifAQ24hn eAfZTOURqiZGSMJxn9oc9PcAYHWYQZCqYd8ppief5ex3kSMVJtYAvwdv6lMHaAnE2omZ rNlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=POb9S0P8wt5FGDQBsksiLIQ4LHAbMykwcFNaxiHaxxk=; b=S9xBG0APx9BbxL5N40hSYLRS3lguOv3usj3/0JGvm91jnJzxiVWXsXH+QgX+60QSPo jilpU33YiZSDgFDgXAjYS/sZx9ZqxPESuirf0DWa8iQKCqFkMnB6S9rfWZofn0BIAAiD Aoo1fgDVUF5ZIQ3y/zbrY4qtDLD5yzpWxp7SekTphbtg8OLM5LtJK3ypG+hfMpwZSfEj GnNreRa39+ZWub2P8aKOkay/KP5OtC32d3Wh1ytT04tLA2RiM3y/cWLkSFFd7TgmxqRN EYDqtcALTzZ8xCTlrpncHXR/7rK0t+/HvIMuHFrLYPSv9EA0LOQmVSHlerGfjxFCtef0 hZbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=FgfI9M5Y; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d23si8687079pjv.56.2019.08.03.08.29.26; Sat, 03 Aug 2019 08:29:41 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=FgfI9M5Y; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729604AbfHBQdp (ORCPT + 99 others); Fri, 2 Aug 2019 12:33:45 -0400 Received: from merlin.infradead.org ([205.233.59.134]:36528 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726300AbfHBQdp (ORCPT ); Fri, 2 Aug 2019 12:33:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=POb9S0P8wt5FGDQBsksiLIQ4LHAbMykwcFNaxiHaxxk=; b=FgfI9M5YrkQCEuIQlLEUcXuEH aXDrUrgG/bZZK/rYRCwrpoWbDQg/rYNyXQIDgekl8JI8zXmo4L3g7vBMOYyjmc0OAnV2/kpWWmbBm pe48TTWl4lmSEsKrJB6iID/iGBFCdhwX5Rqqhk37hDDzfCH8wHpxOBsXRy2tsFQb6y+Dax/amtbzU 7nE0GkJ3oaRzj+loS3URDS8fCOaPJnIHMdKvZebkNmsmaqqIV88eNdcIC8VHXH+wg3he4DqoudqDb La9Xtk2Xr1vIlZqQ/Y7nYivHyCUzxCTKBipIJpG7xGdZUZkiVTxD5Lr6NXSqbNCNvvCyhEIilpFBy NsKUiaWhg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1htaUk-0004ad-Ka; Fri, 02 Aug 2019 16:33:33 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2261F20293EA8; Fri, 2 Aug 2019 18:33:28 +0200 (CEST) Date: Fri, 2 Aug 2019 18:33:28 +0200 From: Peter Zijlstra To: "Lendacky, Thomas" Cc: Thomas Gleixner , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , Ingo Molnar , Borislav Petkov , Arnaldo Carvalho de Melo , Alexander Shishkin , Namhyung Kim , Jiri Olsa , Jerry Hoemann Subject: Re: [PATCH] perf/x86/amd: Change NMI latency mitigation to use a timestamp Message-ID: <20190802163328.GB2349@hirez.programming.kicks-ass.net> References: <833ee307989ac6bfb45efe823c5eca4b2b80c7cf.1564685848.git.thomas.lendacky@amd.com> <20190801211613.GB3578@hirez.programming.kicks-ass.net> <20190801214813.GB2332@hirez.programming.kicks-ass.net> <925c3458-aeae-a44b-ddd5-40a1e173a307@amd.com> <20190802162015.GA2349@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190802162015.GA2349@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 02, 2019 at 06:20:15PM +0200, Peter Zijlstra wrote: > On Fri, Aug 02, 2019 at 02:33:41PM +0000, Lendacky, Thomas wrote: > > Talking to the hardware folks, they say setting CR8 is a serializing > > instruction and has to communicate out to the APIC, so it's better to > > use CLI/STI. > > Bah; the Intel SDM states: "MOV CR* instructions, except for MOV CR8, > are serializing instructions", which had given me a little hope. > > At the same time, all these chips still have the APIC TPR field too, so > much like how the TSC DEADLINE MSR is a hidden APIC write, so too is CR8 > I suppose :-( > > I'll still finish the patches I started, just to see what it would look > like. Another 'fun' issue I ran into while doing these patches; STI has a 1 instruction shadow, which we rely on, MOV CR8 does not. So things like: native_safe_halt: sti hlt turn into: native_safe_halt: cli movl $0, %rax movq %rax, %cr8 sti hlt