Message ID | 20221202075854.2253116-1-maobibo@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp708597wrr; Fri, 2 Dec 2022 00:10:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4rAJbvn37OR/L1RcCERXKulMkN2kP64PogQtu5X9IPdk2gWrJy/oywcRoClyGXkRgrdVKy X-Received: by 2002:a63:1e49:0:b0:46b:1590:2625 with SMTP id p9-20020a631e49000000b0046b15902625mr43247990pgm.569.1669968628423; Fri, 02 Dec 2022 00:10:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669968628; cv=none; d=google.com; s=arc-20160816; b=Wbu6oIzufhIaOzlXGcLQ3UJ5FJwLSRjUQVRvaJ947sLdX5nhLyRZtZifGEiK5L2cog 6gZqTi/cWx2KVqgt0PWhEYy0Emw/tvhXU3JUWOL2CJCNX68qmB4t5kEbw/XbNJpKPyE/ Yq3/a8WPB9iqdr2LGzUMuUMFmZGzHCX4ccv99MAR4VI5dZ0SC7egTuZLJyb/ejYpIOcP VzbLqDtQfpCC8PrZzWZ6nL+qiPmIBbCMzX7gWSwe65IN0tLEMZEuLyP4JXizh2wLhQ+a MYbRZpE0tIjOD6sG61GRmyPYc3Dli4ct+XkA8vUizTi6uSCnsz5to1smaPshKv9roQDf tDPA== 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; bh=QUdkKpx61zZYQt9dRYGkGMIxKOnmt3ttgsnd9p54W18=; b=RDgZkRaSu6kOQ2LqOJJyOUMdZWdNjzl6DVgrrct0w0O24GqgjoQ6hBSdmpVhqdiVUI o72NnycAde5IExIx+o9ddZy/uxfy7GKis7L4XBOEuTMSdTJXeR7uvZsHKyW50XekDUIL nixPqrr0qCReB1BVNPlRIAdpNrrcKYw19Rlq0xL3H+b8Wuo7+GZIOF4GeLx0HzettYl2 Zv5ZWuKi3FOfDS9gIPAwdnVozR4fkWjMy0ryDZrqa1INhyrHXjRGjd+kAiwO1zz/SoER O0Lpc8EkYRwgSY1GKgyaY5qweXEy/yjxknRlKa2FquJGZtcLLilHfYL3aBLmnkOnNMR8 OXPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a63d501000000b00476b6fa2963si6336183pgg.599.2022.12.02.00.10.12; Fri, 02 Dec 2022 00:10:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232562AbiLBH7F (ORCPT <rfc822;heyuhang3455@gmail.com> + 99 others); Fri, 2 Dec 2022 02:59:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232540AbiLBH7A (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 2 Dec 2022 02:59:00 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 89A0290770 for <linux-kernel@vger.kernel.org>; Thu, 1 Dec 2022 23:58:56 -0800 (PST) Received: from loongson.cn (unknown [10.2.9.158]) by gateway (Coremail) with SMTP id _____8Axjus+sIljOr4CAA--.6589S3; Fri, 02 Dec 2022 15:58:55 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.9.158]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx9VY+sIljqjckAA--.5784S2; Fri, 02 Dec 2022 15:58:54 +0800 (CST) From: Bibo Mao <maobibo@loongson.cn> To: Huacai Chen <chenhuacai@kernel.org> Cc: WANG Xuerui <kernel@xen0n.name>, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] LoongArch: export symbol with function smp_send_reschedule Date: Fri, 2 Dec 2022 15:58:54 +0800 Message-Id: <20221202075854.2253116-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Dx9VY+sIljqjckAA--.5784S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7tr47Zw4xJw15Kr43tr1xGrg_yoW8uFy3pF 9xZrn7Gr45W3s3A3s8A3yrur45Gws5GrnFqa17tFWrAFnFq3W8ZryktwnFqF10q3y0kF1F gFs5W34fKFyUAw7anT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b3kYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l n4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6x ACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E 87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82 IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2Iq xVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r 126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY 6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67 AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x 07jjwZcUUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751089024461130726?= X-GMAIL-MSGID: =?utf-8?q?1751089024461130726?= |
Series |
LoongArch: export symbol with function smp_send_reschedule
|
|
Commit Message
maobibo
Dec. 2, 2022, 7:58 a.m. UTC
Function smp_send_reschedule is standard kernel ABI, which is
defined header file include/linux/smp.h, however on LoongArch
it is defined as inline function, so that kernel module can
not use this function.
Now define smp_send_reschedule as general function, and add
EXPORT_SYMBOL_GPL on this function, so that kernel modules can
use it.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
arch/loongarch/include/asm/smp.h | 10 ----------
arch/loongarch/kernel/smp.c | 11 +++++++++++
2 files changed, 11 insertions(+), 10 deletions(-)
Comments
On 2022/12/2 15:58, Bibo Mao wrote: > Function smp_send_reschedule is standard kernel ABI, which is > defined header file include/linux/smp.h, however on LoongArch > it is defined as inline function, so that kernel module can > not use this function. > > Now define smp_send_reschedule as general function, and add > EXPORT_SYMBOL_GPL on this function, so that kernel modules can > use it. > > Signed-off-by: Bibo Mao <maobibo@loongson.cn> > --- > arch/loongarch/include/asm/smp.h | 10 ---------- > arch/loongarch/kernel/smp.c | 11 +++++++++++ > 2 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/arch/loongarch/include/asm/smp.h b/arch/loongarch/include/asm/smp.h > index 3dd172d9ffea..d82687390b4a 100644 > --- a/arch/loongarch/include/asm/smp.h > +++ b/arch/loongarch/include/asm/smp.h > @@ -78,16 +78,6 @@ extern void calculate_cpu_foreign_map(void); > */ > extern void show_ipi_list(struct seq_file *p, int prec); > > -/* > - * This function sends a 'reschedule' IPI to another CPU. > - * it goes straight through and wastes no time serializing > - * anything. Worst case is that we lose a reschedule ... > - */ > -static inline void smp_send_reschedule(int cpu) > -{ > - loongson_send_ipi_single(cpu, SMP_RESCHEDULE); > -} > - > static inline void arch_send_call_function_single_ipi(int cpu) > { > loongson_send_ipi_single(cpu, SMP_CALL_FUNCTION); > diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c > index 6ed72f7ff278..51dd3c3f06cb 100644 > --- a/arch/loongarch/kernel/smp.c > +++ b/arch/loongarch/kernel/smp.c > @@ -141,6 +141,17 @@ void loongson_send_ipi_single(int cpu, unsigned int action) > ipi_write_action(cpu_logical_map(cpu), (u32)action); > } > > +/* > + * This function sends a 'reschedule' IPI to another CPU. > + * it goes straight through and wastes no time serializing > + * anything. Worst case is that we lose a reschedule ... > + */ > +void smp_send_reschedule(int cpu) > +{ > + loongson_send_ipi_single(cpu, SMP_RESCHEDULE); > +} > +EXPORT_SYMBOL_GPL(smp_send_reschedule); > + While the change is in itself okay (one less case of mips legacy, getting in line with ia64, powerpc and riscv that all EXPORT_SYMBOL_GPL this), I'd suggest you batch this patch with the subsequent changes you plan to enable with this one, so reviewers would have more context and hopefully avoid churn. (I, by my familiarity with Loongson and LoongArch development, know you're probably aiming to use this with KVM, but others probably don't know, and again it's always better to have more context.) > void loongson_send_ipi_mask(const struct cpumask *mask, unsigned int action) > { > unsigned int i;
在 2022/12/2 16:25, WANG Xuerui 写道: > On 2022/12/2 15:58, Bibo Mao wrote: >> Function smp_send_reschedule is standard kernel ABI, which is >> defined header file include/linux/smp.h, however on LoongArch >> it is defined as inline function, so that kernel module can >> not use this function. >> >> Now define smp_send_reschedule as general function, and add >> EXPORT_SYMBOL_GPL on this function, so that kernel modules can >> use it. >> >> Signed-off-by: Bibo Mao <maobibo@loongson.cn> >> --- >> arch/loongarch/include/asm/smp.h | 10 ---------- >> arch/loongarch/kernel/smp.c | 11 +++++++++++ >> 2 files changed, 11 insertions(+), 10 deletions(-) >> >> diff --git a/arch/loongarch/include/asm/smp.h b/arch/loongarch/include/asm/smp.h >> index 3dd172d9ffea..d82687390b4a 100644 >> --- a/arch/loongarch/include/asm/smp.h >> +++ b/arch/loongarch/include/asm/smp.h >> @@ -78,16 +78,6 @@ extern void calculate_cpu_foreign_map(void); >> */ >> extern void show_ipi_list(struct seq_file *p, int prec); >> -/* >> - * This function sends a 'reschedule' IPI to another CPU. >> - * it goes straight through and wastes no time serializing >> - * anything. Worst case is that we lose a reschedule ... >> - */ >> -static inline void smp_send_reschedule(int cpu) >> -{ >> - loongson_send_ipi_single(cpu, SMP_RESCHEDULE); >> -} >> - >> static inline void arch_send_call_function_single_ipi(int cpu) >> { >> loongson_send_ipi_single(cpu, SMP_CALL_FUNCTION); >> diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c >> index 6ed72f7ff278..51dd3c3f06cb 100644 >> --- a/arch/loongarch/kernel/smp.c >> +++ b/arch/loongarch/kernel/smp.c >> @@ -141,6 +141,17 @@ void loongson_send_ipi_single(int cpu, unsigned int action) >> ipi_write_action(cpu_logical_map(cpu), (u32)action); >> } >> +/* >> + * This function sends a 'reschedule' IPI to another CPU. >> + * it goes straight through and wastes no time serializing >> + * anything. Worst case is that we lose a reschedule ... >> + */ >> +void smp_send_reschedule(int cpu) >> +{ >> + loongson_send_ipi_single(cpu, SMP_RESCHEDULE); >> +} >> +EXPORT_SYMBOL_GPL(smp_send_reschedule); >> + > > While the change is in itself okay (one less case of mips legacy, getting in line with ia64, powerpc and riscv that all EXPORT_SYMBOL_GPL this), I'd suggest you batch this patch with the subsequent changes you plan to enable with this one, so reviewers would have more context and hopefully avoid churn. (I, by my familiarity with Loongson and LoongArch development, know you're probably aiming to use this with KVM, but others probably don't know, and again it's always better to have more context.) > yes, kvm module depends on function smp_send_reschedule, only that it is not mature now. And this function is standard API, not arch specified API, it is normal for modules to use it :) regards bibo,mao >> void loongson_send_ipi_mask(const struct cpumask *mask, unsigned int action) >> { >> unsigned int i; >
On 2022/12/2 17:03, maobibo wrote: >>> diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c >>> index 6ed72f7ff278..51dd3c3f06cb 100644 >>> --- a/arch/loongarch/kernel/smp.c >>> +++ b/arch/loongarch/kernel/smp.c >>> @@ -141,6 +141,17 @@ void loongson_send_ipi_single(int cpu, unsigned int action) >>> ipi_write_action(cpu_logical_map(cpu), (u32)action); >>> } >>> +/* >>> + * This function sends a 'reschedule' IPI to another CPU. >>> + * it goes straight through and wastes no time serializing >>> + * anything. Worst case is that we lose a reschedule ... >>> + */ >>> +void smp_send_reschedule(int cpu) >>> +{ >>> + loongson_send_ipi_single(cpu, SMP_RESCHEDULE); >>> +} >>> +EXPORT_SYMBOL_GPL(smp_send_reschedule); >>> + >> >> While the change is in itself okay (one less case of mips legacy, getting in line with ia64, powerpc and riscv that all EXPORT_SYMBOL_GPL this), I'd suggest you batch this patch with the subsequent changes you plan to enable with this one, so reviewers would have more context and hopefully avoid churn. (I, by my familiarity with Loongson and LoongArch development, know you're probably aiming to use this with KVM, but others probably don't know, and again it's always better to have more context.) >> > > yes, kvm module depends on function smp_send_reschedule, only that it is not mature now. And this function is standard API, not arch specified API, it is normal for modules to use it :) Hmm, maybe you could post some kind of "sneak peek" code for early reviews on broader things like overall approach and architecture? Frankly speaking, experience suggests that code from Loongson usually needs much refactoring to meet mainline standards, and posting your design and some initial implementation could save you and the community a *huge* amount of time and hassle. And I'm not arguing this patch shouldn't get included, it's the opposite, but I don't see any difference in applying it now or later when the whole LoongArch KVM support gets mainlined, so maybe it's better to wait so we don't cause any churn if the change turns out unnecessary. For example, in my grepping I found that x86 doesn't have smp_send_reschedule exported, yet its KVM port has no problem using it; and that the s390 and riscv KVM ports don't invoke smp_send_reschedule at all. So it's entirely possible that LoongArch won't need this change for KVM after all, and I'm suggesting to save everyone some time.
Applied, thanks. Huacai On Fri, Dec 2, 2022 at 5:41 PM WANG Xuerui <kernel@xen0n.name> wrote: > > On 2022/12/2 17:03, maobibo wrote: > >>> diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c > >>> index 6ed72f7ff278..51dd3c3f06cb 100644 > >>> --- a/arch/loongarch/kernel/smp.c > >>> +++ b/arch/loongarch/kernel/smp.c > >>> @@ -141,6 +141,17 @@ void loongson_send_ipi_single(int cpu, unsigned int action) > >>> ipi_write_action(cpu_logical_map(cpu), (u32)action); > >>> } > >>> +/* > >>> + * This function sends a 'reschedule' IPI to another CPU. > >>> + * it goes straight through and wastes no time serializing > >>> + * anything. Worst case is that we lose a reschedule ... > >>> + */ > >>> +void smp_send_reschedule(int cpu) > >>> +{ > >>> + loongson_send_ipi_single(cpu, SMP_RESCHEDULE); > >>> +} > >>> +EXPORT_SYMBOL_GPL(smp_send_reschedule); > >>> + > >> > >> While the change is in itself okay (one less case of mips legacy, getting in line with ia64, powerpc and riscv that all EXPORT_SYMBOL_GPL this), I'd suggest you batch this patch with the subsequent changes you plan to enable with this one, so reviewers would have more context and hopefully avoid churn. (I, by my familiarity with Loongson and LoongArch development, know you're probably aiming to use this with KVM, but others probably don't know, and again it's always better to have more context.) > >> > > > > yes, kvm module depends on function smp_send_reschedule, only that it is not mature now. And this function is standard API, not arch specified API, it is normal for modules to use it :) > > Hmm, maybe you could post some kind of "sneak peek" code for early > reviews on broader things like overall approach and architecture? > Frankly speaking, experience suggests that code from Loongson usually > needs much refactoring to meet mainline standards, and posting your > design and some initial implementation could save you and the community > a *huge* amount of time and hassle. > > And I'm not arguing this patch shouldn't get included, it's the > opposite, but I don't see any difference in applying it now or later > when the whole LoongArch KVM support gets mainlined, so maybe it's > better to wait so we don't cause any churn if the change turns out > unnecessary. For example, in my grepping I found that x86 doesn't have > smp_send_reschedule exported, yet its KVM port has no problem using it; > and that the s390 and riscv KVM ports don't invoke smp_send_reschedule > at all. So it's entirely possible that LoongArch won't need this change > for KVM after all, and I'm suggesting to save everyone some time. > > -- > WANG "xen0n" Xuerui > > Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/ > >
diff --git a/arch/loongarch/include/asm/smp.h b/arch/loongarch/include/asm/smp.h index 3dd172d9ffea..d82687390b4a 100644 --- a/arch/loongarch/include/asm/smp.h +++ b/arch/loongarch/include/asm/smp.h @@ -78,16 +78,6 @@ extern void calculate_cpu_foreign_map(void); */ extern void show_ipi_list(struct seq_file *p, int prec); -/* - * This function sends a 'reschedule' IPI to another CPU. - * it goes straight through and wastes no time serializing - * anything. Worst case is that we lose a reschedule ... - */ -static inline void smp_send_reschedule(int cpu) -{ - loongson_send_ipi_single(cpu, SMP_RESCHEDULE); -} - static inline void arch_send_call_function_single_ipi(int cpu) { loongson_send_ipi_single(cpu, SMP_CALL_FUNCTION); diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index 6ed72f7ff278..51dd3c3f06cb 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -141,6 +141,17 @@ void loongson_send_ipi_single(int cpu, unsigned int action) ipi_write_action(cpu_logical_map(cpu), (u32)action); } +/* + * This function sends a 'reschedule' IPI to another CPU. + * it goes straight through and wastes no time serializing + * anything. Worst case is that we lose a reschedule ... + */ +void smp_send_reschedule(int cpu) +{ + loongson_send_ipi_single(cpu, SMP_RESCHEDULE); +} +EXPORT_SYMBOL_GPL(smp_send_reschedule); + void loongson_send_ipi_mask(const struct cpumask *mask, unsigned int action) { unsigned int i;