Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3091535pxb; Fri, 12 Feb 2021 08:58:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBeJlrAaO/JqrWa1rYlHod8CxqJcxt8qKoejvHiCyC5anG27W33xhAIfBCKhU1QkGWqC5Z X-Received: by 2002:a17:906:1f85:: with SMTP id t5mr4000910ejr.530.1613149124453; Fri, 12 Feb 2021 08:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613149124; cv=none; d=google.com; s=arc-20160816; b=sxsN5DfnyxAq634fmlEf9VF/8KMU7GkWtFwGigXWWKFvF8IIRcVMBg8tffIeg20nbn 5mCFE6zGcZHIMhqIMA+uEm/i/xWLk5zLsSWBFwfMj2cxtjqKduKh2SPfl8NGpOKkRYtY o/F0fbBsyD1OZb1LoyQ31SRtDiT00/WhYl3NiznwfSM10GVTEplx55V967XC2fbZc7wF jld6IThbxXaR+kaJT8ZclnnkQtlivnoTflAB6PDhFlfjGAera5yYwQGTcAvTgbv6JWwj In9GrxVNqHCiji27S3hySW9y8LYmUYiVtx66ohg8Ly6zc90KEN2YRuwi0b5gybjR2zZk jQQA== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=YVLudpE9Jy0LtMlc3y9t6qUN7jkpgB92Yg3TIReqtO0=; b=Vr4V7ARwhzEjKKXruo8LzBqeTfJolw2arpF8uBvIYNt+j+xu3HykGYPolCfQoFZWXs QEfFiN4PFJHeqNHv9qgYFAvJ2ml3nAfQq9/ZU82M1FOKkFidDAI8lrnQELsYnToIBISe 3eR6lSnN8RE+oowp5a/EG2qA32W9aB8PfucM2D2nYI/xdKIelDmEcXd7ZIW4mJzd/mTE sLLDK5aZjuCoGbEkInTbLvB6D9ggjcBObezcJ7e/pka6fgdpLNqUpIL1b4eArdvTBwcW PVEsiQwZb/kaDBc06Sgnx/zWkRxLmewnaZgQ5xm9sbe5dx5P2nuPfgXkHwvseXcKyqEM AsnA== 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 x18si7289463ejd.80.2021.02.12.08.58.20; Fri, 12 Feb 2021 08:58:44 -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 S229648AbhBLQ4h (ORCPT + 99 others); Fri, 12 Feb 2021 11:56:37 -0500 Received: from mga14.intel.com ([192.55.52.115]:16371 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbhBLQ4g (ORCPT ); Fri, 12 Feb 2021 11:56:36 -0500 IronPort-SDR: nzMvWrzl9mJqCasW2D8NzZ5MaNpM/1cRnjqFdL4gFWCG2cK3yrqZEKARsQJ8ydVJ0iPaM5P7Qc LRoEn6sz2xxA== X-IronPort-AV: E=McAfee;i="6000,8403,9893"; a="181665137" X-IronPort-AV: E=Sophos;i="5.81,174,1610438400"; d="scan'208";a="181665137" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2021 08:55:55 -0800 IronPort-SDR: zZemSbYRA2DitIWANy+76U3L/CTOlpIiUmUBBHydrnsmVbA7k+6FkGAJWCml1kRdRpKFynDsqz kSK6PNHTK8vg== X-IronPort-AV: E=Sophos;i="5.81,174,1610438400"; d="scan'208";a="398055793" 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; 12 Feb 2021 08:55:52 -0800 From: shuo.a.liu@intel.com To: linux-next@vger.kernel.org Cc: Stephen Rothwell , Randy Dunlap , Greg Kroah-Hartman , Thomas Gleixner , Qais Yousef , linux-kernel@vger.kernel.org, Shuo Liu Subject: [PATCH v2 1/2] cpu/hotplug: Fix build error of using {add,remove}_cpu() with !CONFIG_SMP Date: Sat, 13 Feb 2021 00:55:18 +0800 Message-Id: <20210212165519.82126-1-shuo.a.liu@intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shuo Liu 279dcf693ac7 ("virt: acrn: Introduce an interface for Service VM to control vCPU") introduced {add,remove}_cpu() usage and it hit below error with !CONFIG_SMP: ../drivers/virt/acrn/hsm.c: In function ‘remove_cpu_store’: ../drivers/virt/acrn/hsm.c:389:3: error: implicit declaration of function ‘remove_cpu’; [-Werror=implicit-function-declaration] remove_cpu(cpu); ../drivers/virt/acrn/hsm.c:402:2: error: implicit declaration of function ‘add_cpu’; [-Werror=implicit-function-declaration] add_cpu(cpu); Add add_cpu() function prototypes with !CONFIG_SMP and remove_cpu() with !CONFIG_HOTPLUG_CPU for such usage. Fixes: 279dcf693ac7 ("virt: acrn: Introduce an interface for Service VM to control vCPU") Reported-by: Randy Dunlap Signed-off-by: Shuo Liu --- I followed Greg's idea that add {add,remove}_cpu() functions prototypes. The v2 solution is different from the v1, so i removed Randy's Acked-by. Randy, please help have a look on v2. v2: - Drop the #ifdef in .c solution. Add {add,remove}_cpu() prototypes. (Suggested by Greg) include/linux/cpu.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 3aaa0687e8df..94a578a96202 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -108,6 +108,8 @@ static inline void cpu_maps_update_done(void) { } +static inline int add_cpu(unsigned int cpu) { return 0;} + #endif /* CONFIG_SMP */ extern struct bus_type cpu_subsys; @@ -137,6 +139,7 @@ static inline int cpus_read_trylock(void) { return true; } static inline void lockdep_assert_cpus_held(void) { } static inline void cpu_hotplug_disable(void) { } static inline void cpu_hotplug_enable(void) { } +static inline int remove_cpu(unsigned int cpu) { return -EPERM; } static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } #endif /* !CONFIG_HOTPLUG_CPU */ base-commit: 671176b0016c80b3943cb5387312c886aba3308d -- 2.28.0