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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 A2E0AC432C0 for ; Mon, 25 Nov 2019 02:42:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 729E92073F for ; Mon, 25 Nov 2019 02:42:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V2WWtcwR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbfKYCmN (ORCPT ); Sun, 24 Nov 2019 21:42:13 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:47175 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726957AbfKYCmN (ORCPT ); Sun, 24 Nov 2019 21:42:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574649732; 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=3o2zb24kIRBTzY7PPr7Q4XXAwQkEmzRh8aDu2/bWy0w=; b=V2WWtcwRwOloWNaqM7lUtvJz3fVu7s2F0EhfaP5Muqog0ehzQ53C0m4JrDPL6AcixfdVgN NGBCpbl6Pli1BgPzFiE+BRYFsgHnvZm4FvVi+wfkOGNo0eoc0JNK3fMTyhFRPhYRUeUo++ 9x9nvKoaDI/T6oh8sOmECK03FmAj16M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-90-ef78lVTuMW-QOXqb2wgwmg-1; Sun, 24 Nov 2019 21:42:08 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE680800580; Mon, 25 Nov 2019 02:42:07 +0000 (UTC) Received: from [10.72.12.30] (ovpn-12-30.pek2.redhat.com [10.72.12.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53744600C1; Mon, 25 Nov 2019 02:42:02 +0000 (UTC) Subject: Re: error loading xdp program on virtio nic To: Jesper Dangaard Brouer , David Ahern Cc: "xdp-newbies@vger.kernel.org" , "netdev@vger.kernel.org" References: <89f56317-5955-e692-fcf0-ee876aae068b@redhat.com> <3dc7b9d8-bcb2-1a90-630e-681cbf0f1ace@gmail.com> <18659bd0-432e-f317-fa8a-b5670a91c5b9@redhat.com> <20191121072625.3573368f@carbon> <4686849f-f3b8-dd1d-0fe4-3c176a37b67a@redhat.com> <8324a37e-5507-2ae6-53f6-949c842537e0@gmail.com> <20191122175749.47728e42@carbon> From: Jason Wang Message-ID: <6c55b35f-9ffe-c192-651c-f5ca3d02de52@redhat.com> Date: Mon, 25 Nov 2019 10:42:01 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191122175749.47728e42@carbon> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: ef78lVTuMW-QOXqb2wgwmg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2019/11/23 =E4=B8=8A=E5=8D=8812:57, Jesper Dangaard Brouer wrote: > On Fri, 22 Nov 2019 08:43:50 -0700 > David Ahern wrote: > >> On 11/21/19 11:09 PM, Jason Wang wrote: >>>> Doubling the number of queues for each tap device adds overhead to the >>>> hypervisor if you only want to allow XDP_DROP or XDP_DIRECT. Am I >>>> understanding that correctly? >>> >>> Yes, but there's almost impossible to know whether or not XDP_TX will b= e >>> used by the program. If we don't use per CPU TX queue, it must be >>> serialized through locks, not sure it's worth try that (not by default, >>> of course). >>> =20 >> This restriction is going to prevent use of XDP in VMs in general cloud >> hosting environments. 2x vhost threads for vcpus is a non-starter. >> >> If one XDP feature has high resource needs, then we need to subdivide >> the capabilities to let some work and others fail. For example, a flag >> can be added to xdp_buff / xdp_md that indicates supported XDP features. >> If there are insufficient resources for XDP_TX, do not show support for >> it. If a program returns XDP_TX anyways, packets will be dropped. >> > This sounds like concrete use-case and solid argument why we need XDP > feature detection and checks. (Last part of LPC talk[1] were about > XDP features). > > An interesting perspective you bring up, is that XDP features are not > static per device driver. It actually needs to be dynamic, as your > XDP_TX feature request depend on the queue resources available. > > Implementation wise, I would not add flags to xdp_buff / xdp_md. > Instead I propose in[1] slide 46, that the verifier should detect the > XDP features used by a BPF-prog. If you XDP prog doesn't use e.g. > XDP_TX, then you should be allowed to run it on a virtio_net device > with less queue configured, right? Yes, I think so. But I remember we used to have something like=20 header_adjust in the past but finally removed ... Thanks > > > [1] http://people.netfilter.org/hawk/presentations/LinuxPlumbers2019/xdp-= distro-view.pdf