[v3] UML: pata_cs5536: fix build for X86_32 UML with TRACEPOINTS

Message ID 20230410011325.26850-1-rdunlap@infradead.org
State New
Headers
Series [v3] UML: pata_cs5536: fix build for X86_32 UML with TRACEPOINTS |

Commit Message

Randy Dunlap April 10, 2023, 1:13 a.m. UTC
  Current build of pata_cs5536 for i386 UML fails with:

ERROR: modpost: "__tracepoint_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
ERROR: modpost: "do_trace_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
ERROR: modpost: "__tracepoint_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
ERROR: modpost: "do_trace_read_msr" [drivers/ata/pata_cs5536.ko] undefined!

Add the arch/x86/lib/msr.o binary to resolve these undefined symbols.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: linux-ide@vger.kernel.org
Cc: linux-um@lists.infradead.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
v2: change from not building on UML to fixing the build on UML
v3: add Rev-by: Damien Le Moal

 arch/x86/um/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

kernel test robot April 11, 2023, 5:01 p.m. UTC | #1
Hi Randy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on uml/next]
[also build test WARNING on uml/fixes wireless-next/main wireless/main linus/master v6.3-rc6 next-20230411]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Randy-Dunlap/UML-pata_cs5536-fix-build-for-X86_32-UML-with-TRACEPOINTS/20230410-091733
base:   git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux next
patch link:    https://lore.kernel.org/r/20230410011325.26850-1-rdunlap%40infradead.org
patch subject: [PATCH v3] UML: pata_cs5536: fix build for X86_32 UML with TRACEPOINTS
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20230412/202304120048.v4uqUq9Q-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/2782ce24954318f1698ec910691250f4d287d817
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Randy-Dunlap/UML-pata_cs5536-fix-build-for-X86_32-UML-with-TRACEPOINTS/20230410-091733
        git checkout 2782ce24954318f1698ec910691250f4d287d817
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=um SUBARCH=i386 olddefconfig
        make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304120048.v4uqUq9Q-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/x86/um/../lib/msr.c:30: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * Read an MSR with error handling
   arch/x86/um/../lib/msr.c:52: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * Write an MSR with error handling
   arch/x86/um/../lib/msr.c:91: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * Set @bit in a MSR @msr.
   arch/x86/um/../lib/msr.c:104: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * Clear @bit in a MSR @msr.


vim +30 arch/x86/um/../lib/msr.c

22085a66c2fab6 Borislav Petkov 2014-03-09  28  
22085a66c2fab6 Borislav Petkov 2014-03-09  29  /**
22085a66c2fab6 Borislav Petkov 2014-03-09 @30   * Read an MSR with error handling
22085a66c2fab6 Borislav Petkov 2014-03-09  31   *
22085a66c2fab6 Borislav Petkov 2014-03-09  32   * @msr: MSR to read
22085a66c2fab6 Borislav Petkov 2014-03-09  33   * @m: value to read into
22085a66c2fab6 Borislav Petkov 2014-03-09  34   *
22085a66c2fab6 Borislav Petkov 2014-03-09  35   * It returns read data only on success, otherwise it doesn't change the output
22085a66c2fab6 Borislav Petkov 2014-03-09  36   * argument @m.
22085a66c2fab6 Borislav Petkov 2014-03-09  37   *
22085a66c2fab6 Borislav Petkov 2014-03-09  38   */
3e7bbe15ed84e3 Zhao Xuehui     2021-04-08  39  static int msr_read(u32 msr, struct msr *m)
22085a66c2fab6 Borislav Petkov 2014-03-09  40  {
22085a66c2fab6 Borislav Petkov 2014-03-09  41  	int err;
22085a66c2fab6 Borislav Petkov 2014-03-09  42  	u64 val;
22085a66c2fab6 Borislav Petkov 2014-03-09  43  
22085a66c2fab6 Borislav Petkov 2014-03-09  44  	err = rdmsrl_safe(msr, &val);
22085a66c2fab6 Borislav Petkov 2014-03-09  45  	if (!err)
22085a66c2fab6 Borislav Petkov 2014-03-09  46  		m->q = val;
22085a66c2fab6 Borislav Petkov 2014-03-09  47  
22085a66c2fab6 Borislav Petkov 2014-03-09  48  	return err;
22085a66c2fab6 Borislav Petkov 2014-03-09  49  }
22085a66c2fab6 Borislav Petkov 2014-03-09  50
  
Johannes Berg April 14, 2023, 1:55 p.m. UTC | #2
On Sun, 2023-04-09 at 18:13 -0700, Randy Dunlap wrote:
> Current build of pata_cs5536 for i386 UML fails with:
> 
> ERROR: modpost: "__tracepoint_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
> ERROR: modpost: "do_trace_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
> ERROR: modpost: "__tracepoint_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
> ERROR: modpost: "do_trace_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
> 
> Add the arch/x86/lib/msr.o binary to resolve these undefined symbols.
> 

