Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10886832rwd; Thu, 22 Jun 2023 06:14:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47J6HAgaMj1Mgr4hXKhkHFqMpKus7rlDBLQ90R9kI3P9l0EX/V/24A/LUX859WFPkIxRh6 X-Received: by 2002:a05:6870:c79a:b0:1ac:fd34:a6f9 with SMTP id dy26-20020a056870c79a00b001acfd34a6f9mr5999456oab.9.1687439685819; Thu, 22 Jun 2023 06:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687439685; cv=none; d=google.com; s=arc-20160816; b=bspLZvEMRQ+4tFEFFPYqLXoNh3Ezyd/J9SrxoJ+bg3QPtXtmCFwvaYLZLtQISVKzdv IklLl01tsaJvUwjG4ABo313LVbZ/5/A4ROyyU61UH4jJ4uA+6IpOtmbB+CfuInyXxgB1 WS9XExc1NDhZOJ1yAu3DnhNsddOadtLLgk0TGhOLDzAwwvPUWl9mDwbDZLUczcWZXI2Y iwt0vwx9LxhkUv9VaW//LYeekHZrIsWUojkOIN27Lu4ry0DtVpv/OPJS3PyGBzET3Zra WfxrwGj31Lz8Ju/aK3y0ZmQCkp9bVJkZsx4n3ilpwtyEQrUw6CrjY6A3DA9jhjJV4w6k RTKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2zCCsXt8qID/DdF3cBDXlV31CIdncIkhmxoQrF1JRGc=; b=tufuGNpTX7Cb1uKK/QXkvZ9rSMCxKTotlwpv3b5ydRHYH/lBOqytAJxTNpL21kOlQP tb8Lsr27Prv8FUrK4e3ZP0MHFRVSwLJYMxb/9JENldt2FdQ+mZgggOrq9AjY0M6m5nuV EqnhHfWTGe2NYESj/gb1FouiZj0xBlZ07AWfSkUeLn46sIKerkHh508YoYG9P6cVtoR4 CyUwUsARKc87iUvHomTCeS0n4iGT/yeO66i3Ganc+qYUQ+4uEtR4mHH2eA2UpUJq0VMh zAWATaBnb+uzRUUxF5p+yGEe6+7uiGcqlfd3ln3DzPvQ9Oqo7JUhQBL+D43PYq6VnJiI I9Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=TCCpJR6K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q24-20020a637518000000b00542924cbf75si1763447pgc.235.2023.06.22.06.14.33; Thu, 22 Jun 2023 06:14:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=TCCpJR6K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231318AbjFVNJO (ORCPT + 99 others); Thu, 22 Jun 2023 09:09:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbjFVNJM (ORCPT ); Thu, 22 Jun 2023 09:09:12 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B061184; Thu, 22 Jun 2023 06:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=2zCCsXt8qID/DdF3cBDXlV31CIdncIkhmxoQrF1JRGc=; b=TCCpJR6KWGFvtxkQtM+b991Z8P eeAvMZlTANe5Ky5lst9+TDctBDkehwl9HH2xGSmyshxZQuGQ02tQxKjr0TTNzjUmGIee9YXwyhH2r 7oufY07dQGR7G5c9yyyYGKtajyiSgFuRcgP9CiNbx3pa7OQ8MCvZGBky4s49qchL20eOH5VwTjqyn 2P9OGK1WGakDG5XcXaHED5WpDHiB35mBateBZBz1uOY5Vb5eixdnydOrhgEmop1I6Ovqlt68hdc0r QJQC2imOcCT6KsdVcXq72kaZ/DXgJc+osWKJjKtGYM6SyAVfaWlot7Oh17Nu4k8JESTfBZ6kegB/+ 8HJKLw0g==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qCK3T-001BjD-1w; Thu, 22 Jun 2023 13:08:56 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 217913002F0; Thu, 22 Jun 2023 15:08:54 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EFA0B2482940E; Thu, 22 Jun 2023 15:08:53 +0200 (CEST) Date: Thu, 22 Jun 2023 15:08:53 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: Waiman Long , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Pawan Gupta , Jacob Pan , Len Brown , linux-kernel@vger.kernel.org, x86@kernel.org, linux-pm@vger.kernel.org, Robin Jarry , Joe Mario Subject: Re: [PATCH v3 2/3] intel_idle: Sync up the SPEC_CTRL MSR value to x86_spec_ctrl_current Message-ID: <20230622130853.GP4253@hirez.programming.kicks-ass.net> References: <20230622003603.1188364-1-longman@redhat.com> <20230622003603.1188364-3-longman@redhat.com> <20230622054633.ulrurzzvzjijvdhn@treble> <20230622093828.GE4253@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230622093828.GE4253@hirez.programming.kicks-ass.net> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 22, 2023 at 11:38:28AM +0200, Peter Zijlstra wrote: > Both this and the play_dead case can't use update_spec_ctrl() because > RCU isn't there anymore and all that is noinstr. Additionally, both > sites rely on preemption being off already, where update_spec_ctrl() > can't do that. Oh, I might be wrong about the preemption thing; it doesn't make sense to do wrmsr with preemption on, so it could be simpler. > That said, I suppose one could write it like so: > > static __always_inline __update_spec_ctrl(u64 val) > { > __this_cpu_write(x86_spec_ctrl_current, val); > native_wrmsrl(MSR_IA32_SPEC_CTRL, val); > } > > static void update_spec_ctrl(u64 val) > { > preempt_disable(); > __update_spec_ctrl(val); > preempt_enable(); > } > > And then you can use __update_spec_ctrl(). But that would need a wee > audit of using native_wrmsrl() in all places, probably ok, IIRC Xen > wasn't using our IBRS stuff anyway.