[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202204051450.UN2k1raL-lkp@intel.com>
Date: Tue, 5 Apr 2022 14:52:28 +0800
From: kernel test robot <lkp@...el.com>
To: guoren@...nel.org, arnd@...db.de
Cc: kbuild-all@...ts.01.org, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-csky@...r.kernel.org,
Matteo Croce <mcroce@...rosoft.com>,
Guo Ren <guoren@...ux.alibaba.com>
Subject: Re: [PATCH] csky: Add C based string functions
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on soc/for-next]
[also build test WARNING on linus/master linux/master v5.18-rc1 next-20220404]
[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-Add-C-based-string-functions/20220404-222518
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
config: csky-defconfig (https://download.01.org/0day-ci/archive/20220405/202204051450.UN2k1raL-lkp@intel.com/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/e8231df5e8121c094f8668e0c850381873aa4249
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review guoren-kernel-org/csky-Add-C-based-string-functions/20220404-222518
git checkout e8231df5e8121c094f8668e0c850381873aa4249
# 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
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> arch/csky/lib/string.c:30:7: warning: no previous prototype for '__memcpy' [-Wmissing-prototypes]
30 | void *__memcpy(void *dest, const void *src, size_t count)
| ^~~~~~~~
>> arch/csky/lib/string.c:94:7: warning: no previous prototype for '__memmove' [-Wmissing-prototypes]
94 | void *__memmove(void *dest, const void *src, size_t count)
| ^~~~~~~~~
>> arch/csky/lib/string.c:113:7: warning: no previous prototype for '__memset' [-Wmissing-prototypes]
113 | void *__memset(void *s, int c, size_t count)
| ^~~~~~~~
vim +/__memcpy +30 arch/csky/lib/string.c
29
> 30 void *__memcpy(void *dest, const void *src, size_t count)
31 {
32 union const_types s = { .as_u8 = src };
33 union types d = { .as_u8 = dest };
34 int distance = 0;
35
36 if (count < MIN_THRESHOLD)
37 goto copy_remainder;
38
39 /* Copy a byte at time until destination is aligned. */
40 for (; d.as_uptr & WORD_MASK; count--)
41 *d.as_u8++ = *s.as_u8++;
42
43 distance = s.as_uptr & WORD_MASK;
44
45 if (distance) {
46 unsigned long last, next;
47
48 /*
49 * s is distance bytes ahead of d, and d just reached
50 * the alignment boundary. Move s backward to word align it
51 * and shift data to compensate for distance, in order to do
52 * word-by-word copy.
53 */
54 s.as_u8 -= distance;
55
56 next = s.as_ulong[0];
57 for (; count >= BYTES_LONG; count -= BYTES_LONG) {
58 last = next;
59 next = s.as_ulong[1];
60
61 d.as_ulong[0] = last >> (distance * 8) |
62 next << ((BYTES_LONG - distance) * 8);
63
64 d.as_ulong++;
65 s.as_ulong++;
66 }
67
68 /* Restore s with the original offset. */
69 s.as_u8 += distance;
70 } else {
71 /*
72 * If the source and dest lower bits are the same, do a simple
73 * 32/64 bit wide copy.
74 */
75 for (; count >= BYTES_LONG; count -= BYTES_LONG)
76 *d.as_ulong++ = *s.as_ulong++;
77 }
78
79 copy_remainder:
80 while (count--)
81 *d.as_u8++ = *s.as_u8++;
82
83 return dest;
84 }
85 EXPORT_SYMBOL(__memcpy);
86
87 void *memcpy(void *dest, const void *src, size_t count) __weak __alias(__memcpy);
88 EXPORT_SYMBOL(memcpy);
89
90 /*
91 * Simply check if the buffer overlaps an call memcpy() in case,
92 * otherwise do a simple one byte at time backward copy.
93 */
> 94 void *__memmove(void *dest, const void *src, size_t count)
95 {
96 if (dest < src || src + count <= dest)
97 return memcpy(dest, src, count);
98
99 if (dest > src) {
100 const char *s = src + count;
101 char *tmp = dest + count;
102
103 while (count--)
104 *--tmp = *--s;
105 }
106 return dest;
107 }
108 EXPORT_SYMBOL(__memmove);
109
110 void *memmove(void *dest, const void *src, size_t count) __weak __alias(__memmove);
111 EXPORT_SYMBOL(memmove);
112
> 113 void *__memset(void *s, int c, size_t count)
114 {
115 union types dest = { .as_u8 = s };
116
117 if (count >= MIN_THRESHOLD) {
118 unsigned long cu = (unsigned long)c;
119
120 /* Compose an ulong with 'c' repeated 4/8 times */
121 cu |= cu << 8;
122 cu |= cu << 16;
123 /* Suppress warning on 32 bit machines */
124 cu |= (cu << 16) << 16;
125
126 for (; count && dest.as_uptr & WORD_MASK; count--)
127 *dest.as_u8++ = c;
128
129 /* Copy using the largest size allowed */
130 for (; count >= BYTES_LONG; count -= BYTES_LONG)
131 *dest.as_ulong++ = cu;
132 }
133
134 /* copy the remainder */
135 while (count--)
136 *dest.as_u8++ = c;
137
138 return s;
139 }
140 EXPORT_SYMBOL(__memset);
141
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists