Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp179975pxb; Tue, 23 Feb 2021 22:20:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxogPdDSTx0MkEzUpyE35RQKCqyctPPVz2KKS+8y6cZXd7wyE4gOTxQ2V9kqgPkF80YJWxv X-Received: by 2002:a05:6402:5112:: with SMTP id m18mr32059893edd.129.1614147604065; Tue, 23 Feb 2021 22:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614147604; cv=none; d=google.com; s=arc-20160816; b=liI3sg0hE7j9ItdZn/SP3lx7fVbnKkc5mmi9opZgdAKSiuh+fnrIWN51f9GvqIJ3JU K3KZTZVRBfciqSjBwUJR1eFWMoBf06aLImANkkPNZcnKQn3QTc8Apd6jwvnA7+ahDazz KtfD83ygTRRhmoIWTNesTcj+DBAEREyYFoDxTE/agrH4bD2xbd7om/O7BZzms7Qhe+WR PW0YCBCnb59ldntTBefd2v6rnxEKgGzCwWYY7YJo89Ke1GemYF8FtkE2g8CVj79nJeAz Fij6eAGAtbb9pDUHtXVXKhhzF/b80dRdaKJklF3Pk79OEbw/UIwnhpGfrQVEN6UqxRqn /feA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=qop2vZLZHHIytnz3QbjI+BD5OruU+2P6NcKWEMNhchc=; b=uFK0igsQvWwshN5QgsMw2MGjkKM81CFE+MRZyHwyBffpzDLlK2Tkx3/hlouHXHBp9v V4+CecKYCh7KTahVJ4XdyHZnQ+J+r8Ja+1J43xAOm+SLSBIarqGzskg0xIqTkUh/OY6h JwoRa+bi08BOryZOOawr9t0CYuPLdiliYoyxuYDTYAllj2hDS4a1J+wgg2PAhcZuxlQn rT9h1gk/U2z7I44QwCcl1eY1ZqhDfFnNnyAhnUbDCIhspKIMQ0x0Vy3NEPVYMZvgjRsf 2RQx3ILp08ZuJk+6ivjfN3aiy++8Pul3dQzVhPat5TbZsTZpSllYEhNMTWhh6Zfg+YQb jtXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si590587edo.152.2021.02.23.22.19.40; Tue, 23 Feb 2021 22:20:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233576AbhBXBQl (ORCPT + 99 others); Tue, 23 Feb 2021 20:16:41 -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