Message ID | 20230513055804.23775-1-rdunlap@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp5591907vqo; Fri, 12 May 2023 23:13:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Afr6YhSIXv9+7DdPOpXrEBu1Ei5WWlJd+PIyTCnFKBP41wKlaAX+7IhlUuQ6gTMPc+ZiH X-Received: by 2002:a05:6a20:7d83:b0:100:a6ba:ba1b with SMTP id v3-20020a056a207d8300b00100a6baba1bmr24854820pzj.51.1683958430716; Fri, 12 May 2023 23:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683958430; cv=none; d=google.com; s=arc-20160816; b=f64zNUhY6s2ywEi8ezC4XdCIcuRyEGSNp1xHZYd/DoWlggzBSiL94twZudMINVM4JX jnUXkePtgoULpWVaoqfA8vAir+ZJ3t8t4lX2btXrwAW+52f2BIkE4gsKQhMA83Bg0DLM bO4JediUouPVDzcT+SK3nTriLM6rmjzqFQc29yYUWUKGeTkLG6bGFA3aVVlkoeSv0ebj SXebsYg/1UlfPaZ2M5F2ZuoUDB4nGDyDy5e3Ji1udEUuQbBpPDFpY2jfewYGG4qu/SBZ xo8AtiN+ci0frIe+Qi+vrgNehdHX/IBhE/I3ucLTahsjzV5DszMMgHBpcgR8ZF6oXPag p5+w== 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:dkim-signature; bh=JwvBlXffIR0HVqcitR36C1vwkyoUehqX0Gm5NBSTvZk=; b=J9OgxmnJEXhSG6GAD+yN2ZrdioR5rokedVci6cUfe6fP7TTfULF4SyJxHpcWkgFETW fzxN8rL2gp1zf/4ckas/XXU6qAqmhiw2gatlIxULgAE8MTpht0EsIABIYkAO9kBU3hHD WSvVSGFq58SLTTAbSYvw0MHwGXN0u3CZ2Q/5S0m4JnEUVHsjktAmBMr/B3IX3ANbePrD 38i4Xw8dSPWz7m30MrrRZr5vJlw/SFcb5KvYFCXSI524qyWCxNkHJugE3xxQYLUlQEjZ x2Iuhnmn6Vnlr2IHgQ12sLKu+9xLcLXsI9S2kwPz+oW2M2af1NMuwNskq4zj7P462/dz kUeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=I+iRnGYI; 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 g9-20020a63fa49000000b0052c73367c13si10932647pgk.871.2023.05.12.23.13.28; Fri, 12 May 2023 23:13:50 -0700 (PDT) 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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=I+iRnGYI; 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 S231890AbjEMF6N (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Sat, 13 May 2023 01:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjEMF6M (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 13 May 2023 01:58:12 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 310C81703 for <linux-kernel@vger.kernel.org>; Fri, 12 May 2023 22:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=JwvBlXffIR0HVqcitR36C1vwkyoUehqX0Gm5NBSTvZk=; b=I+iRnGYIbH0GzESG0nV955gJUa 0UPKyS/3Qb6BMiTbeTDcCOdZb6t8rJdRYDvFibJjoDDonE/XO1JsdC8BigzdBGV+1XQMUYDN1ilsi 2qw908Jr765lQtgmh5i9NvGx2y5UGEEwdrKcPepoeExmP11o8zlVXSnrdSKTayT6U0WY1jh2L3C84 iq+q935gdVdCRN32X0qWWlqn7dccEOqU7m5spB1uEBTo/W5Ex55QgNHeczWkLIWDJ/dzesIGwJC+e MXjwSqBFH7N3PX1PvB7OfzjFl6o0hdZ5MHH8iQ1uwmBd+xoc3IVTY3k3bmtWWX+ipK5kjLC1CrsKl tUnFsPRQ==; Received: from [2601:1c2:980:9ec0::2764] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pxiGc-00DlRD-1n; Sat, 13 May 2023 05:58:06 +0000 From: Randy Dunlap <rdunlap@infradead.org> To: linux-kernel@vger.kernel.org Cc: Randy Dunlap <rdunlap@infradead.org>, Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, linuxppc-dev@lists.ozlabs.org, Arnd Bergmann <arnd@arndb.de>, =?utf-8?q?Pal?= =?utf-8?q?i_Roh=C3=A1r?= <pali@kernel.org> Subject: [RFC PATCH] powerpc: udbg: export udbg_putc Date: Fri, 12 May 2023 22:58:04 -0700 Message-Id: <20230513055804.23775-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1765758395115629329?= X-GMAIL-MSGID: =?utf-8?q?1765758395115629329?= |
Series |
[RFC] powerpc: udbg: export udbg_putc
|
|
Commit Message
Randy Dunlap
May 13, 2023, 5:58 a.m. UTC
In a randconfig with CONFIG_SERIAL_CPM=m and
CONFIG_PPC_EARLY_DEBUG_CPM=y, there is a build error:
ERROR: modpost: "udbg_putc" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined!
The build can be fixed by exporting "udbg_putc" in udbg.c.
OTOH, maybe something like this is more appropriate in
arch/powerpc/Kconfig.debug?
config PPC_EARLY_DEBUG_CPM
bool "Early serial debugging for Freescale CPM-based serial ports"
- depends on SERIAL_CPM
+ depends on SERIAL_CPM=y
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Pali Rohár" <pali@kernel.org>
---
arch/powerpc/kernel/udbg.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Friday 12 May 2023 22:58:04 Randy Dunlap wrote: > In a randconfig with CONFIG_SERIAL_CPM=m and > CONFIG_PPC_EARLY_DEBUG_CPM=y, there is a build error: > ERROR: modpost: "udbg_putc" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined! > > The build can be fixed by exporting "udbg_putc" in udbg.c. > > OTOH, maybe something like this is more appropriate in > arch/powerpc/Kconfig.debug? > > config PPC_EARLY_DEBUG_CPM > bool "Early serial debugging for Freescale CPM-based serial ports" > - depends on SERIAL_CPM > + depends on SERIAL_CPM=y > > Signed-off-by: Randy Dunlap <rdunlap@infradead.org> > Cc: Michael Ellerman <mpe@ellerman.id.au> > Cc: Nicholas Piggin <npiggin@gmail.com> > Cc: Christophe Leroy <christophe.leroy@csgroup.eu> > Cc: linuxppc-dev@lists.ozlabs.org > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: "Pali Rohár" <pali@kernel.org> > --- > arch/powerpc/kernel/udbg.c | 1 + > 1 file changed, 1 insertion(+) > > diff -- a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c > --- a/arch/powerpc/kernel/udbg.c > +++ b/arch/powerpc/kernel/udbg.c > @@ -14,6 +14,7 @@ > #include <asm/udbg.h> > > void (*udbg_putc)(char c); > +EXPORT_SYMBOL(udbg_putc); > void (*udbg_flush)(void); > int (*udbg_getc)(void); > int (*udbg_getc_poll)(void); Hello! I do not think that it is a good idea to export udbg functions for kernel modules. I have quickly looked at the cpm_uart driver file drivers/tty/serial/cpm_uart/cpm_uart_core.c and it looks like that once udbg from it is registered then there is no code for unregistering it. So I have feeling that compiling cpm_uart driver as module should not be allowed when CONFIG_SERIAL_CPM_CONSOLE is enabled, and early debug should depend on CONFIG_CONSOLE_POLL || CONFIG_SERIAL_CPM_CONSOLE. Any other opinion?
Hi Pali, On 5/13/23 02:13, Pali Rohár wrote: > On Friday 12 May 2023 22:58:04 Randy Dunlap wrote: >> In a randconfig with CONFIG_SERIAL_CPM=m and >> CONFIG_PPC_EARLY_DEBUG_CPM=y, there is a build error: >> ERROR: modpost: "udbg_putc" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined! >> >> The build can be fixed by exporting "udbg_putc" in udbg.c. >> >> OTOH, maybe something like this is more appropriate in >> arch/powerpc/Kconfig.debug? >> >> config PPC_EARLY_DEBUG_CPM >> bool "Early serial debugging for Freescale CPM-based serial ports" >> - depends on SERIAL_CPM >> + depends on SERIAL_CPM=y >> >> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> >> Cc: Michael Ellerman <mpe@ellerman.id.au> >> Cc: Nicholas Piggin <npiggin@gmail.com> >> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> >> Cc: linuxppc-dev@lists.ozlabs.org >> Cc: Arnd Bergmann <arnd@arndb.de> >> Cc: "Pali Rohár" <pali@kernel.org> >> --- >> arch/powerpc/kernel/udbg.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff -- a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c >> --- a/arch/powerpc/kernel/udbg.c >> +++ b/arch/powerpc/kernel/udbg.c >> @@ -14,6 +14,7 @@ >> #include <asm/udbg.h> >> >> void (*udbg_putc)(char c); >> +EXPORT_SYMBOL(udbg_putc); >> void (*udbg_flush)(void); >> int (*udbg_getc)(void); >> int (*udbg_getc_poll)(void); > > Hello! I do not think that it is a good idea to export udbg functions > for kernel modules. I have quickly looked at the cpm_uart driver file Sure, that was just a conversation starter. > drivers/tty/serial/cpm_uart/cpm_uart_core.c and it looks like that once > udbg from it is registered then there is no code for unregistering it. > So I have feeling that compiling cpm_uart driver as module should not be > allowed when CONFIG_SERIAL_CPM_CONSOLE is enabled, and early debug > should depend on CONFIG_CONSOLE_POLL || CONFIG_SERIAL_CPM_CONSOLE. The other change above also fixes the build error: (Option 2) >> config PPC_EARLY_DEBUG_CPM >> bool "Early serial debugging for Freescale CPM-based serial ports" >> - depends on SERIAL_CPM >> + depends on SERIAL_CPM=y Also, making SERIAL_CPM (cpm_uart driver) be restricted to not allow it as a module when SERIAL_CPM_CONSOLE is enabled [how does one express that in Kconfig language?] will cause a circular dependency since SERIAL_CPM_CONSOLE depends on SERIAL_CPM=y. It looks like you are suggesting reversing the dependencies. > Any other opinion? Yes, please. Otherwise I prefer my option 2.
On Saturday 13 May 2023 15:53:19 Randy Dunlap wrote: > Hi Pali, > > On 5/13/23 02:13, Pali Rohár wrote: > > On Friday 12 May 2023 22:58:04 Randy Dunlap wrote: > >> In a randconfig with CONFIG_SERIAL_CPM=m and > >> CONFIG_PPC_EARLY_DEBUG_CPM=y, there is a build error: > >> ERROR: modpost: "udbg_putc" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined! > >> > >> The build can be fixed by exporting "udbg_putc" in udbg.c. > >> > >> OTOH, maybe something like this is more appropriate in > >> arch/powerpc/Kconfig.debug? > >> > >> config PPC_EARLY_DEBUG_CPM > >> bool "Early serial debugging for Freescale CPM-based serial ports" > >> - depends on SERIAL_CPM > >> + depends on SERIAL_CPM=y > >> > >> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> > >> Cc: Michael Ellerman <mpe@ellerman.id.au> > >> Cc: Nicholas Piggin <npiggin@gmail.com> > >> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> > >> Cc: linuxppc-dev@lists.ozlabs.org > >> Cc: Arnd Bergmann <arnd@arndb.de> > >> Cc: "Pali Rohár" <pali@kernel.org> > >> --- > >> arch/powerpc/kernel/udbg.c | 1 + > >> 1 file changed, 1 insertion(+) > >> > >> diff -- a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c > >> --- a/arch/powerpc/kernel/udbg.c > >> +++ b/arch/powerpc/kernel/udbg.c > >> @@ -14,6 +14,7 @@ > >> #include <asm/udbg.h> > >> > >> void (*udbg_putc)(char c); > >> +EXPORT_SYMBOL(udbg_putc); > >> void (*udbg_flush)(void); > >> int (*udbg_getc)(void); > >> int (*udbg_getc_poll)(void); > > > > Hello! I do not think that it is a good idea to export udbg functions > > for kernel modules. I have quickly looked at the cpm_uart driver file > > Sure, that was just a conversation starter. > > > drivers/tty/serial/cpm_uart/cpm_uart_core.c and it looks like that once > > udbg from it is registered then there is no code for unregistering it. > > So I have feeling that compiling cpm_uart driver as module should not be > > allowed when CONFIG_SERIAL_CPM_CONSOLE is enabled, and early debug > > should depend on CONFIG_CONSOLE_POLL || CONFIG_SERIAL_CPM_CONSOLE. > > The other change above also fixes the build error: (Option 2) > > >> config PPC_EARLY_DEBUG_CPM > >> bool "Early serial debugging for Freescale CPM-based serial ports" > >> - depends on SERIAL_CPM > >> + depends on SERIAL_CPM=y > > > Also, making SERIAL_CPM (cpm_uart driver) be restricted to not allow it > as a module when SERIAL_CPM_CONSOLE is enabled [how does one express that > in Kconfig language?] will cause a circular dependency since SERIAL_CPM_CONSOLE > depends on SERIAL_CPM=y. It looks like you are suggesting reversing the > dependencies. I see that SERIAL_CPM_CONSOLE has already "depends on SERIAL_CPM=y". Am I right that this already disallow compiling cpm_uart driver as module when SERIAL_CPM_CONSOLE is enabled? > > Any other opinion? > > Yes, please. Otherwise I prefer my option 2. > > -- > ~Randy Option 2 looks like a better solution.
On 5/13/23 16:05, Pali Rohár wrote: > On Saturday 13 May 2023 15:53:19 Randy Dunlap wrote: >> Hi Pali, >> >> On 5/13/23 02:13, Pali Rohár wrote: >>> On Friday 12 May 2023 22:58:04 Randy Dunlap wrote: >>>> In a randconfig with CONFIG_SERIAL_CPM=m and >>>> CONFIG_PPC_EARLY_DEBUG_CPM=y, there is a build error: >>>> ERROR: modpost: "udbg_putc" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined! >>>> >>>> The build can be fixed by exporting "udbg_putc" in udbg.c. >>>> >>>> OTOH, maybe something like this is more appropriate in >>>> arch/powerpc/Kconfig.debug? >>>> >>>> config PPC_EARLY_DEBUG_CPM >>>> bool "Early serial debugging for Freescale CPM-based serial ports" >>>> - depends on SERIAL_CPM >>>> + depends on SERIAL_CPM=y >>>> >>>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> >>>> Cc: Michael Ellerman <mpe@ellerman.id.au> >>>> Cc: Nicholas Piggin <npiggin@gmail.com> >>>> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> >>>> Cc: linuxppc-dev@lists.ozlabs.org >>>> Cc: Arnd Bergmann <arnd@arndb.de> >>>> Cc: "Pali Rohár" <pali@kernel.org> >>>> --- >>>> arch/powerpc/kernel/udbg.c | 1 + >>>> 1 file changed, 1 insertion(+) >>>> >>>> diff -- a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c >>>> --- a/arch/powerpc/kernel/udbg.c >>>> +++ b/arch/powerpc/kernel/udbg.c >>>> @@ -14,6 +14,7 @@ >>>> #include <asm/udbg.h> >>>> >>>> void (*udbg_putc)(char c); >>>> +EXPORT_SYMBOL(udbg_putc); >>>> void (*udbg_flush)(void); >>>> int (*udbg_getc)(void); >>>> int (*udbg_getc_poll)(void); >>> >>> Hello! I do not think that it is a good idea to export udbg functions >>> for kernel modules. I have quickly looked at the cpm_uart driver file >> >> Sure, that was just a conversation starter. >> >>> drivers/tty/serial/cpm_uart/cpm_uart_core.c and it looks like that once >>> udbg from it is registered then there is no code for unregistering it. >>> So I have feeling that compiling cpm_uart driver as module should not be >>> allowed when CONFIG_SERIAL_CPM_CONSOLE is enabled, and early debug >>> should depend on CONFIG_CONSOLE_POLL || CONFIG_SERIAL_CPM_CONSOLE. >> >> The other change above also fixes the build error: (Option 2) >> >>>> config PPC_EARLY_DEBUG_CPM >>>> bool "Early serial debugging for Freescale CPM-based serial ports" >>>> - depends on SERIAL_CPM >>>> + depends on SERIAL_CPM=y >> >> >> Also, making SERIAL_CPM (cpm_uart driver) be restricted to not allow it >> as a module when SERIAL_CPM_CONSOLE is enabled [how does one express that >> in Kconfig language?] will cause a circular dependency since SERIAL_CPM_CONSOLE >> depends on SERIAL_CPM=y. It looks like you are suggesting reversing the >> dependencies. > > I see that SERIAL_CPM_CONSOLE has already "depends on SERIAL_CPM=y". > Am I right that this already disallow compiling cpm_uart driver as > module when SERIAL_CPM_CONSOLE is enabled? No, it just prevents SERIAL_CPM_CONSOLE from being set when SERIAL_CPM=m. >>> Any other opinion? >> >> Yes, please. Otherwise I prefer my option 2. >> >> -- >> ~Randy > > Option 2 looks like a better solution. Thanks.
diff -- a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c --- a/arch/powerpc/kernel/udbg.c +++ b/arch/powerpc/kernel/udbg.c @@ -14,6 +14,7 @@ #include <asm/udbg.h> void (*udbg_putc)(char c); +EXPORT_SYMBOL(udbg_putc); void (*udbg_flush)(void); int (*udbg_getc)(void); int (*udbg_getc_poll)(void);