Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6442232rwd; Mon, 5 Jun 2023 18:59:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sxqNfvPKYswKdfd2y6/mzFHEpZTf9cYfAzZNgHrCyOsXzhR1DArb3BcJnLy7dePl6B6V2 X-Received: by 2002:a92:dc52:0:b0:333:eb18:2b72 with SMTP id x18-20020a92dc52000000b00333eb182b72mr748831ilq.25.1686016741359; Mon, 05 Jun 2023 18:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686016741; cv=none; d=google.com; s=arc-20160816; b=r4fymVGBOPmNYB/4XsKtX+1PDsXafU8s0lRBSCGXlGfG3KWVy04y/nNwikTkB0A06E WklK59fPOJ2/BDYaSGfsOgsqIbN5rLIXEfOKrlcXYnS4yjHexGwRi3/pKG0048nP3cSl 90S8/fvs5IiX7pMeaALyvnyaRxKYVFEJft9uqL8WHsvpeaqj1FRh1JlFRAjLEcMJXktc XSoEpAH8ZeOEO82LRUjnXPMSsq2dPmgVtkvJIGuEZZCJYTZADOF7/jLZAeJ5RBt71T2U fMXUyu51iuFp7g5bmyYUSOqPZD1GuI2dA85sp5XMPbtXq7ydLVIdjpoDqi2bIqNZw3sD 6N4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=h6c7qR5QQL6O5muxAxTGbpH+uE3aElnAVDLZ6FGcR/0=; b=X+ZNbz6Ak8xQ2qiyBre7FcVQyhRdIfFr7F6MwgVi86gqGfZZR16GmhoJCjcrAcIdxR dCHwvMdILRJsWyRRIVj/DazwVECCmWHH6yNVONJIHuHc39xMk2zzHwDu6gKBb3cGTShO nbuDH8TOIroK6phdqR9vjsg9c60/WnDExEsgqVtMLJAFY7vUx0AElzkYQkyR1439OMR/ 3fWtcBMaKzcufwNWFLvA+jN/TrBfsgtVdKEXKM4fjoKr1+AqrZfm+ndxOZDygdi3OQfF bMa8oCbV6UYwW4eQJlXveMtQu3477Y8timNCsdf5UasL9DcnJoxGoOpoS8UawK9A7ful Uo+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZHpOLWes; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a630a4f000000b0053fee168aa6si6256735pgk.236.2023.06.05.18.58.49; Mon, 05 Jun 2023 18:59:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZHpOLWes; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231565AbjFFBpJ (ORCPT + 99 others); Mon, 5 Jun 2023 21:45:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbjFFBpH (ORCPT ); Mon, 5 Jun 2023 21:45:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9662E10D for ; Mon, 5 Jun 2023 18:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686015859; 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=h6c7qR5QQL6O5muxAxTGbpH+uE3aElnAVDLZ6FGcR/0=; b=ZHpOLWesA6x+vFxNHqH/mMTaat+8G9WiAqw6+fscur+VXTKKRbSwlQy625NDYo+FfRdqZf tZUtT/C7jE4k+rD9L4b4RiwHSfoWsq4wyJOi/kxBOC74xIwA7o0MxZHKaGi0R617i2PjKL 68jSX3zn6dNqzsKd6lpwLH7knU5Mc38= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-VkLWyYFGNtCRi2qywq4cuA-1; Mon, 05 Jun 2023 21:44:18 -0400 X-MC-Unique: VkLWyYFGNtCRi2qywq4cuA-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f624a4ea72so1296852e87.2 for ; Mon, 05 Jun 2023 18:44:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686015856; x=1688607856; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h6c7qR5QQL6O5muxAxTGbpH+uE3aElnAVDLZ6FGcR/0=; b=ghMmJw5Qudm00Ab3giBHHOjZIUMFBT6dmMosQZ/zSEYJiDx9KcgcRRZ7ctRAv+8Jz8 maYfC9cn9ITvZ1e3AQnnQILYf8JIsKfrKjsFGOYX6zuENKvb2q1Ddr7FeExfXHakfH9X r26XxuJCNKDqSFWajfBQH3/Gl2s5+kRxi7XoqfEBUp7POLQnJ237KkvZou2H+ah4lliX cFJUKU2JyASR9uwdUKCwkuMglTmlFz1Gi3vlITy42/zJD4OxWq3yLRyQwzjC5PHbqSC4 eSdMv0ThpcvPMNxzxW44tw9/x2HF/SkA7ZwG9/BvpAgEH2BEtbzDNnPMFaVsr+WJFRvO u6tw== X-Gm-Message-State: AC+VfDxgnb4+OOKgpGivNqzR9ReibdzaThfTuDPRr7dE0TeHJFWePJ6Q hhuD10oe/N3yAe/MRIk8YSqAJg85g4Pz5IMUHouhZbpUgqi+H7+8jvhvkepxdChJ1UqkKeZ5MxJ obZ3RPfRPOih8sXKzNbafIaz2nVJq46XaElr7Hhnl X-Received: by 2002:a19:f811:0:b0:4f6:392:6917 with SMTP id a17-20020a19f811000000b004f603926917mr409089lff.34.1686015856763; Mon, 05 Jun 2023 18:44:16 -0700 (PDT) X-Received: by 2002:a19:f811:0:b0:4f6:392:6917 with SMTP id a17-20020a19f811000000b004f603926917mr409084lff.34.1686015856464; Mon, 05 Jun 2023 18:44:16 -0700 (PDT) MIME-Version: 1.0 References: <20230605195925.51625-1-brett.creeley@amd.com> In-Reply-To: <20230605195925.51625-1-brett.creeley@amd.com> From: Jason Wang Date: Tue, 6 Jun 2023 09:44:05 +0800 Message-ID: Subject: Re: [PATCH net] virtio_net: use control_buf for coalesce params To: Brett Creeley Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, alvaro.karsz@solid-run.com, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, xuanzhuo@linux.alibaba.com, mst@redhat.com, shannon.nelson@amd.com, allen.hubbe@amd.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 6, 2023 at 3:59=E2=80=AFAM Brett Creeley wrote: > > Commit 699b045a8e43 ("net: virtio_net: notifications coalescing > support") added coalescing command support for virtio_net. However, > the coalesce commands are using buffers on the stack, which is causing > the device to see DMA errors. There should also be a complaint from > check_for_stack() in debug_dma_map_xyz(). Fix this by adding and using > coalesce params from the control_buf struct, which aligns with other > commands. > > Fixes: 699b045a8e43 ("net: virtio_net: notifications coalescing support") > Reviewed-by: Shannon Nelson > Signed-off-by: Allen Hubbe > Signed-off-by: Brett Creeley > --- > drivers/net/virtio_net.c | 16 ++++++++-------- The patch is needed for -stable I think. Acked-by: Jason Wang Thanks > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 56ca1d270304..486b5849033d 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -205,6 +205,8 @@ struct control_buf { > __virtio16 vid; > __virtio64 offloads; > struct virtio_net_ctrl_rss rss; > + struct virtio_net_ctrl_coal_tx coal_tx; > + struct virtio_net_ctrl_coal_rx coal_rx; > }; > > struct virtnet_info { > @@ -2934,12 +2936,10 @@ static int virtnet_send_notf_coal_cmds(struct vir= tnet_info *vi, > struct ethtool_coalesce *ec) > { > struct scatterlist sgs_tx, sgs_rx; > - struct virtio_net_ctrl_coal_tx coal_tx; > - struct virtio_net_ctrl_coal_rx coal_rx; > > - coal_tx.tx_usecs =3D cpu_to_le32(ec->tx_coalesce_usecs); > - coal_tx.tx_max_packets =3D cpu_to_le32(ec->tx_max_coalesced_frame= s); > - sg_init_one(&sgs_tx, &coal_tx, sizeof(coal_tx)); > + vi->ctrl->coal_tx.tx_usecs =3D cpu_to_le32(ec->tx_coalesce_usecs)= ; > + vi->ctrl->coal_tx.tx_max_packets =3D cpu_to_le32(ec->tx_max_coale= sced_frames); > + sg_init_one(&sgs_tx, &vi->ctrl->coal_tx, sizeof(vi->ctrl->coal_tx= )); > > if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL, > VIRTIO_NET_CTRL_NOTF_COAL_TX_SET, > @@ -2950,9 +2950,9 @@ static int virtnet_send_notf_coal_cmds(struct virtn= et_info *vi, > vi->tx_usecs =3D ec->tx_coalesce_usecs; > vi->tx_max_packets =3D ec->tx_max_coalesced_frames; > > - coal_rx.rx_usecs =3D cpu_to_le32(ec->rx_coalesce_usecs); > - coal_rx.rx_max_packets =3D cpu_to_le32(ec->rx_max_coalesced_frame= s); > - sg_init_one(&sgs_rx, &coal_rx, sizeof(coal_rx)); > + vi->ctrl->coal_rx.rx_usecs =3D cpu_to_le32(ec->rx_coalesce_usecs)= ; > + vi->ctrl->coal_rx.rx_max_packets =3D cpu_to_le32(ec->rx_max_coale= sced_frames); > + sg_init_one(&sgs_rx, &vi->ctrl->coal_rx, sizeof(vi->ctrl->coal_rx= )); > > if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL, > VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, > -- > 2.17.1 >