All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Daney <david.daney@cavium.com>,
	kernel test robot <lkp@intel.com>, Andrew Lunn <andrew@lunn.ch>,
	kbuild-all@lists.01.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rich Felker <dalias@libc.org>
Subject: Re: ERROR: modpost: "__delay" [drivers/net/mdio/mdio-cavium.ko] undefined!
Date: Tue, 1 Jun 2021 20:52:27 -0700	[thread overview]
Message-ID: <45d58448-9b6c-d1f5-7e19-7821c9241cff@infradead.org> (raw)
In-Reply-To: <CAMuHMdWiPjuf47=SBjNrQNjf4QiwDf6t0kkx_5BdPVoa22zxmw@mail.gmail.com>

On 5/31/21 8:45 AM, Geert Uytterhoeven wrote:
> Hi Randy,
> 
> On Mon, May 31, 2021 at 5:12 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>> On 5/31/21 12:32 AM, Geert Uytterhoeven wrote:
>>> CC David (original author, asked by driver location change)
>>>
>>> On Mon, May 31, 2021 at 9:29 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>>>
>>>> On Mon, May 31, 2021 at 2:05 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>> On 5/29/21 4:25 PM, kernel test robot wrote:
>>>>>> First bad commit (maybe != root cause):
>>>>>>
>>>>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>>>>> head:   df8c66c4cfb91f2372d138b9b714f6df6f506966
>>>>>> commit: a9770eac511ad82390b9f4a3c1728e078c387ac7 net: mdio: Move MDIO drivers into a new subdirectory
>>>>>> date:   9 months ago
>>>>>> config: sh-allmodconfig (attached as .config)
>>>>>> compiler: sh4-linux-gcc (GCC) 9.3.0
>>>>>> reproduce (this is a W=1 build):
>>>>>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>>>>>         chmod +x ~/bin/make.cross
>>>>>>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a9770eac511ad82390b9f4a3c1728e078c387ac7
>>>>>>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>>>>>>         git fetch --no-tags linus master
>>>>>>         git checkout a9770eac511ad82390b9f4a3c1728e078c387ac7
>>>>>>         # save the attached .config to linux build tree
>>>>>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
>>>>>>
>>>>>> If you fix the issue, kindly add following tag as appropriate
>>>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>>>>
>>>>>> All errors (new ones prefixed by >>, old ones prefixed by <<):
>>>>>>
>>>>>>>> ERROR: modpost: "__delay" [drivers/net/mdio/mdio-cavium.ko] undefined!
>>>>>
>>>>> Just a comment here.  kernel test robot has reported this issue
>>>>> 5 times in 2021 that I know of -- and I could have missed some.
>>>>>
>>>>> I see that Geert recently (June 2020) reverted the
>>>>> EXPORT_SYMBOL(__delay) in arch/sh/lib/delay.c, with this comment:
>>>>>
>>>>>     __delay() is an internal implementation detail on several architectures.
>>>>>     Drivers should not call __delay() directly, as it has non-standardized
>>>>>     semantics, or may not even exist.
>>>>>     Hence there is no need to export __delay() to modules.
>>>>>
>>>>>     See also include/asm-generic/delay.h:
>>>>>
>>>>>         /* Undefined functions to get compile-time errors */
>>>>>         ...
>>>>>         extern void __delay(unsigned long loops);
>>>>>
>>>>> However, s/several architectures/all but one architecture: SH/.
>>>>> All architectures except for SH provide either an exported function,
>>>>> an inline function, or a macro for __delay(). Yeah, they probably
>>>>> don't all do the same delay.
>>>>
>>>> Hence it must not be used by drivers, as it might give the false assumption
>>>> of working everywhere.  While drivers/net/mdio/mdio-cavium is
>>>> platform-specific, code might be copied in a new driver, less restricted
>>>> to a specific platform.
>>
>> Geert, should all (15) of the other arch EXPORT_SYMBOL(__delay); exports
>> be removed?  (in theory?  I'm not planning to remove them.)
> 
> It depends.  If they are internal implementation details of an
> architecture's mdelay() or udelay() function (i.e. the latter are
> static inline functions that may call into out-of-line __delay()
> functions), then they should be kept.
> 
> I haven't checked all of them, but e.g. on arm64, mdelay() and udelay()
> don't call into __delay, so IMHO its export should be removed.
> 
> Generic drivers should not use __delay() with a hardcoded value, as
> its semantics are not defined (cfr. the undefined function comment
> in asm-generic).

Thanks, Geert. I get it.

Hopefully David Daney will jump in here with a patch at some point.

-- 
~Randy


WARNING: multiple messages have this Message-ID (diff)
From: Randy Dunlap <rdunlap@infradead.org>
To: kbuild-all@lists.01.org
Subject: Re: ERROR: modpost: "__delay" [drivers/net/mdio/mdio-cavium.ko] undefined!
Date: Tue, 01 Jun 2021 20:52:27 -0700	[thread overview]
Message-ID: <45d58448-9b6c-d1f5-7e19-7821c9241cff@infradead.org> (raw)
In-Reply-To: <CAMuHMdWiPjuf47=SBjNrQNjf4QiwDf6t0kkx_5BdPVoa22zxmw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4062 bytes --]

