Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4354003rwr; Sun, 23 Apr 2023 04:09:35 -0700 (PDT) X-Google-Smtp-Source: AKy350YgrC2PJnxKxL7ouTy/IUPRVmNStnThajkaeA/Kbvi2btbhU+RSBoGldv8bJ892buZuzoTa X-Received: by 2002:a05:6a20:440d:b0:dd:dfe4:f06a with SMTP id ce13-20020a056a20440d00b000dddfe4f06amr12534992pzb.3.1682248175089; Sun, 23 Apr 2023 04:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682248175; cv=none; d=google.com; s=arc-20160816; b=hNDAHL/x5/4+q3F39A69lnAlM4D4iI6XSlGH5zEprLM4l4z860Xhe7PDI2fpdOpp4G epzI1qDKXRW+0Nt+01sCDEPiSDMKRXzUQranaxtycaFaa1D66FgruRMBAx56u3ElddHz NWc/JkH5jpfCIDP+zi77P6J9MSQusGwrx/uZyrzDP56zYVc0uvpmiXQIZgK7G7KoWkrv oEnMU7sFNUn9yQnZuYd3kGa0pazeUFge+sOJbFRxlmYJyCO3xKj78TS/AtGaa5fUi0Ug 3RQTg2CosQ2A2V7iNuVKCvAWCw+OFi4PBYThGSQruYmAyfo7+ON46TjbDaMyL2ayqd/3 4ocg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=g1lbsLzGIKBrnxXJSYGJKVy6ieEQPX6tVrFGk22ivD8=; b=P6ntrZbeAwUxDwJ/pHYrwkisTOsmC9MqyBdKZ3O7UEbo7AHdcMdu0ZXzSY0oTp3nMm +IcvijXDjxzzsxfL9Ms5Jcug+SJluvy2fWlpxFJWy3QHUvsGJd3wcPqTAxtNIoMc8Pat NfEWG1FsNkk81BSB1DcDtanb9XB9rcWM9TclKvj6T6jXOa+/Ck55Dm67GjcgGMbYjLa7 YipesMpHpNHtY5GXzY/d7r7bVFbk1bgo3GWILZZNnvAHv+wwcZ4e9Zrhjz715cdcEMHM ORYNMwUfQnCMYdBJXm84c6x8F20Ozj1WlzPiny5LoMlY5/DxLW/8bSXRGfC/cw7R1TS5 nCRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KBvT5WuT; 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 n65-20020a632744000000b00514329f7ebdsi9385138pgn.344.2023.04.23.04.09.23; Sun, 23 Apr 2023 04:09:35 -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=KBvT5WuT; 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 S229579AbjDWLHv (ORCPT + 99 others); Sun, 23 Apr 2023 07:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjDWLHq (ORCPT ); Sun, 23 Apr 2023 07:07:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B7910E2 for ; Sun, 23 Apr 2023 04:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682248018; 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=g1lbsLzGIKBrnxXJSYGJKVy6ieEQPX6tVrFGk22ivD8=; b=KBvT5WuTymayJdKYiah2r7hTcaj0qqu4I1nbZJgA90MR70nN7D/MLUAgYHsA8kpPKDubTA xLS8ERtqYojImic7RSf/6ECb1Vd9lkP+4Gvm2LR2j2Y3FQjc7JQ1X0oJAcTa0UF8Wvt2i+ SuBV30Lg/sLQt17hguJZS8ZeyI/FWAY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-248-LjDxl5AKMuyDztZ748rxgA-1; Sun, 23 Apr 2023 07:06:57 -0400 X-MC-Unique: LjDxl5AKMuyDztZ748rxgA-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f21e35dc08so1006535e9.2 for ; Sun, 23 Apr 2023 04:06:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682248016; x=1684840016; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g1lbsLzGIKBrnxXJSYGJKVy6ieEQPX6tVrFGk22ivD8=; b=Xz6llqLFyzkFdtYfDMQNYOM0lsMYGpsly8m0NpVg4L1xYWtVCAuLPgN9rF60ZXBYu7 vrKL56l82CFK4ckJyFvXDB+NS6ZB+8P9xbpOk5AR0/dQC8y7OyFio8sS68yZjriFNHcf Ys+OTZs0k0dsM2D979ZpeGVBivsAUcUoX2TPhCOtZA+vAbpqpM+mmeaAKTMMhl0v+P8r R6MCQXFm/19vpSIU/mL6WeesB/rbhZMrzaB9dDDmPWwgNEZ6mn0mNxXjs5gUCq9LcH0A 1C4OP2cHv0aNs0DZIo+/yv/3V4bDxrk+mOVlHJY3Wr13Ys4zzlV2tYDVK+DgM6rdP4kE Ztig== X-Gm-Message-State: AAQBX9e4WwsxjgDVoC/6BTPXeUwHk51vae2H43VvXpzT4nnesmv5KPQ4 lTfssQQ8HFEwkAB5uSooTyBQUg8L11k0fhi7VBvHSIH2CTF6oDjXLb+ie2rKpAgxITPrELWGArI oYWfqo6xEXMyrQE8GeF1nplOt X-Received: by 2002:adf:e391:0:b0:2ff:f37:9d18 with SMTP id e17-20020adfe391000000b002ff0f379d18mr8443651wrm.58.1682248016037; Sun, 23 Apr 2023 04:06:56 -0700 (PDT) X-Received: by 2002:adf:e391:0:b0:2ff:f37:9d18 with SMTP id e17-20020adfe391000000b002ff0f379d18mr8443639wrm.58.1682248015697; Sun, 23 Apr 2023 04:06:55 -0700 (PDT) Received: from redhat.com ([2.55.61.39]) by smtp.gmail.com with ESMTPSA id j32-20020a05600c1c2000b003f173987ec2sm12802917wms.22.2023.04.23.04.06.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Apr 2023 04:06:55 -0700 (PDT) Date: Sun, 23 Apr 2023 07:06:51 -0400 From: "Michael S. Tsirkin" To: Alvaro Karsz Cc: Jason Wang , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH net] virtio-net: reject small vring sizes Message-ID: <20230423065132-mutt-send-email-mst@kernel.org> References: <20230417030713-mutt-send-email-mst@kernel.org> <20230417051816-mutt-send-email-mst@kernel.org> <20230417073830-mutt-send-email-mst@kernel.org> <20230417075645-mutt-send-email-mst@kernel.org> <20230423031308-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 Sun, Apr 23, 2023 at 07:52:10AM +0000, Alvaro Karsz wrote: > > Hmm. I was wrong. There is no way to disable CVQ feature bit. > > > > 1. Reset the device. > > 2. Set the ACKNOWLEDGE status bit: the guest OS has notice the device. > > 3. Set the DRIVER status bit: the guest OS knows how to drive the device. > > 4. Read device feature bits, and write the subset of feature bits understood by the OS and driver to the > > device. During this step the driver MAY read (but MUST NOT write) the device-specific configuration > > fields to check that it can support the device before accepting it. > > 5. Set the FEATURES_OK status bit. The driver MUST NOT accept new feature bits after this step. > > 6. Re-read device status to ensure the FEATURES_OK bit is still set: otherwise, the device does not > > support our subset of features and the device is unusable. > > 7. Perform device-specific setup, including discovery of virtqueues for the device, optional per-> bus setup, > > reading and possibly writing the device’s virtio configuration space, and population of virtqueues. > > 8. Set the DRIVER_OK status bit. At this point the device is “live”. > > > > > > So features are confirmed before find vqs. > > > > The rest of stuff can probably just be moved to after find_vqs without > > much pain. > > > Actually, I think that with a little bit of pain :) > If we use small vrings and a GRO feature bit is set, Linux will need to allocate 64KB of continuous memory for every receive descriptor.. Oh right. Hmm. Well this is same as big packets though, isn't it? > Instead of failing probe if GRO/CVQ are set, can we just reset the device if we discover small vrings and start over? > Can we remember that this device uses small vrings, and then just avoid negotiating the features that we cannot support? We technically can of course. I am just not sure supporting CVQ with just 1 s/g entry will ever be viable. -- MST