Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3228501pxb; Fri, 12 Feb 2021 12:35:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkDgwR4BJnCY4KPKOYDrnhM5pmRf8c6S7vt3izLk1I6x3p4r9mVrGuFKw4IJ1GbKQ54Cuz X-Received: by 2002:a17:906:a099:: with SMTP id q25mr4608293ejy.549.1613162124039; Fri, 12 Feb 2021 12:35:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613162124; cv=none; d=google.com; s=arc-20160816; b=B7QFiHq6JzSJuba7dVSjXEFH35IuM1TVx70UBz90zBFysJvmmr8K+yD6p2ATYOCy4O a55EUdsJx/CltBVnK+qBXLPDyoZkeGKoRVE8im0XzRNqJEQJ6GFKnAHOUZhrrUoXBUDk 0TDtexq3/KQmVd3d+n6C2VAT0A5sdpaiEedpciVzn7HwsQcT05gQG8q7q1bS8EqCAJ2l G8sJOuJ7Y0jXcyHHy+zemgjO6jgjPvPINtScu8PZ0QtLzUtAPQmTf29ZIMOuFUPCOXm8 C9rP1JDu2VlElYY8nBOJUcrOMFBnOkfF30s5qNrLV+4trsfPMRcQwSquWXwDluGgRgIs g1Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=9uw9IAr8lyqmrfip3LyZc7NlrzYPAAm/36VrnVIikDg=; b=mXZQWkwUSS0OeNjT6ZkXVdePPTGxMW005ACyClRyIYkqXAey1H6i7g5Q6pk5USl3aj FDcl9PPsM/a9vuG9/2RKM9jUPC/5qvBtWTiMFq9lfJWOL3MCKmc5uMi1jNiV/H1Umh/S 7nwVbUcycvT6IMmSLub9xFsc/ENoDtlrAT6mLMhSMNgllRlL+TxlcIXqlnHW98Xri1qj u1fRQda3TVWLrJwFKgL2O6KWzU2wQP9dhpM/q569RcQK2o1WEn5HgWWVGhP/5T3hghE0 jVxGabz2EXTqzf3VylS1iQhFFNvX1p6yRhYkIWD0RDGddcjl055KGTOs0rDEaBggQm0a ZqHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=eoBsNoHg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si6396261ejd.104.2021.02.12.12.35.00; Fri, 12 Feb 2021 12:35:24 -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; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=eoBsNoHg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229648AbhBLUd7 (ORCPT + 99 others); Fri, 12 Feb 2021 15:33:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbhBLUd4 (ORCPT ); Fri, 12 Feb 2021 15:33:56 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 286C4C061574; Fri, 12 Feb 2021 12:33:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=9uw9IAr8lyqmrfip3LyZc7NlrzYPAAm/36VrnVIikDg=; b=eoBsNoHgUjJxhXfuNEv5Yz2LMQ jPN5Kq6W+kpMzV52pkqwqKK8A+ctKUoFLzdnTG2SHwrh46QnXJU9pFTm02MXbqkZzFqGguQvrs236 EvtAM2JJ/PdvTffkVLJgThfhKnfmWmWNGUPxudIWs8Y8u8WKdNueKd2VS/KV48rvMrQJK5R09iJ83 CBVkHJQ5Rpnx8v3X9dJ4YG4sEHSLoLkrhTru+dnk/wHsHJZ5fbzZKrIqJLaf++wzd12nP8lUhqmsi mgFsY2AvPw/YopThXX2ECKR7CV9Ux4ImXNEBUzTEEAFgmdyDLUXt8lpIYIwpdrFmlyXV+5iW52sOs WXWZCiOQ==; Received: from [2601:1c0:6280:3f0::cf3b] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAf7o-0007qq-7W; Fri, 12 Feb 2021 20:33:12 +0000 Subject: Re: [PATCH v2 1/2] cpu/hotplug: Fix build error of using {add,remove}_cpu() with !CONFIG_SMP To: shuo.a.liu@intel.com, linux-next@vger.kernel.org Cc: Stephen Rothwell , Greg Kroah-Hartman , Thomas Gleixner , Qais Yousef , linux-kernel@vger.kernel.org References: <20210212165519.82126-1-shuo.a.liu@intel.com> From: Randy Dunlap Message-ID: Date: Fri, 12 Feb 2021 12:33:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210212165519.82126-1-shuo.a.liu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/12/21 8:55 AM, shuo.a.liu@intel.com wrote: > 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; } I would have done: return 0; Anyway: Acked-by: Randy Dunlap # build-tested > static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } > #endif /* !CONFIG_HOTPLUG_CPU */ thanks. -- ~Randy