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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B90E4EB64DA for ; Thu, 22 Jun 2023 12:27:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbjFVM1z (ORCPT ); Thu, 22 Jun 2023 08:27:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbjFVM1y (ORCPT ); Thu, 22 Jun 2023 08:27:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04F79171C for ; Thu, 22 Jun 2023 05:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687436840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=erLEJFFmN1Si57UTDFO+md6AnHLgrWd6t+5xkKTrdTo=; b=WjAEYcDddX2z0wcR9meFjGolps5fzbDl5zzg0qgO/+oPReM/XSSQhZlWlfnHl/OSJsfWec QD1tHe+9KMphF27z/U/HjXmKCmci6lwTLSTwwZrs2H3/eIrnL8QqHjz+ZGaKhWpx4Q7tO3 yzBDJY1bm2LE4CNqsjN18IedeYnvtGs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-21-guJMTKOAPz-lqf1ByoKNRw-1; Thu, 22 Jun 2023 08:27:15 -0400 X-MC-Unique: guJMTKOAPz-lqf1ByoKNRw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3692E83FC20; Thu, 22 Jun 2023 12:27:14 +0000 (UTC) Received: from [10.22.17.29] (unknown [10.22.17.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 663244087C70; Thu, 22 Jun 2023 12:27:13 +0000 (UTC) Message-ID: <921e1b98-af36-1f51-5abe-dea36425b706@redhat.com> Date: Thu, 22 Jun 2023 08:27:13 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v3 1/3] x86/idle: Disable IBRS when cpu is offline Content-Language: en-US To: Josh Poimboeuf Cc: Peter Zijlstra , 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 References: <20230622003603.1188364-1-longman@redhat.com> <20230622003603.1188364-2-longman@redhat.com> <20230622054053.uy577qezu5a65buc@treble> From: Waiman Long In-Reply-To: <20230622054053.uy577qezu5a65buc@treble> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 6/22/23 01:40, Josh Poimboeuf wrote: > On Wed, Jun 21, 2023 at 08:36:01PM -0400, Waiman Long wrote: >> +/* >> + * naitve_play_dead() is essentially a __noreturn function, but it can't >> + * be marked as such as the compiler may complain about it. >> + */ > FWIW, we could in theory do so by marking the smp_ops.play_dead function > pointer as __noreturn, but it would be tricky to teach objtool how to > understand that. I added the comment here because I had taken out the MSR restoration code. We can always replace that later on if there is a better way to do that. > >> void native_play_dead(void) >> { >> + if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS)) { >> + this_cpu_write(x86_spec_ctrl_current, 0); >> + native_wrmsrl(MSR_IA32_SPEC_CTRL, 0); >> + } > Can update_spec_ctrl() be used instead? Yes, the code is similar to what has been done in update_spec_ctrl(). Using it, however, will require exporting the function either by putting it into a public header or making it a global function. Cheers, Longman >