Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4480520ybp; Mon, 7 Oct 2019 09:04:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDzchp/dzZ/QS4+kMqaj+tFe5xKzwYRR+KN0IONGqwqAuzHmbWNL84ps0o2L+7hBHS8gir X-Received: by 2002:a05:6402:b13:: with SMTP id bm19mr6752790edb.152.1570464268506; Mon, 07 Oct 2019 09:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570464268; cv=none; d=google.com; s=arc-20160816; b=XT1tcI+X7bYLOv7PEF2Erw2pasaZSMlCWVoyLrqhCCqjKDGTqcHp8Xs/e19s/JiGLn qDxSItzaWR4uCQH6moeNVaHOZiSCniht6YH2xJQ2DPyJUkKLbVBGH9vdrbGgaRnT3BWm k6JNwdC9s0S0FZaSWk13W8qv6yPYMuuLCyIOYcvrfC/qv/JAzmfrQeBOAGBk1rb4LUa1 QK680hrST+KoBLNUh1uAt5GBp2r9MFDqR+AuzBqtWXk7mNmt/52bu69QpbZrv8/wTrMu gQ22gpXB9jxFBqa7g9qlE1L8eKppXxpqb9dR13ACPknxbNFaO5+xaLmDjf/VwrmbADRg uTuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+U+56u4o7Na2WXoYropxhfczs8fHMA7M9mdUs+PWReE=; b=eh5AOG7Vw7iD2y4wLpTk7mU4Cad0JPHI6P5I9Fz9Cmuuq8IJ/6OdCDhBY1ES76YvHF GjKpMy6Z1xTrL2kZoRaDevHd7sUc7qaFzj14mRrhF2hK+kC1BlN/Bf7I2W09EAivv0Im BCm/bJF/CXJOB1qHtrs/LJlX+tuBOEeICsp3TkqdgaenBEmlaWONC63A2szr3wROepZ9 pwCCuIbzwXhRCX5l/UWb88TSFPcWAVXCiTFw8s/LBqOnwZ7x5dkIYID5VFMQ3OZ4NhIN hyNHzcureilYIGRsfZqckp3p7l8KiPBYNUrF9krS6u6j8nzpO28TtTqQLlc0aE7GREOt gHIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xh4TpPxC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si8299237edp.400.2019.10.07.09.04.03; Mon, 07 Oct 2019 09:04:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xh4TpPxC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728111AbfJGQDv (ORCPT + 99 others); Mon, 7 Oct 2019 12:03:51 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:43330 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727935AbfJGQDu (ORCPT ); Mon, 7 Oct 2019 12:03:50 -0400 Received: by mail-lf1-f66.google.com with SMTP id u3so9644998lfl.10; Mon, 07 Oct 2019 09:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+U+56u4o7Na2WXoYropxhfczs8fHMA7M9mdUs+PWReE=; b=Xh4TpPxCcQAoE6jyP1YluulUyU0xJq99mZooHAzrCwjs+h3iJqwxgrBLL+Wy6XP5zu 7H7sQCaGyVoocAeorqddNQnBfeg7IgCw3k0chvJ+97le1AO3l7y/xO+bxazhZvBf5HXl F+YkI/0Qgt9+Kf3b1dCbr+kzhGSJxuQYPaadO8/HYmqhlO6Bh21MBxGakOQiWIraj0gh zSuPl53c7b6JFXatVY1bROIXA+hu1lBKHGVXS1+x6eIMJpn4Bf1eQ54OFxEReF0RHbUB Sn3AFVYRZByitYVpEkykP8r/sFOPgcYcs764VbjBEObc8yKI8axbTzDnPaZNi7SFOyBx X6fg== 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:content-transfer-encoding; bh=+U+56u4o7Na2WXoYropxhfczs8fHMA7M9mdUs+PWReE=; b=eMdprjPtvvo7uGvHJDgv/buZiWqfbpWnukSMR1CiFjZ4QJMzVWyb56a/aTzfLcpD5+ pcIgo8Lqcr+FvlCgNXMZzcw4p8GyIRznebh4RKVNdX4SyhHP/o+qBP6G/FoqHiM5Cnn4 NUiLBqFxn/fBoMuXObwFnKR7zidnoDBvvb5lxVhHrFYAkMYziPeKl4oVZvxmyLC/fU9z Ps+qRDpy9h0vcNWU2xuphqOf09F48L63Pf9JwpP2q+SypcRmulIxGr9Sg7lXkABJmxYs Al5KwaDo1XQdGzJ68+5wWCc0we0z9NLovchjcJQ5kBykqlKtn/6koAu6ZKQN3mhyfsYn XUAA== X-Gm-Message-State: APjAAAUFwLQNFKrqCh27yJTW5XwQ+URXRKQIjgl9rVkaqp9l/CxUicup 127sKZrJBjYwKd0z3+nDeDA1xLOsagJ1Xcyh88c= X-Received: by 2002:a19:ca07:: with SMTP id a7mr18643407lfg.181.1570464227676; Mon, 07 Oct 2019 09:03:47 -0700 (PDT) MIME-Version: 1.0 References: <20191006184515.23048-1-jcfaracco@gmail.com> <20191006184515.23048-3-jcfaracco@gmail.com> <20191007034402-mutt-send-email-mst@kernel.org> In-Reply-To: From: Julio Faracco Date: Mon, 7 Oct 2019 13:03:34 -0300 Message-ID: Subject: Re: [PATCH RFC net-next 2/2] drivers: net: virtio_net: Add tx_timeout function To: "Michael S. Tsirkin" Cc: netdev@vger.kernel.org, Jason Wang , davem@davemloft.net, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Daiane Mendes Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em seg, 7 de out de 2019 =C3=A0s 11:03, Julio Faracco = escreveu: > > Em seg, 7 de out de 2019 =C3=A0s 04:51, Michael S. Tsirkin escreveu: > > > > On Sun, Oct 06, 2019 at 03:45:15PM -0300, jcfaracco@gmail.com wrote: > > > From: Julio Faracco > > > > > > To enable dev_watchdog, virtio_net should have a tx_timeout defined > > > (.ndo_tx_timeout). This is only a skeleton to throw a warn message. I= t > > > notifies the event in some specific queue of device. This function > > > still counts tx_timeout statistic and consider this event as an error > > > (one error per queue), reporting it. > > > > > > Signed-off-by: Julio Faracco > > > Signed-off-by: Daiane Mendes > > > Cc: Jason Wang > > > --- > > > drivers/net/virtio_net.c | 27 +++++++++++++++++++++++++++ > > > 1 file changed, 27 insertions(+) > > > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > > index 27f9b212c9f5..4b703b4b9441 100644 > > > --- a/drivers/net/virtio_net.c > > > +++ b/drivers/net/virtio_net.c > > > @@ -2585,6 +2585,29 @@ static int virtnet_set_features(struct net_dev= ice *dev, > > > return 0; > > > } > > > > > > +static void virtnet_tx_timeout(struct net_device *dev) > > > +{ > > > + struct virtnet_info *vi =3D netdev_priv(dev); > > > + u32 i; > > > + > > > + /* find the stopped queue the same way dev_watchdog() does */ > > > > not really - the watchdog actually looks at trans_start. > > The comments are wrong. It is the negative logic from dev_watchdog. > Watchdog requires queue stopped AND timeout. > > If the queue is not stopped, this queue does not reached a timeout event. > So, continue... Do not report a timeout. > > > > > > + for (i =3D 0; i < vi->curr_queue_pairs; i++) { > > > + struct send_queue *sq =3D &vi->sq[i]; > > > + > > > + if (!netif_xmit_stopped(netdev_get_tx_queue(dev, i))) > > > + continue; > > > + > > > + u64_stats_update_begin(&sq->stats.syncp); > > > + sq->stats.tx_timeouts++; > > > + u64_stats_update_end(&sq->stats.syncp); > > > + > > > + netdev_warn(dev, "TX timeout on send queue: %d, sq: %s,= vq: %d, name: %s\n", > > > + i, sq->name, sq->vq->index, sq->vq->name); > > > > this seems to assume any running queue is timed out. > > doesn't look right. > > > > also - there's already a warning in this case in the core. do we need a= nother one? > > Here, it can be a debug message if the idea is enhance debugging informat= ion. > Other enhancements can be done to enable or disable debug messages. > Using ethtool methods for instance. Observation... Another important point, kernel will thrown WARN_ONCE, only if ndo_tx_timeout() is implemented. Even if we are adding an extra/unnecessary netdev_warn() we need this function to enable dev_watchdog(). > > > > > > + dev->stats.tx_errors++; > > > > > > > > > + } > > > +} > > > + > > > static const struct net_device_ops virtnet_netdev =3D { > > > .ndo_open =3D virtnet_open, > > > .ndo_stop =3D virtnet_close, > > > @@ -2600,6 +2623,7 @@ static const struct net_device_ops virtnet_netd= ev =3D { > > > .ndo_features_check =3D passthru_features_check, > > > .ndo_get_phys_port_name =3D virtnet_get_phys_port_name, > > > .ndo_set_features =3D virtnet_set_features, > > > + .ndo_tx_timeout =3D virtnet_tx_timeout, > > > }; > > > > > > static void virtnet_config_changed_work(struct work_struct *work) > > > @@ -3018,6 +3042,9 @@ static int virtnet_probe(struct virtio_device *= vdev) > > > dev->netdev_ops =3D &virtnet_netdev; > > > dev->features =3D NETIF_F_HIGHDMA; > > > > > > + /* Set up dev_watchdog cycle. */ > > > + dev->watchdog_timeo =3D 5 * HZ; > > > + > > > > Seems to be still broken with napi_tx =3D false. > > > > > dev->ethtool_ops =3D &virtnet_ethtool_ops; > > > SET_NETDEV_DEV(dev, &vdev->dev); > > > > > > -- > > > 2.21.0