Hm. Does this make sense? I can't see it'd work on UML to configure an
IDE device through MSRs? Surely that can't work? IOW, that entire driver
can't really work anyway can it?

OTOH, maybe theoretically it could work in PCI, just not with MSRs, and
then this patch makes some sense?

johannes
  
Randy Dunlap April 14, 2023, 3:29 p.m. UTC | #3
On 4/14/23 06:55, Johannes Berg wrote:
> On Sun, 2023-04-09 at 18:13 -0700, Randy Dunlap wrote:
>> Current build of pata_cs5536 for i386 UML fails with:
>>
>> ERROR: modpost: "__tracepoint_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
>> ERROR: modpost: "do_trace_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
>> ERROR: modpost: "__tracepoint_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
>> ERROR: modpost: "do_trace_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
>>
>> Add the arch/x86/lib/msr.o binary to resolve these undefined symbols.
>>
> 
> Hm. Does this make sense? I can't see it'd work on UML to configure an
> IDE device through MSRs? Surely that can't work? IOW, that entire driver
> can't really work anyway can it?
> 
> OTOH, maybe theoretically it could work in PCI, just not with MSRs, and
> then this patch makes some sense?

Hi,
I was happy with v1, which just did "depends on !UML".
Anyway, I'll drop this part of the quest to make UML build cleanly.

Thanks.
  
Christoph Hellwig April 16, 2023, 6:20 a.m. UTC | #4
On Fri, Apr 14, 2023 at 03:55:07PM +0200, Johannes Berg wrote:
> On Sun, 2023-04-09 at 18:13 -0700, Randy Dunlap wrote:
> > Current build of pata_cs5536 for i386 UML fails with:
> > 
> > ERROR: modpost: "__tracepoint_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > ERROR: modpost: "do_trace_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > ERROR: modpost: "__tracepoint_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > ERROR: modpost: "do_trace_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > 
> > Add the arch/x86/lib/msr.o binary to resolve these undefined symbols.
> > 
> 
> Hm. Does this make sense? I can't see it'd work on UML to configure an
> IDE device through MSRs? Surely that can't work? IOW, that entire driver
> can't really work anyway can it?
> 
> OTOH, maybe theoretically it could work in PCI, just not with MSRs, and
> then this patch makes some sense?

I think it is is integrated into actual Geode SOCs.  That being
said something like the patch below seems as simple as it gets and
at least gives build coverage on uml

diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index ab47aeb5587f55..4f5d9afd51c9d8 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -27,7 +27,7 @@
 #include <scsi/scsi_host.h>
 #include <linux/dmi.h>
 
-#ifdef CONFIG_X86_32
+#if defined(CONFIG_X86_32) && !defined(CONFIG_UML)
 #include <asm/msr.h>
 static int use_msr;
 module_param_named(msr, use_msr, int, 0644);
  
Geert Uytterhoeven April 16, 2023, 9:43 a.m. UTC | #5
Hi Christoph,

On Sun, Apr 16, 2023 at 8:20 AM Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Apr 14, 2023 at 03:55:07PM +0200, Johannes Berg wrote:
> > On Sun, 2023-04-09 at 18:13 -0700, Randy Dunlap wrote:
> > > Current build of pata_cs5536 for i386 UML fails with:
> > >
> > > ERROR: modpost: "__tracepoint_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > > ERROR: modpost: "do_trace_write_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > > ERROR: modpost: "__tracepoint_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > > ERROR: modpost: "do_trace_read_msr" [drivers/ata/pata_cs5536.ko] undefined!
> > >
> > > Add the arch/x86/lib/msr.o binary to resolve these undefined symbols.
> > >
> >
> > Hm. Does this make sense? I can't see it'd work on UML to configure an
> > IDE device through MSRs? Surely that can't work? IOW, that entire driver
> > can't really work anyway can it?
> >
> > OTOH, maybe theoretically it could work in PCI, just not with MSRs, and
> > then this patch makes some sense?
>
> I think it is is integrated into actual Geode SOCs.  That being
> said something like the patch below seems as simple as it gets and
> at least gives build coverage on uml

CS5536 is the Geode Companion Device, i.e. the South Bridge, which
can be used with other devices, AFAIK.

Gr{oetje,eeting}s,

                        Geert
  

Patch

diff -- a/arch/x86/um/Makefile b/arch/x86/um/Makefile
--- a/arch/x86/um/Makefile
+++ b/arch/x86/um/Makefile
@@ -21,7 +21,7 @@  obj-y += checksum_32.o syscalls_32.o
 obj-$(CONFIG_ELF_CORE) += elfcore.o
 
 subarch-y = ../lib/string_32.o ../lib/atomic64_32.o ../lib/atomic64_cx8_32.o
-subarch-y += ../lib/cmpxchg8b_emu.o ../lib/atomic64_386_32.o
+subarch-y += ../lib/cmpxchg8b_emu.o ../lib/atomic64_386_32.o ../lib/msr.o
 subarch-y += ../kernel/sys_ia32.o
 
 else