csky: optimize memcpy_{from,to}io() and memset_io()
Subsystems (2)
[email protected]
maintainerPATCH 1/1 csky: optimize memcpy_{from,to}io() and memset_io()
From: Guo Ren <[email protected]>
Optimize memcpy_{from,to}io() and memset_io() by transferring in 64 bit as much as possible with minimized barrier usage. This simplest optimization brings faster throughput compare to current byte-by-byte read and write with barrier in the loop. Code's skeleton is taken from the powerpc & arm64.
--- arch/csky/include/asm/io.h | 11 +++++ arch/csky/kernel/io.c | 91 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 arch/csky/kernel/io.c
arch/csky/include/asm/io.h +11 -0
@@ -32,6 +32,17 @@#define writel (v,c) ({ wmb(); writel_relaxed((v),(c)); mb(); })#endif +/* +* String version of I/O memory access operations. +*/ +extern void __memcpy_fromio (void *,const volatile void __iomem *,size_t ); +extern void __memcpy_toio (volatile void __iomem *,const void *,size_t ); +extern void __memset_io (volatile void __iomem *,int ,size_t ); + +#define memset_io (c,v,l) __memset_io((c),(v),(l)) +#define memcpy_fromio (a,c,l) __memcpy_fromio((a),(c),(l)) +#define memcpy_toio (c,a,l) __memcpy_toio((c),(a),(l)) +/* * I/O memory mapping functions. */
arch/csky/kernel/io.c new file +91 -0
91 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botI love your patch! Yet something to improve:
Hi,
I love your patch! Yet something to improve:
[auto build test ERROR on soc/for-next]
[also build test ERROR on linus/master linux/master v5.18-rc1 next-20220405] [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]
url: https://github.com/intel-lab-lkp/linux/commits/guoren-kernel-org/csky-optimize-memcpy_-from-to-io-and-memset_io/20220404-224954 base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next config: csky-randconfig-r034-20220405 (https://download.01.org/0day-ci/archive/20220405/[email protected]/config) compiler: csky-linux-gcc (GCC) 11.2.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://github.com/intel-lab-lkp/linux/commit/2e50048555b298851590ec8272100b595b8801f9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review guoren-kernel-org/csky-optimize-memcpy_-from-to-io-and-memset_io/20220404-224954 git checkout 2e50048555b298851590ec8272100b595b8801f9
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=csky SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
csky-linux-ld: drivers/bus/mhi/core/init.o: in function `mhi_prepare_for_power_up':
>> init.c:(.text+0xfaa): undefined reference to `__memset_io' >> csky-linux-ld: init.c:(.text+0x1028): undefined reference to `__memset_io' csky-linux-ld: drivers/pci/pci-sysfs.o: in function `pci_read_rom': pci-sysfs.c:(.text+0x3a6): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/pci/pci-sysfs.o: in function `pci_write_config': pci-sysfs.c:(.text+0x534): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/pci/switch/switchtec.o: in function `io_string_show': switchtec.c:(.text+0x7a2): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/pci/switch/switchtec.o: in function `vendor_id_show': switchtec.c:(.text+0x89c): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/pci/switch/switchtec.o: in function `mrpc_cmd_submit.part.0': switchtec.c:(.text+0x1c64): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/pci/switch/switchtec.o: in function `switchtec_dev_write': switchtec.c:(.text+0x1dbc): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/pci/switch/switchtec.o: in function `mrpc_complete_cmd': switchtec.c:(.text+0x1f78): undefined reference to `__memcpy_fromio' csky-linux-ld: switchtec.c:(.text+0x1f8c): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/soc/fsl/dpaa2-console.o: in function `dpaa2_console_read': dpaa2-console.c:(.text+0xd8): undefined reference to `__memcpy_fromio' csky-linux-ld: dpaa2-console.c:(.text+0x112): undefined reference to `__memcpy_fromio' csky-linux-ld: dpaa2-console.c:(.text+0x1b0): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/misc/sram.o: in function `sram_write': sram.c:(.text+0xa8): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/misc/sram.o: in function `sram_read': sram.c:(.text+0xe8): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/misc/sram.o: in function `kmalloc_array.constprop.0': sram.c:(.text+0x15c): undefined reference to `__memcpy_toio' csky-linux-ld: sram.c:(.text+0x164): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/ntb/test/ntb_tool.o: in function `tool_peer_mw_write': >> ntb_tool.c:(.text+0xee6): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/ntb/test/ntb_tool.o: in function `tool_peer_mw_read': ntb_tool.c:(.text+0xf70): undefined reference to `__memcpy_toio' >> csky-linux-ld: ntb_tool.c:(.text+0xf7c): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/ntb/test/ntb_tool.o: in function `ntb_peer_port_number': >> ntb_tool.c:(.text+0x1018): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/ntb/test/ntb_perf.o: in function `perf_copy_chunk': >> ntb_perf.c:(.text+0x20ca): undefined reference to `__memcpy_toio' >> csky-linux-ld: ntb_perf.c:(.text+0x211c): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/ntb/ntb_transport.o: in function `ntb_memcpy_tx': >> ntb_transport.c:(.text+0x9ba): undefined reference to `__memcpy_toio' >> csky-linux-ld: ntb_transport.c:(.text+0xa04): undefined reference to `__memcpy_toio' csky-linux-ld: sound/pci/rme96.o: in function `snd_rme96_capture_copy_kernel': >> rme96.c:(.text+0x74e): undefined reference to `__memcpy_fromio' csky-linux-ld: sound/pci/rme96.o: in function `snd_rme96_capture_copy': rme96.c:(.text+0x784): undefined reference to `__memcpy_fromio' csky-linux-ld: sound/pci/rme96.o: in function `snd_rme96_playback_copy_kernel': >> rme96.c:(.text+0x87e): undefined reference to `__memcpy_toio' csky-linux-ld: sound/pci/rme96.o: in function `snd_rme96_playback_silence': >> rme96.c:(.text+0x8c6): undefined reference to `__memset_io' >> csky-linux-ld: rme96.c:(.text+0x8f4): undefined reference to `__memcpy_toio' >> csky-linux-ld: rme96.c:(.text+0x8fc): undefined reference to `__memset_io' csky-linux-ld: sound/soc/fsl/fsl_xcvr.o: in function `irq0_isr': >> fsl_xcvr.c:(.text+0x52c): undefined reference to `__memcpy_fromio' >> csky-linux-ld: fsl_xcvr.c:(.text+0x546): undefined reference to `__memcpy_fromio' >> csky-linux-ld: fsl_xcvr.c:(.text+0x588): undefined reference to `__memset_io' csky-linux-ld: fsl_xcvr.c:(.text+0x6a4): undefined reference to `__memcpy_fromio' csky-linux-ld: fsl_xcvr.c:(.text+0x6ac): undefined reference to `__memset_io' csky-linux-ld: fsl_xcvr.c:(.text+0x6f2): undefined reference to `__memcpy_fromio' csky-linux-ld: fsl_xcvr.c:(.text+0x72c): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/dma/ti/edma.o: in function `edma_write_slot': edma.c:(.text+0x158): undefined reference to `__memcpy_toio' csky-linux-ld: edma.c:(.text+0x174): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/dma/ti/edma.o: in function `dma_ccerr_handler': edma.c:(.text+0x24c8): undefined reference to `__memcpy_fromio' >> csky-linux-ld: edma.c:(.text+0x2548): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/tty/serial/jsm/jsm_neo.o: in function `neo_copy_data_from_queue_to_uart': >> jsm_neo.c:(.text+0x624): undefined reference to `__memcpy_toio' >> csky-linux-ld: jsm_neo.c:(.text+0x69c): undefined reference to `__memcpy_toio'
csky-linux-ld: drivers/tty/serial/jsm/jsm_neo.o: in function `neo_copy_data_from_uart_to_queue':
jsm_neo.c:(.text+0x8ce): undefined reference to `__memcpy_fromio'
csky-linux-ld: jsm_neo.c:(.text+0x93a): undefined reference to `__memcpy_fromio'
csky-linux-ld: jsm_neo.c:(.text+0x960): undefined reference to `__memcpy_fromio'
csky-linux-ld: jsm_neo.c:(.text+0x9fe): undefined reference to `__memcpy_fromio'
csky-linux-ld: jsm_neo.c:(.text+0xa94): undefined reference to `__memcpy_fromio'
csky-linux-ld: drivers/misc/habanalabs/common/firmware_if.o: in function `hl_fw_copy_fw_to_device':
firmware_if.c:(.text+0x106): undefined reference to `__memcpy_toio'
csky-linux-ld: drivers/misc/habanalabs/common/firmware_if.o: in function `usleep_range':
firmware_if.c:(.text+0x130): undefined reference to `__memcpy_toio'
csky-linux-ld: drivers/misc/habanalabs/common/firmware_if.o: in function `hl_fw_static_init_cpu':
firmware_if.c:(.text+0xafa): undefined reference to `__memcpy_fromio'
csky-linux-ld: firmware_if.c:(.text+0xb60): undefined reference to `__memcpy_fromio'
csky-linux-ld: drivers/misc/habanalabs/common/firmware_if.o: in function `hl_fw_read_preboot_status':
firmware_if.c:(.text+0x2208): undefined reference to `__memcpy_fromio'
csky-linux-ld: firmware_if.c:(.text+0x2290): undefined reference to `__memcpy_fromio'
csky-linux-ld: drivers/misc/habanalabs/common/firmware_if.o: in function `hl_fw_dynamic_request_descriptor':
firmware_if.c:(.text.unlikely+0x530): undefined reference to `__memcpy_fromio'
csky-linux-ld: drivers/misc/habanalabs/common/firmware_if.o:firmware_if.c:(.text.unlikely+0x628): more undefined references to `__memcpy_fromio' follow
csky-linux-ld: drivers/misc/habanalabs/common/firmware_if.o: in function `hl_fw_dynamic_send_msg.constprop.0':
firmware_if.c:(.text.unlikely+0x7dc): undefined reference to `__memcpy_toio'
csky-linux-ld: firmware_if.c:(.text.unlikely+0x86c): undefined reference to `__memcpy_toio'
csky-linux-ld: drivers/misc/habanalabs/goya/goya.o: in function `goya_pqe_write':
goya.c:(.text+0x3148): undefined reference to `__memcpy_toio'
csky-linux-ld: drivers/misc/habanalabs/goya/goya.o: in function `goya_get_dma_desc_list_size':
goya.c:(.text+0x3240): undefined reference to `__memcpy_toio'
csky-linux-ld: sound/core/memory.o: in function `copy_to_user_fromio':
memory.c:(.text+0x6e): undefined reference to `__memcpy_fromio'
csky-linux-ld: sound/core/memory.o: in function `copy_from_user_toio':
memory.c:(.text+0x116): undefined reference to `__memcpy_toio'
csky-linux-ld: memory.c:(.text+0x14c): undefined reference to `__memcpy_fromio'
csky-linux-ld: memory.c:(.text+0x15c): undefined reference to `__memcpy_toio'
csky-linux-ld: sound/pci/mixart/mixart_core.o: in function `get_msg.constprop.0':
mixart_core.c:(.text+0x29c): undefined reference to `__memcpy_fromio'
csky-linux-ld: mixart_core.c:(.text+0x310): undefined reference to `__memcpy_fromio'
csky-linux-ld: sound/pci/mixart/mixart_hwdep.o: in function `mixart_dsp_load':
mixart_hwdep.c:(.text+0x538): undefined reference to `__memcpy_toio'
csky-linux-ld: mixart_hwdep.c:(.text+0x59c): undefined reference to `__memcpy_toio'
csky-linux-ld: mixart_hwdep.c:(.text+0x67e): undefined reference to `__memcpy_toio'
csky-linux-ld: mixart_hwdep.c:(.text+0x710): undefined reference to `__memcpy_toio'
csky-linux-ld: mixart_hwdep.c:(.text+0x776): undefined reference to `__memcpy_toio'
csky-linux-ld: sound/pci/mixart/mixart_hwdep.o:mixart_hwdep.c:(.text+0x888): more undefined references to `__memcpy_toio' follow
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
kernel test robot
build botI love your patch! Yet something to improve:
Hi,
I love your patch! Yet something to improve:
[auto build test ERROR on soc/for-next]
[also build test ERROR on linus/master linux/master v5.18-rc1 next-20220405] [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]
url: https://github.com/intel-lab-lkp/linux/commits/guoren-kernel-org/csky-optimize-memcpy_-from-to-io-and-memset_io/20220404-224954 base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next config: csky-randconfig-r022-20220405 (https://download.01.org/0day-ci/archive/20220405/[email protected]/config) compiler: csky-linux-gcc (GCC) 11.2.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://github.com/intel-lab-lkp/linux/commit/2e50048555b298851590ec8272100b595b8801f9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review guoren-kernel-org/csky-optimize-memcpy_-from-to-io-and-memset_io/20220404-224954 git checkout 2e50048555b298851590ec8272100b595b8801f9
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=csky SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
csky-linux-ld: drivers/bus/mhi/core/init.o: in function `mhi_prepare_for_power_up':
>> init.c:(.text+0xa50): undefined reference to `__memset_io' >> csky-linux-ld: init.c:(.text+0xaa8): undefined reference to `__memset_io' csky-linux-ld: drivers/pci/pci-sysfs.o: in function `pci_read_rom': >> pci-sysfs.c:(.text+0x2b8): undefined reference to `__memcpy_fromio' >> csky-linux-ld: pci-sysfs.c:(.text+0x2f4): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/soc/fsl/dpaa2-console.o: in function `dpaa2_console_read': dpaa2-console.c:(.text+0xbc): undefined reference to `__memcpy_fromio' csky-linux-ld: dpaa2-console.c:(.text+0xee): undefined reference to `__memcpy_fromio' csky-linux-ld: dpaa2-console.c:(.text+0x16c): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/misc/hpilo.o: in function `ilo_ccb_close': >> hpilo.c:(.text+0x204): undefined reference to `__memset_io' csky-linux-ld: drivers/misc/hpilo.o: in function `ilo_poll': hpilo.c:(.text+0x31c): undefined reference to `__memset_io' csky-linux-ld: drivers/misc/hpilo.o: in function `ilo_open': >> hpilo.c:(.text+0xc3c): undefined reference to `__memcpy_toio' >> csky-linux-ld: hpilo.c:(.text+0xd1c): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/scsi/smartpqi/smartpqi_init.o: in function `pqi_process_firmware_features': >> smartpqi_init.c:(.text+0x3a92): undefined reference to `__memcpy_toio' >> csky-linux-ld: smartpqi_init.c:(.text+0x3b30): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/scsi/smartpqi/smartpqi_init.o: in function `pqi_process_config_table': >> smartpqi_init.c:(.text+0x3bda): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/scsi/smartpqi/smartpqi_init.o: in function `pqi_configure_events.constprop.0': smartpqi_init.c:(.text+0x3d68): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/scsi/hptiop.o: in function `mv_inbound_write': >> hptiop.c:(.text+0x90e): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/scsi/hptiop.o: in function `hptiop_post_req_mv': hptiop.c:(.text+0x9b4): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/scsi/hptiop.o: in function `hptiop_request_callback_itl': >> hptiop.c:(.text+0xa58): undefined reference to `__memcpy_fromio' >> csky-linux-ld: hptiop.c:(.text+0xa88): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/scsi/hptiop.o: in function `iop_intr_mv': hptiop.c:(.text+0xd48): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/scsi/hptiop.o: in function `iop_intr_itl': hptiop.c:(.text+0xe10): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/scsi/hptiop.o: in function `iop_get_config_itl': hptiop.c:(.text+0x123a): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/scsi/hptiop.o: in function `iop_set_config_itl': hptiop.c:(.text+0x1278): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/scsi/hptiop.o: in function `dma_alloc_coherent.constprop.0': hptiop.c:(.text+0x12ec): undefined reference to `__memcpy_fromio' >> csky-linux-ld: hptiop.c:(.text+0x12f0): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/net/wan/pc300too.o: in function `sca_rx_done': >> pc300too.c:(.text+0xbfa): undefined reference to `__memcpy_fromio' >> csky-linux-ld: pc300too.c:(.text+0xc64): undefined reference to `__memcpy_fromio' csky-linux-ld: drivers/net/wan/pc300too.o: in function `sca_xmit': >> pc300too.c:(.text+0xd40): undefined reference to `__memcpy_toio' csky-linux-ld: drivers/net/wan/pc300too.o: in function `sca_poll': pc300too.c:(.text+0xf30): undefined reference to `__memcpy_toio' csky-linux-ld: fs/pstore/ram_core.o: in function `persistent_ram_update': >> ram_core.c:(.text+0x164): undefined reference to `__memcpy_toio' >> csky-linux-ld: ram_core.c:(.text+0x18c): undefined reference to `__memcpy_toio' csky-linux-ld: fs/pstore/ram_core.o: in function `persistent_ram_save_old': >> ram_core.c:(.text+0x4f2): undefined reference to `__memcpy_fromio'
csky-linux-ld: ram_core.c:(.text+0x500): undefined reference to `__memcpy_fromio'
csky-linux-ld: fs/pstore/ram_core.o: in function `persistent_ram_write_user':
ram_core.c:(.text+0x5e0): undefined reference to `__memcpy_fromio'
csky-linux-ld: drivers/scsi/sym53c8xx_2/sym_hipd.o: in function `sym_start_up':
sym_hipd.c:(.text+0x3e3e): undefined reference to `__memcpy_toio'
csky-linux-ld: sym_hipd.c:(.text+0x3e60): undefined reference to `__memcpy_toio'
csky-linux-ld: sym_hipd.c:(.text+0x3fc8): undefined reference to `__memcpy_toio'
csky-linux-ld: drivers/remoteproc/remoteproc_coredump.o: in function `rproc_copy_segment':
remoteproc_coredump.c:(.text+0xb8): undefined reference to `__memcpy_fromio'
csky-linux-ld: remoteproc_coredump.c:(.text+0xd4): undefined reference to `__memcpy_fromio'
csky-linux-ld: drivers/remoteproc/remoteproc_elf_loader.o: in function `rproc_elf_load_segments':
remoteproc_elf_loader.c:(.text+0x328): undefined reference to `__memcpy_toio'
csky-linux-ld: remoteproc_elf_loader.c:(.text+0x34c): undefined reference to `__memset_io'
csky-linux-ld: remoteproc_elf_loader.c:(.text+0x378): undefined reference to `__memcpy_toio'
csky-linux-ld: remoteproc_elf_loader.c:(.text+0x37c): undefined reference to `__memset_io'
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp