From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F584C47096 for ; Sun, 6 Jun 2021 04:48:29 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 219D761287 for ; Sun, 6 Jun 2021 04:48:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 219D761287 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C3D93607C8; Sun, 6 Jun 2021 04:48:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A43QgY0PBUZx; Sun, 6 Jun 2021 04:48:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTP id 6150C60750; Sun, 6 Jun 2021 04:48:25 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 31B72C000D; Sun, 6 Jun 2021 04:48:25 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id B8967C0001 for ; Sun, 6 Jun 2021 04:48:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8F4A54041B for ; Sun, 6 Jun 2021 04:48:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q5c48fXs9CUw for ; Sun, 6 Jun 2021 04:48:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp4.osuosl.org (Postfix) with ESMTPS id D11414041A for ; Sun, 6 Jun 2021 04:48:21 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 8BBA66136D; Sun, 6 Jun 2021 04:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622954901; bh=xaAcrglNijmjCFRiE7xF8pepjMBrLn/aQY5rCt+Ggk4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WrpMwiDMuvUaTuOHiy5T1Dr5GHq+5lJmfe5CN0f5E+Rqn3yieIB4CQjUopy6FhUfd B3i9xpfbkVXtEX6Fhpr7G/wtQlTQGTnUxhCootQP3vzTyce6cFtwhTdpSGkV66KesB oZ7ON8SdBgHhaC6mS4jrXZKfPQM7bo/rkK5OLDtpL4b16t1ZYrnezkgt7lo9g4EgfK BXiFgQ/0ep4eoYeSkCikWa61Z163AuRBH7P3oZWezN1QB+PEejE1a2Dm738QBDUzuS OonzJrQo2e5xR1GMbLT0Ctev/hmxAAIfAhDNYPF0RSU9Dg9AwfyKMBgcatV+11SqrC MDpcM2J405MXA== Date: Sun, 6 Jun 2021 07:48:17 +0300 From: Leon Romanovsky To: Xianting Tian Subject: Re: [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead Message-ID: References: <1622907060-8417-1-git-send-email-xianting_tian@126.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1622907060-8417-1-git-send-email-xianting_tian@126.com> Cc: mst@redhat.com, Xianting Tian , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kuba@kernel.org, davem@davemloft.net X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Sat, Jun 05, 2021 at 11:31:00AM -0400, Xianting Tian wrote: > From: Xianting Tian > > We should not directly BUG() when there is hdr error, it is > better to output a print when such error happens. Currently, > the caller of xmit_skb() already did it. > > Signed-off-by: Xianting Tian > --- > drivers/net/virtio_net.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 9b6a4a8..7f11ea4 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1623,7 +1623,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) > if (virtio_net_hdr_from_skb(skb, &hdr->hdr, > virtio_is_little_endian(vi->vdev), false, > 0)) > - BUG(); > + return -EPROTO; Yeah, as we discussed, BUG*() macros in non-core code that checks in-kernel API better to be deleted. Thanks, Reviewed-by: Leon Romanovsky _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6549C47096 for ; Sun, 6 Jun 2021 04:49:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A48F761431 for ; Sun, 6 Jun 2021 04:49:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230211AbhFFEuL (ORCPT ); Sun, 6 Jun 2021 00:50:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:46058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbhFFEuK (ORCPT ); Sun, 6 Jun 2021 00:50:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8BBA66136D; Sun, 6 Jun 2021 04:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622954901; bh=xaAcrglNijmjCFRiE7xF8pepjMBrLn/aQY5rCt+Ggk4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WrpMwiDMuvUaTuOHiy5T1Dr5GHq+5lJmfe5CN0f5E+Rqn3yieIB4CQjUopy6FhUfd B3i9xpfbkVXtEX6Fhpr7G/wtQlTQGTnUxhCootQP3vzTyce6cFtwhTdpSGkV66KesB oZ7ON8SdBgHhaC6mS4jrXZKfPQM7bo/rkK5OLDtpL4b16t1ZYrnezkgt7lo9g4EgfK BXiFgQ/0ep4eoYeSkCikWa61Z163AuRBH7P3oZWezN1QB+PEejE1a2Dm738QBDUzuS OonzJrQo2e5xR1GMbLT0Ctev/hmxAAIfAhDNYPF0RSU9Dg9AwfyKMBgcatV+11SqrC MDpcM2J405MXA== Date: Sun, 6 Jun 2021 07:48:17 +0300 From: Leon Romanovsky To: Xianting Tian Cc: mst@redhat.com, jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Xianting Tian Subject: Re: [PATCH] [v2] virtio_net: Remove BUG() to avoid machine dead Message-ID: References: <1622907060-8417-1-git-send-email-xianting_tian@126.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622907060-8417-1-git-send-email-xianting_tian@126.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 05, 2021 at 11:31:00AM -0400, Xianting Tian wrote: > From: Xianting Tian > > We should not directly BUG() when there is hdr error, it is > better to output a print when such error happens. Currently, > the caller of xmit_skb() already did it. > > Signed-off-by: Xianting Tian > --- > drivers/net/virtio_net.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 9b6a4a8..7f11ea4 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1623,7 +1623,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) > if (virtio_net_hdr_from_skb(skb, &hdr->hdr, > virtio_is_little_endian(vi->vdev), false, > 0)) > - BUG(); > + return -EPROTO; Yeah, as we discussed, BUG*() macros in non-core code that checks in-kernel API better to be deleted. Thanks, Reviewed-by: Leon Romanovsky