On 5/31/21 8:45 AM, Geert Uytterhoeven wrote:
> Hi Randy,
> 
> On Mon, May 31, 2021 at 5:12 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>> On 5/31/21 12:32 AM, Geert Uytterhoeven wrote:
>>> CC David (original author, asked by driver location change)
>>>
>>> On Mon, May 31, 2021 at 9:29 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>>>
>>>> On Mon, May 31, 2021 at 2:05 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>>> On 5/29/21 4:25 PM, kernel test robot wrote:
>>>>>> First bad commit (maybe != root cause):
>>>>>>
>>>>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>>>>> head:   df8c66c4cfb91f2372d138b9b714f6df6f506966
>>>>>> commit: a9770eac511ad82390b9f4a3c1728e078c387ac7 net: mdio: Move MDIO drivers into a new subdirectory
>>>>>> date:   9 months ago
>>>>>> config: sh-allmodconfig (attached as .config)
>>>>>> compiler: sh4-linux-gcc (GCC) 9.3.0
>>>>>> reproduce (this is a W=1 build):
>>>>>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>>>>>         chmod +x ~/bin/make.cross
>>>>>>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a9770eac511ad82390b9f4a3c1728e078c387ac7
>>>>>>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>>>>>>         git fetch --no-tags linus master
>>>>>>         git checkout a9770eac511ad82390b9f4a3c1728e078c387ac7
>>>>>>         # save the attached .config to linux build tree
>>>>>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
>>>>>>
>>>>>> If you fix the issue, kindly add following tag as appropriate
>>>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>>>>
>>>>>> All errors (new ones prefixed by >>, old ones prefixed by <<):
>>>>>>
>>>>>>>> ERROR: modpost: "__delay" [drivers/net/mdio/mdio-cavium.ko] undefined!
>>>>>
>>>>> Just a comment here.  kernel test robot has reported this issue
>>>>> 5 times in 2021 that I know of -- and I could have missed some.
>>>>>
>>>>> I see that Geert recently (June 2020) reverted the
>>>>> EXPORT_SYMBOL(__delay) in arch/sh/lib/delay.c, with this comment:
>>>>>
>>>>>     __delay() is an internal implementation detail on several architectures.
>>>>>     Drivers should not call __delay() directly, as it has non-standardized
>>>>>     semantics, or may not even exist.
>>>>>     Hence there is no need to export __delay() to modules.
>>>>>
>>>>>     See also include/asm-generic/delay.h:
>>>>>
>>>>>         /* Undefined functions to get compile-time errors */
>>>>>         ...
>>>>>         extern void __delay(unsigned long loops);
>>>>>
>>>>> However, s/several architectures/all but one architecture: SH/.
>>>>> All architectures except for SH provide either an exported function,
>>>>> an inline function, or a macro for __delay(). Yeah, they probably
>>>>> don't all do the same delay.
>>>>
>>>> Hence it must not be used by drivers, as it might give the false assumption
>>>> of working everywhere.  While drivers/net/mdio/mdio-cavium is
>>>> platform-specific, code might be copied in a new driver, less restricted
>>>> to a specific platform.
>>
>> Geert, should all (15) of the other arch EXPORT_SYMBOL(__delay); exports
>> be removed?  (in theory?  I'm not planning to remove them.)
> 
> It depends.  If they are internal implementation details of an
> architecture's mdelay() or udelay() function (i.e. the latter are
> static inline functions that may call into out-of-line __delay()
> functions), then they should be kept.
> 
> I haven't checked all of them, but e.g. on arm64, mdelay() and udelay()
> don't call into __delay, so IMHO its export should be removed.
> 
> Generic drivers should not use __delay() with a hardcoded value, as
> its semantics are not defined (cfr. the undefined function comment
> in asm-generic).

Thanks, Geert. I get it.

Hopefully David Daney will jump in here with a patch at some point.

-- 
~Randy

  reply	other threads:[~2021-06-02  3:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 23:25 ERROR: modpost: "__delay" [drivers/net/mdio/mdio-cavium.ko] undefined! kernel test robot
2021-05-29 23:25 ` kernel test robot
2021-05-31  0:05 ` Randy Dunlap
2021-05-31  0:05   ` Randy Dunlap
2021-05-31  1:13   ` Randy Dunlap
2021-05-31  1:13     ` Randy Dunlap
2021-05-31  7:36     ` Geert Uytterhoeven
2021-05-31  7:36       ` Geert Uytterhoeven
2021-05-31 14:34       ` Randy Dunlap
2021-05-31 14:34         ` Randy Dunlap
2021-05-31 14:46         ` Andrew Lunn
2021-05-31 14:46           ` Andrew Lunn
2021-05-31 15:09           ` Geert Uytterhoeven
2021-05-31 15:09             ` Geert Uytterhoeven
2021-05-31  7:29   ` Geert Uytterhoeven
2021-05-31  7:29     ` Geert Uytterhoeven
2021-05-31  7:32     ` Geert Uytterhoeven
2021-05-31  7:32       ` Geert Uytterhoeven
2021-05-31 15:12       ` Randy Dunlap
2021-05-31 15:12         ` Randy Dunlap
2021-05-31 15:45         ` Geert Uytterhoeven
2021-05-31 15:45           ` Geert Uytterhoeven
2021-06-02  3:52           ` Randy Dunlap [this message]
2021-06-02  3:52             ` Randy Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2024-03-23 20:39 kernel test robot
2022-07-16  6:59 kernel test robot
2021-07-24 23:11 kernel test robot
2021-07-24 23:11 ` kernel test robot
2021-07-11  0:49 kernel test robot
2021-07-11  0:49 ` kernel test robot
2021-05-19 23:52 kernel test robot
2021-05-19 23:52 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45d58448-9b6c-d1f5-7e19-7821c9241cff@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=andrew@lunn.ch \
    --cc=dalias@libc.org \
    --cc=david.daney@cavium.com \
    --cc=geert@linux-m68k.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.