Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp379808pxj; Wed, 2 Jun 2021 01:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzld/dw8ODJJuEPVqYXF+rBROnttXxNTw5XzfR2RbGYNbQ+toVxgwTOzupb/ZZsZTJ6+x/G X-Received: by 2002:a02:cac6:: with SMTP id f6mr29333658jap.142.1622621563874; Wed, 02 Jun 2021 01:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622621563; cv=none; d=google.com; s=arc-20160816; b=wldasX3D97vbr/tCKXQ36x4i6g8pIXyGCbOcTlkAh2u0NFjz3EgjAMXR0/324hbvF1 t0r9Du9J4e0ZU0XYXDY/hBT7PD+d15KSWimJGuu0hlBG3IC6kPPWGZEvCm+wUreMkCRX iKZ7RZP5nUjhagvPAFhKiY5YWB7ObnRKNoUeg2FvYUSRQhyuwyDj1UFxLQcwJ0ghbLKW AgLu7A9dgq3VaQfbsqBLznBupjDaJ7VG4xbRUQA0vBwdusoWCM9LSzs1gx61cbHxVXwn azNDWsKVEzXxCmUO20Wf0Db6HdYN6hgAc0+JlnziwDeaIg8A/pM8mdxRbvxnh0zwj4kI Wdig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FXCYeU+UUuUjz3dDxBZh2lbdS1fRsV9C8VdHQfqRt64=; b=k/CeO9Y9N2i57YTdvlLEzfKGZe/X8TUyvxdIa9DIU9Y6h1xe4ZZeORfgl94IeNBiHB 4nrB41KaIakepx4ZmMMwmICKtvajkS2X3lPQMqoX6o1/BLkQBahIWK99B73dLRJbZMlc G2ifeKSmHKd9bSN3bmZa+oIFsK74T4TPtEs9X6zr9x1GHX0kOjTrY8UMLtBZ+GhljkTD FNeV1+N9YQXWywSEt2MTrIp60SiW3POITHTio5dHUZkvNFeFPIo3v6wXzkEhHl6eKSuB RtfNSpVQshA4FDNXvg0Xiv23JnfBEg/Flm/bzfK01TnhM4d8KZ93tw6FVMZhLGMqZNgp gfdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PfDD9zft; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si9832090iol.68.2021.06.02.01.12.30; Wed, 02 Jun 2021 01:12:43 -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=@kernel.org header.s=k20201202 header.b=PfDD9zft; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230290AbhFBGBO (ORCPT + 99 others); Wed, 2 Jun 2021 02:01:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:48308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbhFBGBM (ORCPT ); Wed, 2 Jun 2021 02:01:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB97D61027; Wed, 2 Jun 2021 05:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622613570; bh=WFGn28PIenT8iwgpyo1Uh1UYGjMQG1gWUpqwqXSvJlk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PfDD9zftySnlohgnH0popDk3aWgGYjbEafnbJopaPd7jvH+1yCL5jnQgWlZ2ahGI/ 34+u5QMuxWSbIYs+srYytLppF3vvE37DCrQquvxNh6bFaEUvCVJuvNVol36aXBnXd9 2+V11/33toVh4lB/DD3MH/exJbS8sHyeTWICoCjUXdNtaHyPnXYTiUYG59NWugIJuk tEboug6LCa/Y5ByPtTBuFNgq9A2g5pbrmZpCbuW6Hr9o7nkHNglUBqVy009PIYUkvD dhlkBkRWpo5G+bN9nSd9y2mbpvEf9H6yCrMiSqRsQuPMyaM/9V4L9K44Dgz2mmvkdF ota0lbaMbWaLQ== Date: Wed, 2 Jun 2021 08:59:26 +0300 From: Leon Romanovsky To: Jason Wang Cc: Xianting Tian , "Michael S. Tsirkin" , davem@davemloft.net, kuba@kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] virtio_net: Remove BUG() to aviod machine dead Message-ID: References: <20210518055336-mutt-send-email-mst@kernel.org> <4aaf5125-ce75-c72a-4b4a-11c91cb85a72@linux.alibaba.com> <72f284c6-b2f5-a395-a68f-afe801eb81be@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <72f284c6-b2f5-a395-a68f-afe801eb81be@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 02:19:03PM +0800, Jason Wang wrote: > > 在 2021/5/19 下午10:18, Xianting Tian 写道: > > thanks, I submit the patch as commented by Andrew > > https://lkml.org/lkml/2021/5/18/256 > > > > Actually, if xmit_skb() returns error, below code will give a warning > > with error code. > > > >     /* Try to transmit */ > >     err = xmit_skb(sq, skb); > > > >     /* This should not happen! */ > >     if (unlikely(err)) { > >         dev->stats.tx_fifo_errors++; > >         if (net_ratelimit()) > >             dev_warn(&dev->dev, > >                  "Unexpected TXQ (%d) queue failure: %d\n", > >                  qnum, err); > >         dev->stats.tx_dropped++; > >         dev_kfree_skb_any(skb); > >         return NETDEV_TX_OK; > >     } > > > > > > > > > > > > 在 2021/5/18 下午5:54, Michael S. Tsirkin 写道: > > > typo in subject > > > > > > On Tue, May 18, 2021 at 05:46:56PM +0800, Xianting Tian wrote: > > > > When met error, we output a print to avoid a BUG(). > > > So you don't explain why you need to remove BUG(). I think it deserve a > BUG(). BUG() will crash the machine and virtio_net is not kernel core functionality that must stop the machine to prevent anything truly harmful and basic. I would argue that code in drivers/* shouldn't call BUG() macros at all. If it is impossible, don't check for that or add WARN_ON() and recover, but don't crash whole system. Thanks