tree:
https://android.googlesource.com/kernel/common android13-5.15
head: 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7
commit: 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7 [2/2] ANDROID: logbuf: Add new logbuf
vendor hook to support pr_cont()
config: i386-defconfig
(
https://download.01.org/0day-ci/archive/20211124/202111240531.hOaDqBP8-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
git remote add android-common
https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android13-5.15
git checkout 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7
# save the config file to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
kernel/printk/printk.c: In function 'printk_sprint':
kernel/printk/printk.c:2078:2: warning: function 'printk_sprint' might be a
candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
2078 | text_len = vscnprintf(text, size, fmt, args);
| ^~~~~~~~
kernel/printk/printk.c: In function 'vprintk_store':
> kernel/printk/printk.c:2167:4: error: implicit declaration of
function 'trace_android_vh_logbuf_pr_cont'; did you mean
'trace_android_vh_logbuf'? [-Werror=implicit-function-declaration]
2167
| trace_android_vh_logbuf_pr_cont(&r, text_len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| trace_android_vh_logbuf
cc1: some warnings being treated as errors
vim +2167 kernel/printk/printk.c
2071
2072 static u16 printk_sprint(char *text, u16 size, int facility,
2073 enum printk_info_flags *flags, const char *fmt,
2074 va_list args)
2075 {
2076 u16 text_len;
2077
2078 text_len = vscnprintf(text, size, fmt, args);
2079
2080 /* Mark and strip a trailing newline. */
2081 if (text_len && text[text_len - 1] == '\n') {
2082 text_len--;
2083 *flags |= LOG_NEWLINE;
2084 }
2085
2086 /* Strip log level and control flags. */
2087 if (facility == 0) {
2088 u16 prefix_len;
2089
2090 prefix_len = printk_parse_prefix(text, NULL, NULL);
2091 if (prefix_len) {
2092 text_len -= prefix_len;
2093 memmove(text, text + prefix_len, text_len);
2094 }
2095 }
2096
2097 return text_len;
2098 }
2099
2100 __printf(4, 0)
2101 int vprintk_store(int facility, int level,
2102 const struct dev_printk_info *dev_info,
2103 const char *fmt, va_list args)
2104 {
2105 const u32 caller_id = printk_caller_id();
2106 struct prb_reserved_entry e;
2107 enum printk_info_flags flags = 0;
2108 struct printk_record r;
2109 unsigned long irqflags;
2110 u16 trunc_msg_len = 0;
2111 char prefix_buf[8];
2112 u8 *recursion_ptr;
2113 u16 reserve_size;
2114 va_list args2;
2115 u16 text_len;
2116 int ret = 0;
2117 u64 ts_nsec;
2118
2119 /*
2120 * Since the duration of printk() can vary depending on the message
2121 * and state of the ringbuffer, grab the timestamp now so that it is
2122 * close to the call of printk(). This provides a more deterministic
2123 * timestamp with respect to the caller.
2124 */
2125 ts_nsec = local_clock();
2126
2127 if (!printk_enter_irqsave(recursion_ptr, irqflags))
2128 return 0;
2129
2130 /*
2131 * The sprintf needs to come first since the syslog prefix might be
2132 * passed in as a parameter. An extra byte must be reserved so that
2133 * later the vscnprintf() into the reserved buffer has room for the
2134 * terminating '\0', which is not counted by vsnprintf().
2135 */
2136 va_copy(args2, args);
2137 reserve_size = vsnprintf(&prefix_buf[0], sizeof(prefix_buf), fmt, args2) + 1;
2138 va_end(args2);
2139
2140 if (reserve_size > LOG_LINE_MAX)
2141 reserve_size = LOG_LINE_MAX;
2142
2143 /* Extract log level or control flags. */
2144 if (facility == 0)
2145 printk_parse_prefix(&prefix_buf[0], &level, &flags);
2146
2147 if (level == LOGLEVEL_DEFAULT)
2148 level = default_message_loglevel;
2149
2150 if (dev_info)
2151 flags |= LOG_NEWLINE;
2152
2153 if (flags & LOG_CONT) {
2154 prb_rec_init_wr(&r, reserve_size);
2155 if (prb_reserve_in_last(&e, prb, &r, caller_id, LOG_LINE_MAX)) {
2156 text_len = printk_sprint(&r.text_buf[r.info->text_len], reserve_size,
2157 facility, &flags, fmt, args);
2158 r.info->text_len += text_len;
2159
2160 if (flags & LOG_NEWLINE) {
2161 r.info->flags |= LOG_NEWLINE;
2162 prb_final_commit(&e);
2163 } else {
2164 prb_commit(&e);
2165 }
2166
2167 trace_android_vh_logbuf_pr_cont(&r, text_len);
2168 ret = text_len;
2169 goto out;
2170 }
2171 }
2172
2173 /*
2174 * Explicitly initialize the record before every prb_reserve() call.
2175 * prb_reserve_in_last() and prb_reserve() purposely invalidate the
2176 * structure when they fail.
2177 */
2178 prb_rec_init_wr(&r, reserve_size);
2179 if (!prb_reserve(&e, prb, &r)) {
2180 /* truncate the message if it is too long for empty buffer */
2181 truncate_msg(&reserve_size, &trunc_msg_len);
2182
2183 prb_rec_init_wr(&r, reserve_size + trunc_msg_len);
2184 if (!prb_reserve(&e, prb, &r))
2185 goto out;
2186 }
2187
2188 /* fill message */
2189 text_len = printk_sprint(&r.text_buf[0], reserve_size, facility, &flags,
fmt, args);
2190 if (trunc_msg_len)
2191 memcpy(&r.text_buf[text_len], trunc_msg, trunc_msg_len);
2192 r.info->text_len = text_len + trunc_msg_len;
2193 r.info->facility = facility;
2194 r.info->level = level & 7;
2195 r.info->flags = flags & 0x1f;
2196 r.info->ts_nsec = ts_nsec;
2197 r.info->caller_id = caller_id;
2198 if (dev_info)
2199 memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));
2200
2201 /* A message without a trailing newline can be continued. */
2202 if (!(flags & LOG_NEWLINE))
2203 prb_commit(&e);
2204 else
2205 prb_final_commit(&e);
2206
2207 trace_android_vh_logbuf(prb, &r);
2208 ret = text_len + trunc_msg_len;
2209 out:
2210 printk_exit_irqrestore(recursion_ptr, irqflags);
2211 return ret;
2212 }
2213
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org