From: kernel test robot <lkp@intel.com>
To: guoren@kernel.org, arnd@arndb.de
Cc: kbuild-all@lists.01.org, linux-arch@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org,
Matteo Croce <mcroce@microsoft.com>,
Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH] csky: Add C based string functions
Date: Tue, 5 Apr 2022 14:52:28 +0800 [thread overview]
Message-ID: <202204051450.UN2k1raL-lkp@intel.com> (raw)
In-Reply-To: <20220404142354.2792428-1-guoren@kernel.org>
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@intel.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
prev parent reply other threads:[~2022-04-05 6:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 14:23 [PATCH] csky: Add C based string functions guoren
2022-04-05 6:52 ` kernel test robot [this message]
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=202204051450.UN2k1raL-lkp@intel.com \
--to=lkp@intel.com \
--cc=arnd@arndb.de \
--cc=guoren@kernel.org \
--cc=guoren@linux.alibaba.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcroce@microsoft.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox