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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 D489CC433DB for ; Wed, 24 Feb 2021 01:18:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9709764EB6 for ; Wed, 24 Feb 2021 01:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233787AbhBXBRO (ORCPT ); Tue, 23 Feb 2021 20:17:14 -0500 Received: from mga07.intel.com ([134.134.136.100]:63176 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234668AbhBXBMi (ORCPT ); Tue, 23 Feb 2021 20:12:38 -0500 IronPort-SDR: Vj4XR2QglwdpQMhBAzMB+3aTZcTfRCLvlKlIJxb0an04bFqlx6vvSEg+GxNX3XXCuizL6nEcHu qyPpITEHi0Ag== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="249065603" X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="scan'208";a="249065603" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 17:11:51 -0800 IronPort-SDR: WaACZKmiY0IRR9yOQtd09Mbo11q6wWM3zuPagSCaqco92Vn8GlIr6Tbj1KJm5pNZ37BSlMmvly eZGWDG1yCsGg== X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="scan'208";a="499373345" Received: from shuo-intel.sh.intel.com (HELO localhost) ([10.239.154.30]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 17:11:49 -0800 Date: Wed, 24 Feb 2021 09:11:47 +0800 From: Shuo A Liu To: Qais Yousef Cc: Greg Kroah-Hartman , , , Randy Dunlap , Stephen Rothwell , "Thomas Gleixner" Subject: Re: [PATCH RESEND v2 2/2] virt: acrn: Make remove_cpu sysfs invisible with !CONFIG_HOTPLUG_CPU Message-ID: <20210224011147.GD30008@shuo-intel.sh.intel.com> References: <20210221134339.57851-1-shuo.a.liu@intel.com> <20210221134339.57851-2-shuo.a.liu@intel.com> <20210223152530.y2qfyozdaowmfcat@e107158-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210223152530.y2qfyozdaowmfcat@e107158-lin> User-Agent: Mutt/1.8.3 (2017-05-23) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue 23.Feb'21 at 15:25:30 +0000, Qais Yousef wrote: >On 02/21/21 21:43, shuo.a.liu@intel.com wrote: >> From: Shuo Liu >> >> Without cpu hotplug support, vCPU cannot be removed from a Service VM. >> Don't expose remove_cpu sysfs when CONFIG_HOTPLUG_CPU disabled. >> >> Signed-off-by: Shuo Liu >> Acked-by: Randy Dunlap # build-tested >> Cc: Stephen Rothwell >> Cc: Thomas Gleixner >> Cc: Greg Kroah-Hartman >> Cc: Qais Yousef >> --- >> drivers/virt/acrn/hsm.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/drivers/virt/acrn/hsm.c b/drivers/virt/acrn/hsm.c >> index 1f6b7c54a1a4..6996ea6219e5 100644 >> --- a/drivers/virt/acrn/hsm.c >> +++ b/drivers/virt/acrn/hsm.c >> @@ -404,6 +404,14 @@ static ssize_t remove_cpu_store(struct device *dev, >> } >> static DEVICE_ATTR_WO(remove_cpu); >> >> +static umode_t acrn_attr_visible(struct kobject *kobj, struct attribute *a, int n) >> +{ >> + if (a == &dev_attr_remove_cpu.attr) >> + return IS_ENABLED(CONFIG_HOTPLUG_CPU) ? a->mode : 0; >> + >> + return a->mode; >> +} >> + > >I can't find this code in Linus' master. But this looks fine from my narrow Now, the code is still in linux-next tree only. >PoV. Protecting the attribute with ifdef CONFIG_HOTPLUG_CPU is easier to read >for me, but this doesn't mean this approach is not fine. Just FYI, Greg prefers this solution. https://lore.kernel.org/lkml/20210212045724.77846-1-shuo.a.liu@intel.com/ Thanks shuo