tree:
https://git.kernel.org/pub/scm/linux/kernel/git/martineau/linux.git
mptcp-wakeup-squash
head: 6822da7f0ab8a763ae3f89326bc0210d1eaa69a7
commit: 746f3d1d594de82d7889dab9fec32727f1b739d5 [15/19] mptcp: rework mptcp_sendmsg_frag
to accept optional dfrag
config: sh-magicpanelr2_defconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.4.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 746f3d1d594de82d7889dab9fec32727f1b739d5
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
net//mptcp/protocol.c: In function 'mptcp_sendmsg_frag':
> net//mptcp/protocol.c:242:11: error: assignment from incompatible
pointer type [-Werror=incompatible-pointer-types]
poffset =
&pfrag->offset;
^
In file included from include/linux/kernel.h:15:0,
from net//mptcp/protocol.c:9:
net//mptcp/protocol.c: In function 'mptcp_recvmsg':
include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of
type 'long int', but argument 4 has type 'size_t {aka unsigned int}'
[-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/printk.h:137:10: note: in definition of macro 'no_printk'
printk(fmt, ##__VA_ARGS__); \
^~~
include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
#define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
^~~~~~~~
include/linux/printk.h:342:12: note: in expansion of macro 'KERN_DEBUG'
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~
net//mptcp/protocol.c:677:4: note: in expansion of macro 'pr_debug'
pr_debug("Dup data, map len=%d acked=%lld dropped=%ld",
^~~~~~~~
net//mptcp/protocol.c:677:56: note: format string is defined here
pr_debug("Dup data, map len=%d acked=%lld dropped=%ld",
~~^
%d
cc1: some warnings being treated as errors
vim +242 net//mptcp/protocol.c
165
166 static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
167 struct msghdr *msg, struct mptcp_data_frag *dfrag,
168 long *timeo, int *pmss_now,
169 int *ps_goal)
170 {
171 int mss_now, avail_size, size_goal, offset, ret, frag_truesize = 0;
172 bool dfrag_collapsed, collapsed, can_collapse = false;
173 struct mptcp_sock *msk = mptcp_sk(sk);
174 struct mptcp_ext *mpext = NULL;
175 bool retransmission = !!dfrag;
176 struct page_frag *pfrag;
177 struct sk_buff *skb;
178 struct page *page;
179 u64 *write_seq;
180 size_t psize;
181 int *poffset;
182
183 /* use the mptcp page cache so that we can easily move the data
184 * from one substream to another, but do per subflow memory accounting
185 * Note: pfrag is used only !retransmission, but the compiler if
186 * fooled into a warning if we don't init here
187 */
188 pfrag = sk_page_frag(sk);
189 if (!retransmission) {
190 while (!mptcp_page_frag_refill(ssk, pfrag)) {
191 ret = sk_stream_wait_memory(ssk, timeo);
192 if (ret)
193 return ret;
194
195 /* id sk_stream_wait_memory() sleeps snd_una can change
196 * significantly, refresh the rtx queue
197 */
198 mptcp_clean_una(sk);
199 }
200 write_seq = &msk->write_seq;
201 page = pfrag->page;
202 } else {
203 write_seq = &dfrag->data_seq;
204 page = dfrag->page;
205 }
206
207 /* compute copy limit */
208 mss_now = tcp_send_mss(ssk, &size_goal, msg->msg_flags);
209 *pmss_now = mss_now;
210 *ps_goal = size_goal;
211 avail_size = size_goal;
212 skb = tcp_write_queue_tail(ssk);
213 if (skb) {
214 mpext = skb_ext_find(skb, SKB_EXT_MPTCP);
215
216 /* Limit the write to the size available in the
217 * current skb, if any, so that we create at most a new skb.
218 * Explicitly tells TCP internals to avoid collapsing on later
219 * queue management operation, to avoid breaking the ext <->
220 * SSN association set here
221 */
222 can_collapse = (size_goal - skb->len > 0) &&
223 mptcp_skb_can_collapse_to(*write_seq, skb, mpext);
224 if (!can_collapse)
225 TCP_SKB_CB(skb)->eor = 1;
226 else
227 avail_size = size_goal - skb->len;
228 }
229
230 if (!retransmission) {
231 /* reuse tail pfrag, if possible, or carve a new one from the
232 * page allocator
233 */
234 dfrag = mptcp_rtx_tail(sk);
235 offset = pfrag->offset;
236 dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag);
237 if (!dfrag_collapsed) {
238 dfrag = mptcp_carve_data_frag(msk, pfrag, offset);
239 offset = dfrag->offset;
240 frag_truesize = dfrag->overhead;
241 }
242 poffset = &pfrag->offset;
243 psize =
min_t(size_t, pfrag->size - offset, avail_size);
244
245 /* Copy to page */
246 pr_debug("left=%zu", msg_data_left(msg));
247 psize = copy_page_from_iter(pfrag->page, offset,
248 min_t(size_t, msg_data_left(msg),
249 psize),
250 &msg->msg_iter);
251 pr_debug("left=%zu", msg_data_left(msg));
252 if (!psize)
253 return -EINVAL;
254
255 if (!sk_wmem_schedule(sk, psize + dfrag->overhead))
256 return -ENOMEM;
257 } else {
258 offset = dfrag->offset;
259 poffset = &dfrag->offset;
260 psize = min_t(size_t, dfrag->data_len, avail_size);
261 }
262
263 /* tell the TCP stack to delay the push so that we can safely
264 * access the skb after the sendpages call
265 */
266 ret = do_tcp_sendpages(ssk, page, offset, psize,
267 msg->msg_flags | MSG_SENDPAGE_NOTLAST);
268 if (ret <= 0)
269 return ret;
270
271 frag_truesize += ret;
272 if (!retransmission) {
273 if (unlikely(ret < psize))
274 iov_iter_revert(&msg->msg_iter, psize - ret);
275
276 /* send successful, keep track of sent data for mptcp-level
277 * retransmission
278 */
279 dfrag->data_len += ret;
280 if (!dfrag_collapsed) {
281 get_page(dfrag->page);
282 list_add_tail(&dfrag->list, &msk->rtx_queue);
283 }
284
285 /* charge data on mptcp rtx queue to the master socket
286 * Note: we charge such data both to sk and ssk
287 */
288 sk->sk_forward_alloc -= frag_truesize;
289 }
290
291 collapsed = skb == tcp_write_queue_tail(ssk);
292 if (collapsed) {
293 WARN_ON_ONCE(!can_collapse);
294 /* when collapsing mpext always exists */
295 mpext->data_len += ret;
296 goto out;
297 }
298
299 skb = tcp_write_queue_tail(ssk);
300 mpext = skb_ext_add(skb, SKB_EXT_MPTCP);
301 if (mpext) {
302 memset(mpext, 0, sizeof(*mpext));
303 mpext->data_seq = *write_seq;
304 mpext->subflow_seq = mptcp_subflow_ctx(ssk)->rel_write_seq;
305 mpext->data_len = ret;
306 mpext->use_map = 1;
307 mpext->dsn64 = 1;
308
309 pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d",
310 mpext->data_seq, mpext->subflow_seq, mpext->data_len,
311 mpext->dsn64);
312 }
313 /* TODO: else fallback; allocation can fail, but we can't easily retire
314 * skbs from the write_queue, as we need to roll-back TCP status
315 */
316
317 out:
318 *poffset += frag_truesize;
319 *write_seq += ret;
320 mptcp_subflow_ctx(ssk)->rel_write_seq += ret;
321
322 return ret;
323 }
324
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation