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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS 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 6FA9CC43387 for ; Fri, 18 Jan 2019 01:45:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 398D72086D for ; Fri, 18 Jan 2019 01:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726999AbfARBpA (ORCPT ); Thu, 17 Jan 2019 20:45:00 -0500 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]:45292 "EHLO tama500.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726908AbfARBpA (ORCPT ); Thu, 17 Jan 2019 20:45:00 -0500 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x0I1iolc026713; Fri, 18 Jan 2019 10:44:50 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 5789D6385E2; Fri, 18 Jan 2019 10:44:50 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 4BEED638535; Fri, 18 Jan 2019 10:44:50 +0900 (JST) Received: from [IPv6:::1] (unknown [129.60.241.182]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 44A3F400ABB; Fri, 18 Jan 2019 10:44:50 +0900 (JST) Subject: Re: [PATCH net 2/7] virtio_net: Don't call free_old_xmit_skbs for xdp_frames References: <1547724045-2726-1-git-send-email-makita.toshiaki@lab.ntt.co.jp> <1547724045-2726-3-git-send-email-makita.toshiaki@lab.ntt.co.jp> <7c8955f5-cd38-c26f-9932-0aa0be573b4e@redhat.com> From: Toshiaki Makita Message-ID: <8b097123-5e10-69dd-a638-65e4dc6d7882@lab.ntt.co.jp> Date: Fri, 18 Jan 2019 10:44:00 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <7c8955f5-cd38-c26f-9932-0aa0be573b4e@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-CC-Mail-RelayStamp: 1 To: Jason Wang , "David S. Miller" , "Michael S. Tsirkin" Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Willem de Bruijn X-TM-AS-MML: disable Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2019/01/17 21:39, Jason Wang wrote: > On 2019/1/17 下午7:20, Toshiaki Makita wrote: >> When napi_tx is enabled, virtnet_poll_cleantx() called >> free_old_xmit_skbs() even for xdp send queue. >> This is bogus since the queue has xdp_frames, not sk_buffs, thus mangled >> device tx bytes counters because skb->len is meaningless value, and even >> triggered oops due to general protection fault on freeing them. >> >> Since xdp send queues do not aquire locks, old xdp_frames should be >> freed only in virtnet_xdp_xmit(), so just skip free_old_xmit_skbs() for >> xdp send queues. >> >> Similarly virtnet_poll_tx() called free_old_xmit_skbs(). This NAPI >> handler is called even without calling start_xmit() because cb for tx is >> by default enabled. Once the handler is called, it enabled the cb again, >> and then the handler would be called again. We don't need this handler >> for XDP, so don't enable cb as well as not calling free_old_xmit_skbs(). >> >> Also, we need to disable tx NAPI when disabling XDP, so >> virtnet_poll_tx() can safely access curr_queue_pairs and >> xdp_queue_pairs, which are not atomically updated while disabling XDP. > > > I suggest to split this into another patch or squash this part to patch 1. This part is for invocation of is_xdp_raw_buffer_queue() from virtnet_poll_tx(), which is added in this patch, so I'm thinking it's more natural to keep this hunk in this patch. -- Toshiaki Makita