From: Qais Yousef <qais.yousef@arm•com>
To: shuo.a.liu@intel•com
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
linux-kernel@vger•kernel.org, linux-next@vger•kernel.org,
Randy Dunlap <rdunlap@infradead•org>,
Stephen Rothwell <sfr@canb•auug.org.au>,
Thomas Gleixner <tglx@linutronix•de>
Subject: Re: [PATCH RESEND v2 2/2] virt: acrn: Make remove_cpu sysfs invisible with !CONFIG_HOTPLUG_CPU
Date: Tue, 23 Feb 2021 15:25:30 +0000 [thread overview]
Message-ID: <20210223152530.y2qfyozdaowmfcat@e107158-lin> (raw)
In-Reply-To: <20210221134339.57851-2-shuo.a.liu@intel.com>
On 02/21/21 21:43, shuo.a.liu@intel•com wrote:
> From: Shuo Liu <shuo.a.liu@intel•com>
>
> 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 <shuo.a.liu@intel•com>
> Acked-by: Randy Dunlap <rdunlap@infradead•org> # build-tested
> Cc: Stephen Rothwell <sfr@canb•auug.org.au>
> Cc: Thomas Gleixner <tglx@linutronix•de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation•org>
> Cc: Qais Yousef <qais.yousef@arm•com>
> ---
> 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
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.
Thanks
--
Qais Yousef
> static struct attribute *acrn_attrs[] = {
> &dev_attr_remove_cpu.attr,
> NULL
> @@ -411,6 +419,7 @@ static struct attribute *acrn_attrs[] = {
>
> static struct attribute_group acrn_attr_group = {
> .attrs = acrn_attrs,
> + .is_visible = acrn_attr_visible,
> };
>
> static const struct attribute_group *acrn_attr_groups[] = {
> --
> 2.28.0
>
next prev parent reply other threads:[~2021-02-23 15:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-21 13:43 [PATCH RESEND v2 1/2] cpu/hotplug: Fix build error of using {add,remove}_cpu() with !CONFIG_SMP shuo.a.liu
2021-02-21 13:43 ` [PATCH RESEND v2 2/2] virt: acrn: Make remove_cpu sysfs invisible with !CONFIG_HOTPLUG_CPU shuo.a.liu
2021-02-23 15:25 ` Qais Yousef [this message]
2021-02-24 1:11 ` Shuo A Liu
2021-02-23 15:10 ` [PATCH RESEND v2 1/2] cpu/hotplug: Fix build error of using {add,remove}_cpu() with !CONFIG_SMP Qais Yousef
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210223152530.y2qfyozdaowmfcat@e107158-lin \
--to=qais.yousef@arm$(echo .)com \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=rdunlap@infradead$(echo .)org \
--cc=sfr@canb$(echo .)auug.org.au \
--cc=shuo.a.liu@intel$(echo .)com \
--cc=tglx@linutronix$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox