From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E1199A00C5; Wed, 29 Apr 2020 19:36:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 901951DA6E; Wed, 29 Apr 2020 19:36:06 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id C54DB1DA6A for ; Wed, 29 Apr 2020 19:36:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588181764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eH2EEkigXkSkvJCqjXCds/mJugw/uab4/EywFm51z/E=; b=cfe0qknlNFCDe/3trJuWS4C9EnFRUw+yOAQZRURedrLMQSGLPLzQ5c8qPPT2WbcADSbe8O OZVsof30CP1FIE3JFcJ80yPSSEfLNjca/0whXUJCgo+BRCFLetPAzgWRpTfqr3iuvqxg19 GuQEEk4cktlC+BtwA1fQLIFWsbMgi2A= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-371-U6p3u7XJNKa8aGLlePpXhA-1; Wed, 29 Apr 2020 13:36:02 -0400 X-MC-Unique: U6p3u7XJNKa8aGLlePpXhA-1 Received: by mail-qt1-f198.google.com with SMTP id e44so3604067qta.9 for ; Wed, 29 Apr 2020 10:36:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ah3BKdnRZkzcuoQXkI4qhWjuGsWfMdqPBzxWuatfNdM=; b=tL6YGnxbY+OUDX2knFjCw+kkXee4ts3W37DEvChv18NOAf1f8i1QfdIfgkfFZVqlBM 7E4D3Hg2NgZ3XGtiZnVSKuR2W52Gwx7ZauTC5FvFnJuDrdFLUiJM3eleVWXRoIb+5DSl 6QDJ6rgoSEsMn2zox5cbsBpTunzZJheDHqzn/3fRqj4z5lwopjf+MIbuiquVHIYHJPSU 1H9mPvpJpC/7LjxV0la/ctkMsanGuDn7QgZ+YsSVPupmYZ1wFVSVnI4eyx2jnw1wj7fB X6ywTj6q6mOCgzTKK6kGKKnNlhnDbQqL1epYgzOaWhJb0OzzMJXX2MXzmg5Dg4EFdJCL 0+fA== X-Gm-Message-State: AGi0PuZ3G5pAop2/08pPadIuCRYv/TAQe5glP/fWh9a+mHs+wfNUGa5B xhSwbtfHCRRgXJUJ53t6oP3c5tyaPlo2ETAeBVZgPn7Ay8wYpKSuKWt0YB2M0imRLZYMjuX+ys7 wG9o= X-Received: by 2002:ac8:2c0c:: with SMTP id d12mr35873783qta.284.1588181761885; Wed, 29 Apr 2020 10:36:01 -0700 (PDT) X-Google-Smtp-Source: APiQypJ6WGaOAKLNNIlxr23pf+X1XkM65eDjPsqefLtB64wsR1MraYYL0pi57TELM5kTmV2y/PUnWw== X-Received: by 2002:ac8:2c0c:: with SMTP id d12mr35873750qta.284.1588181761561; Wed, 29 Apr 2020 10:36:01 -0700 (PDT) Received: from localhost ([191.7.190.150]) by smtp.gmail.com with ESMTPSA id x125sm15682025qke.34.2020.04.29.10.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 10:36:00 -0700 (PDT) Date: Wed, 29 Apr 2020 14:35:53 -0300 From: Flavio Leitner To: Maxime Coquelin Cc: Sivaprasad Tummala , Zhihong Wang , Xiaolong Ye , dev@dpdk.org Message-ID: <20200429173553.GG27219@p50.lan> References: <20200428095203.64935-1-Sivaprasad.Tummala@intel.com> <020fd369-6b44-c5fe-c7b1-e33146de4c37@redhat.com> MIME-Version: 1.0 In-Reply-To: <020fd369-6b44-c5fe-c7b1-e33146de4c37@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Re: [dpdk-dev] [PATCH v1] vhost: fix mbuf allocation failures X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Apr 29, 2020 at 10:43:01AM +0200, Maxime Coquelin wrote: > Hi Sivaprasad, >=20 > On 4/28/20 11:52 AM, Sivaprasad Tummala wrote: > > vhost buffer allocation is successful for packets that fit > > into a linear buffer. If it fails, vhost library is expected > > to drop the current buffer descriptor and skip to the next. > >=20 > > The patch fixes the error scenario by skipping to next descriptor. > > Note: Drop counters are not currently supported. In that case shouldn't we continue to process the ring? Also, don't we have the same issue with copy_desc_to_mbuf()=20 and get_zmbuf()? fbl > Fixes tag is missing here, and stable@dpdk.org should be cc'ed if > necessary. >=20 > > Signed-off-by: Sivaprasad Tummala > > --- > > lib/librte_vhost/virtio_net.c | 16 ++++++++++++++-- > > 1 file changed, 14 insertions(+), 2 deletions(-) > >=20 > > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_ne= t.c > > index 37c47c7dc..b0d3a85c2 100644 > > --- a/lib/librte_vhost/virtio_net.c > > +++ b/lib/librte_vhost/virtio_net.c > > @@ -1688,6 +1688,7 @@ virtio_dev_tx_split(struct virtio_net *dev, struc= t vhost_virtqueue *vq, > > { >=20 > You only fix split ring path, but not packed ring. >=20 > > =09uint16_t i; > > =09uint16_t free_entries; > > +=09uint16_t dropped =3D 0; > > =20 > > =09if (unlikely(dev->dequeue_zero_copy)) { > > =09=09struct zcopy_mbuf *zmbuf, *next; > > @@ -1751,8 +1752,19 @@ virtio_dev_tx_split(struct virtio_net *dev, stru= ct vhost_virtqueue *vq, > > =09=09=09update_shadow_used_ring_split(vq, head_idx, 0); > > =20 > > =09=09pkts[i] =3D virtio_dev_pktmbuf_alloc(dev, mbuf_pool, buf_len); > > -=09=09if (unlikely(pkts[i] =3D=3D NULL)) > > +=09=09if (unlikely(pkts[i] =3D=3D NULL)) { > > +=09=09=09/* > > +=09=09=09 * mbuf allocation fails for jumbo packets with > > +=09=09=09 * linear buffer flag set. Drop this packet and > > +=09=09=09 * proceed with the next available descriptor to > > +=09=09=09 * avoid HOL blocking > > +=09=09=09 */ > > +=09=09=09VHOST_LOG_DATA(WARNING, > > +=09=09=09=09"Failed to allocate memory for mbuf. Packet dropped!\n"); >=20 > I think we need a better logging, otherwise it is going to flood the log > file quite rapidly if issue happens. Either some rate-limited logging or > warn-once would be better. >=20 > The warning message could be also improved, because when using linear > buffers, one would expect that the size of the mbufs could handle a > jumbo frame. So it should differentiate two >=20 > > +=09=09=09dropped +=3D 1; > > +=09=09=09i++; > > =09=09=09break; > > +=09=09} > > =20 > > =09=09err =3D copy_desc_to_mbuf(dev, vq, buf_vec, nr_vec, pkts[i], > > =09=09=09=09mbuf_pool); > > @@ -1796,7 +1808,7 @@ virtio_dev_tx_split(struct virtio_net *dev, struc= t vhost_virtqueue *vq, > > =09=09} > > =09} > > =20 > > -=09return i; > > +=09return (i - dropped); > > } > > =20 > > static __rte_always_inline int > >=20 >=20 --=20 fbl