Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2838485pxb; Tue, 13 Apr 2021 11:21:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMxoPeD1LedtxqNVcj9ppmIRhsD338rqeTDVk8n6tB0+VDEpjd9qD6jZLFzcsoKBYx9+Qe X-Received: by 2002:a17:90a:c08f:: with SMTP id o15mr1425183pjs.22.1618338089899; Tue, 13 Apr 2021 11:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618338089; cv=none; d=google.com; s=arc-20160816; b=QYFsSGbdCBk2aq0JjJcDpGrgv4HO8ZaWybKNOFthv1FPi7Wu8kYV+cRLb3Bk01RXNM Yr8YGoNFYXdsCfptV60XYq+AjK6Nh/cV5Yo0NuWV1LdeuQcuspLDedN4nITmppnTiUMF iCzBnwypLbcht15Yb4XuAA4CSyT0NyDfwV3eD0WVmJzbm3IIBcDnIzG4Gb25/5cbmwHU APKlw0PNXmxAcrgzpiVJr8ZqhZdztc4FdhWDGM7S6Qj/mNpKeeVRc8YNdAPK8D4b4kwI 8tHV4Y8g4sHMLcROJ7KPkBNUFSvUgSNBBstU8FaSxrBCZwH6Uyi+w1IHOVApCM8s3JxJ YJ6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LW3dM/PsWPmPpGTo4++4+Jcuo0fGVz6Qa1xCvzsVRgc=; b=mYXsQe2/1rTRVaNmOnCM0EB2qHuLhbJPOCT8HGQDDC7dw9QYRze6PwYl7790OMr6Cw XXddyCKXFWNbPE3pralGXbo8ucsemFv36woPH7VdDcG1MjdqtozZlcvlzargIe2WhD0L 0P9MGPmI7lmluoe/tFeTIW1S5B26rCwH2Y/AFdelE8t3exzDCRpiYLLPpmxuG/gpcykF 0+92U2egkG5zMkNUhPptwpJa8u7txisDk+vjWN0vkKGQFXT2Z+GcB38Q2usvAjCJTq1c m+x0Pj0lRNSmBdrWBXl783DojEELHIDPml+Rdrz1xRGiImVHbTM97FfXUAY3fM8qkj35 66VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=G1yv8U44; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si17754349plg.322.2021.04.13.11.21.17; Tue, 13 Apr 2021 11:21:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=G1yv8U44; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243304AbhDMNm6 (ORCPT + 99 others); Tue, 13 Apr 2021 09:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243766AbhDMNm5 (ORCPT ); Tue, 13 Apr 2021 09:42:57 -0400 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C43F1C061574 for ; Tue, 13 Apr 2021 06:42:37 -0700 (PDT) Received: by mail-yb1-xb30.google.com with SMTP id x8so13030691ybx.2 for ; Tue, 13 Apr 2021 06:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LW3dM/PsWPmPpGTo4++4+Jcuo0fGVz6Qa1xCvzsVRgc=; b=G1yv8U44nKYDufHfBo+TkQDivfgcV4vOYA3FiYvbUuLSpY4E8046CrnOHpgboRvMc9 PZxhL6WKrEI1y5o5sQWiKPYMm+7I2G/HWmioliFdm0wPwB38/miz1DmR8wvpRykkShDi WbfJxfJLREBD9sgPWzdGD9ac0n8PG0qApDoeQu5Nidxhomii8Iih1MhRay/Sdn6ByFni 7e55/aRw3i5XlYj55ZFVHySYIy6LtRRp0F8LZOHXe8hNsonQs1g8grKCdC0pli66+KaJ XHBR4X1F2ImeGNAUnaC7tA7FVO8MEEZE2ejMJ966DxldvgJDBPbfF6a0xV9uafXoTMVJ zvFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LW3dM/PsWPmPpGTo4++4+Jcuo0fGVz6Qa1xCvzsVRgc=; b=D7kJhrk/7cGofj8q52m8txI+mYkxyl6VNW4o6agmn1yeT0xIfAsJ69u0utsuJ6ZaL+ 2QM2br2Z9ru7DHmAfV3IvR8LViV+x9y3Xi1RlfE8xdF+J9mnIDYj9qgb220mYZCNOjcw ZojuufJ8B6cfMAyQNI4nA2kokhKkqIIDoAg2pshU11ATnDpGSQ+c4jNtuKsV/AhhMFxW l9YRz3e20i8lxnqazjTBOWdMb+aGKAyark82i972Wz2qd9pqAkZlJO8U19l9nVh+399t BzYt3npyIhLADUzLFgsk3idYehNj4E4+YiXez34yCY4PzRAdzerAztMzedub7EHikfS4 GyoA== X-Gm-Message-State: AOAM531zEbVfh9oOMxiBpW89z8vsEOZAThu3c0UWHsALI72P/coHuHXx Mih5wTOkMgSBul9eFBEeDSllWrC5UVuFYNPHXci/pA== X-Received: by 2002:a25:6a88:: with SMTP id f130mr44944615ybc.234.1618321355721; Tue, 13 Apr 2021 06:42:35 -0700 (PDT) MIME-Version: 1.0 References: <20210412051445.GA47322@roeck-us.net> <20210413085538-mutt-send-email-mst@kernel.org> <20210413093606-mutt-send-email-mst@kernel.org> In-Reply-To: <20210413093606-mutt-send-email-mst@kernel.org> From: Eric Dumazet Date: Tue, 13 Apr 2021 15:42:24 +0200 Message-ID: Subject: Re: Linux 5.12-rc7 To: "Michael S. Tsirkin" Cc: Linus Torvalds , Guenter Roeck , Xuan Zhuo , Linux Kernel Mailing List , Netdev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 3:38 PM Michael S. Tsirkin wrote: > > On Tue, Apr 13, 2021 at 03:33:40PM +0200, Eric Dumazet wrote: > > On Tue, Apr 13, 2021 at 3:27 PM Eric Dumazet wrote: > > > > > > On Tue, Apr 13, 2021 at 2:57 PM Michael S. Tsirkin wrote: > > > > > > > > On Mon, Apr 12, 2021 at 06:47:07PM +0200, Eric Dumazet wrote: > > > > > On Mon, Apr 12, 2021 at 6:31 PM Eric Dumazet wrote: > > > > > > > > > > > > On Mon, Apr 12, 2021 at 6:28 PM Linus Torvalds > > > > > > wrote: > > > > > > > > > > > > > > On Sun, Apr 11, 2021 at 10:14 PM Guenter Roeck wrote: > > > > > > > > > > > > > > > > Qemu test results: > > > > > > > > total: 460 pass: 459 fail: 1 > > > > > > > > Failed tests: > > > > > > > > sh:rts7751r2dplus_defconfig:ata:net,virtio-net:rootfs > > > > > > > > > > > > > > > > The failure bisects to commit 0f6925b3e8da ("virtio_net: Do not pull payload in > > > > > > > > skb->head"). It is a spurious problem - the test passes roughly every other > > > > > > > > time. When the failure is seen, udhcpc fails to get an IP address and aborts > > > > > > > > with SIGTERM. So far I have only seen this with the "sh" architecture. > > > > > > > > > > > > > > Hmm. Let's add in some more of the people involved in that commit, and > > > > > > > also netdev. > > > > > > > > > > > > > > Nothing in there looks like it should have any interaction with > > > > > > > architecture, so that "it happens on sh" sounds odd, but maybe it's > > > > > > > some particular interaction with the qemu environment. > > > > > > > > > > > > Yes, maybe. > > > > > > > > > > > > I spent few hours on this, and suspect a buggy memcpy() implementation > > > > > > on SH, but this was not conclusive. > > > > > > > > > > > > By pulling one extra byte, the problem goes away. > > > > > > > > > > > > Strange thing is that the udhcpc process does not go past sendto(). > > > > > > > > > > This is the patch working around the issue. Unfortunately I was not > > > > > able to root-cause it (I really suspect something on SH) > > > > > > > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > > > > index 0824e6999e49957f7aaf7c990f6259792d42f32b..fd890a951beea03bdf24406809042666eb972655 > > > > > 100644 > > > > > --- a/drivers/net/virtio_net.c > > > > > +++ b/drivers/net/virtio_net.c > > > > > @@ -408,11 +408,17 @@ static struct sk_buff *page_to_skb(struct > > > > > virtnet_info *vi, > > > > > > > > > > /* Copy all frame if it fits skb->head, otherwise > > > > > * we let virtio_net_hdr_to_skb() and GRO pull headers as needed. > > > > > + * > > > > > + * Apparently, pulling only the Ethernet Header triggers a bug > > > > > on qemu-system-sh4. > > > > > + * Since GRO aggregation really cares of IPv4/IPv6, pull 20 bytes > > > > > + * more to work around this bug : These 20 bytes can not belong > > > > > + * to UDP/TCP payload. > > > > > + * As a bonus, this makes GRO slightly faster for IPv4 (one less copy). > > > > > */ > > > > > > > > Question: do we still want to do this for performance reasons? > > > > We also have the hdr_len coming from the device which is > > > > just skb_headlen on the host. > > > > > > Well, putting 20 bytes in skb->head will disable frag0 optimization. > > > > > > The change would only benefit to sh architecture :) > > > > > > About hdr_len, I suppose we could try it, with appropriate safety checks. > > > > I have added traces, hdr_len seems to be 0 with the qemu-system-sh4 I am using. > > > > Have I understood you correctly ? > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > index 0824e6999e49957f7aaf7c990f6259792d42f32b..f024860f7dc260d4efbc35a3b8ffd358bd0da894 > > 100644 > > --- a/drivers/net/virtio_net.c > > +++ b/drivers/net/virtio_net.c > > @@ -399,9 +399,10 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, > > hdr_padded_len = sizeof(struct padded_vnet_hdr); > > > > /* hdr_valid means no XDP, so we can copy the vnet header */ > > - if (hdr_valid) > > + if (hdr_valid) { > > memcpy(hdr, p, hdr_len); > > - > > + pr_err("hdr->hdr_len=%u\n", hdr->hdr.hdr_len); > > + } > > len -= hdr_len; > > offset += hdr_padded_len; > > p += hdr_padded_len; > > > Depends on how you connect qemu on the host. It's filled by host tap, > see virtio_net_hdr_from_skb. If you are using slirp that just zero-fills > it. Guenter provided : qemu-system-sh4 -M r2d -kernel ./arch/sh/boot/zImage -no-reboot \ -snapshot \ -drive file=rootfs.ext2,format=raw,if=ide \ -device virtio-net,netdev=net0 -netdev user,id=net0 \ -append "root=/dev/sda console=ttySC1,115200 earlycon=scif,mmio16,0xffe80000 noiotrap" \ -serial null -serial stdio -nographic -monitor null