Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp938716pxb; Sun, 21 Feb 2021 05:47:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJySdwsJLECFSCmunfRQxzUhavzqVTJiAyDqFJ6kmFpOQGolNZE98DURUh/lX6m6EBi0wALj X-Received: by 2002:a17:906:240c:: with SMTP id z12mr16757441eja.314.1613915248192; Sun, 21 Feb 2021 05:47:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613915248; cv=none; d=google.com; s=arc-20160816; b=OxHrZ8B+6OLdytPuxwFBv+5pWwVcpPfKLdxp1Cv1uMZjHGWmm5t846QXfKOkmr2sSS +NXG2TjJRsd+UN/mR0YbrvLvP3jiv4g7saHuuTlxZ67c+e0GJUnk/uzkFswbvE3KsMgQ 7OaLw6hUuLZiHFimfpIcn+gU2axHkRIMCxKnti1YMr6c8NL/pKt2joLmAl+utvXvLG7G W9xPa58jwh9KXTHh3psFH5ZSS+iz1H3IzpcYckXvqUR5dtwKJ/pFGbKB8cUzj8Oe84lr LQHOhN8PWmhl6d1Q5oqMIvSAMK8k3vpfebUaqJwpP9+zdTnhVVxujKNXBefAWcAm4h8p Zysg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=yrrdUb0rdQSN/EU68V2DuCvXfeSylJOWJn7V7fmZm6s=; b=BgxopEavyWi1wnPSdw0f/qp4+rmc14uA5SHROcK6ffLpm4c39AzEbPfV8aBbsYjxou OtZyK0snwf70DoSYExnKmEQO0DTLrg0v3ApHWh1A53QKTMIWvPRmnj3GDvIGBqRcEqiL Dg1A6Z5DNGvEjRKRv7q0qTbtUk90JxJyUHgmZe/ZwOaXFWF8+Mf+l4ihVNs5IAQVSNC1 OV+hRvu55Ul0nBtYhyITfOU4+x604GbPMyQZcgnMfIOaI1cQwpXCBXoasqKxMiO+D23k JEaAupb992mkqzHwEebGPlM5OfI+Opiy2tXMVRWWHu8Uf4M2k4NrbsSMeOdf5zwm+laR G81g== 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 c9si10042339ejm.215.2021.02.21.05.47.05; Sun, 21 Feb 2021 05:47:28 -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 S230008AbhBUNot (ORCPT + 99 others); Sun, 21 Feb 2021 08:44:49 -0500 Received: from mga12.intel.com ([192.55.52.136]:6143 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbhBUNoq (ORCPT ); Sun, 21 Feb 2021 08:44:46 -0500 IronPort-SDR: NNSvCNG1vYVTAnDNlt6oMvFxoSchgs71PObvJRYvAAV+jyqnTjvuhoMOUOd3I1jaoQm+2BEvs5 M7wzPkE2jh1g== X-IronPort-AV: E=McAfee;i="6000,8403,9901"; a="163424738" X-IronPort-AV: E=Sophos;i="5.81,194,1610438400"; d="scan'208";a="163424738" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2021 05:44:05 -0800 IronPort-SDR: 4ihhKjWve1eadzPCXBle+NrQwC6/gIPjABq0xwf2KD0DmlvlfzQoRB4D1V2kH80gBLz+L22x7B psmAbCFnviuA== X-IronPort-AV: E=Sophos;i="5.81,194,1610438400"; d="scan'208";a="402012838" Received: from shsi6026.sh.intel.com (HELO localhost) ([10.239.147.88]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2021 05:44:03 -0800 From: shuo.a.liu@intel.com To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, Shuo Liu , Randy Dunlap , Stephen Rothwell , Thomas Gleixner , Qais Yousef Subject: [PATCH RESEND v2 2/2] virt: acrn: Make remove_cpu sysfs invisible with !CONFIG_HOTPLUG_CPU Date: Sun, 21 Feb 2021 21:43:39 +0800 Message-Id: <20210221134339.57851-2-shuo.a.liu@intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210221134339.57851-1-shuo.a.liu@intel.com> References: <20210221134339.57851-1-shuo.a.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; +} + 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