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 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 349E7C31E40 for ; Fri, 9 Aug 2019 15:41:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12B96208C4 for ; Fri, 9 Aug 2019 15:41:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436798AbfHIPlq (ORCPT ); Fri, 9 Aug 2019 11:41:46 -0400 Received: from mga04.intel.com ([192.55.52.120]:57597 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbfHIPlp (ORCPT ); Fri, 9 Aug 2019 11:41:45 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 08:41:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,364,1559545200"; d="scan'208";a="193411041" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga001.fm.intel.com with ESMTP; 09 Aug 2019 08:41:45 -0700 Date: Fri, 9 Aug 2019 08:30:57 -0700 From: Fenghua Yu To: Thomas Gleixner Cc: Valdis =?utf-8?Q?Kl=C4=93tnieks?= , Ingo Molnar , Borislav Petkov , x86@kernel.org, LKML Subject: Re: [PATCH] arch/x86/kernel/cpu/umwait.c - remove unused variable Message-ID: <20190809153056.GB56628@romley-ivt3.sc.intel.com> References: <79734.1565272329@turing-police> <141835.1565295884@turing-police> <20190809004438.GA56628@romley-ivt3.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 09, 2019 at 11:49:49AM +0200, Thomas Gleixner wrote: > On Thu, 8 Aug 2019, Fenghua Yu wrote: > > On Thu, Aug 08, 2019 at 10:32:38PM +0200, Thomas Gleixner wrote: > > > Valdis, > > > > > > On Thu, 8 Aug 2019, Valdis Klētnieks wrote: > > > > On Thu, 08 Aug 2019 22:04:03 +0200, Thomas Gleixner said: It isn't > > > > clear that whatever is doing the device_initcall()s will be able to > > > > do any reasonable recovery if we return an error, so any error > > > > recovery is going to have to happen before the function returns. It > > > > might make sense to do an 'if (ret) return;' before going further in > > > > the function, but given the comment a few lines further down about > > > > ignoring errors, it was apparently considered more important to > > > > struggle through and register stuff in sysfs even if umwait was > > > > broken.... > > > > > > I missed that when going through it. > > > > > > The right thing to do is to have a cpu_offline callback which clears > > > the umwait MSR. That covers also the failure in the cpu hotplug setup. > > > Then handling an error return makes sense and keeps everything in a > > > workable shape. > > > > When cpu is offline, the MSR won't be used. We don't need to clear it, right? > > Groan. If soemthing goes wrong when registering the hotplug callback, what > undoes the MSR setup which might have happened and what takes care of it on > cpus coming online later? Exactly nothing. Then you have a non-consistent > behaviour. > > Make stuff symmmetric and correct and not optimized for the sunshine case. I see. Just want to make sure I understand it correctly: sysfs_create_group() should not be called if cpuhp_setup_state() has error. Otherwise, the sysadmin can change the MSR through the sysfs interface. After that, a CPU is online and its MSR is not updated because cpu_online is not installed. Then this online CPU has different MSR value from the other CPUs. Is that right? Thanks. -Fenghua