Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp799850rdg; Thu, 10 Aug 2023 23:05:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBAXnd6jmZzCZtJpfTUYqvMYgJF7f3rMT9pi+QBZIH9jFtlBI0D+hsia5vkcumm/i1255a X-Received: by 2002:a05:6a20:12c7:b0:13b:a2c9:922e with SMTP id v7-20020a056a2012c700b0013ba2c9922emr1301501pzg.27.1691733919809; Thu, 10 Aug 2023 23:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691733919; cv=none; d=google.com; s=arc-20160816; b=x5IFmDgabNOxEObHGUIhloj4DSQOVGqBEfyjWOnE+4UCKLs2iTvQvfJm+lMlaMOv07 MTqUavbBVpHiGEHFo4IbZIdYnvmNaFtd/8UTnLQ9KNkLgFLlJZLL6EqXKFSFfp240opk aiL/0smaS1BqGJbv54IAMWDoswMW1rBBu8LlEv6+xa/cEUrrJPzCB8LNiAOYJq4GQIXB bm9rCZpGkHhXpWKuzbeQgbNGnbtKs9mS8v/gJMSWi1C90byAnBH7n3Le4SI/OazJDZR2 S9jRxMVx1Rjh2dm/3yXPxE0pAY4Df1R4kacN+xSQQr1kCJ5C/jrFzA0M2yRvD3KMGrjk GrcQ== 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=FeOvN75tWxQhwMQjRUNg3DV6YRE1tdWFw7PsggN2KNo=; fh=KuqLKGQyW89E9WWWoPZXUV/Nqr1t61nBj3K9WzqnIsI=; b=FBagAj6LoXOb5sKqzIEF2IYeZOxb2LOii30hqVNZDH8rxIS7FcQZjPZzP/4Fpn/+1/ q6gqjLtyyQF2sQiLKROLhnnjhU9ObRi81dKQrMLXHXZMhY0GI+0KHdx1aErtTVik+YcQ u/5fozjdMyDtoMBYRJqT+PLYl3kbIKZUgfP2lX9DUfwng3vMeRuhxM8IKaaSlz5XVytM uMoKqFc+fsRsDkO8LFVba9mVhQIJgZMOv3XlSWXdZAwB8yM5KN4tM389Lv2FTCKoxOrv sQN9hmKDSx57vNiyFZ0BiBTUTJRBNcj2JgfAUgbZiPNpC1xgu3ddg1VUXzmPOOz4I0I/ 4/qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dXux5zX1; 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 k2-20020aa788c2000000b006870b9bddbdsi2974845pff.62.2023.08.10.23.05.06; Thu, 10 Aug 2023 23:05:19 -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=dXux5zX1; 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 S231195AbjHKFnB (ORCPT + 99 others); Fri, 11 Aug 2023 01:43:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjHKFm7 (ORCPT ); Fri, 11 Aug 2023 01:42:59 -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 9FCD210C7 for ; Thu, 10 Aug 2023 22:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691732531; 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=FeOvN75tWxQhwMQjRUNg3DV6YRE1tdWFw7PsggN2KNo=; b=dXux5zX1BRBHG4u7IHxTKtEL8Cay8sHgbeWEWJ/vBBgMqtzsXqcpphh+0A+XvLcgC200kN 5EU/eCrkm4WTMdiyLvlbDCMmSzOfStS+E3iCmAWR56JrG3lTT8mB1/mjlt9SfRIpnUTC1/ fvDZu6q6vlPyyF7cT8BEq3EwozXebzc= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-l6xNwuPHNgy53ba7GfjufQ-1; Fri, 11 Aug 2023 01:42:09 -0400 X-MC-Unique: l6xNwuPHNgy53ba7GfjufQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-30e3ee8a42eso988989f8f.1 for ; Thu, 10 Aug 2023 22:42:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691732528; x=1692337328; 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=FeOvN75tWxQhwMQjRUNg3DV6YRE1tdWFw7PsggN2KNo=; b=B3VkveOcBbgiliHfj7UYNz3N9SJAqlv0bLt/BtqDNZMSRpqGd4bAodD1QUSNL+7jNr QA91azZuu7uu5tE3ppaXFzIHDn0+YD2Pl4VlWR//Ty0sLTZqj2NfscZOvNYkxDbpyaMe I2BI/R200bDdt6VMlbS5qVClfaGiMXqdhLOmNhLMJGYPOWcXy6tZ6zb7Tx6arCRjKO3Q /SVH1gyG7qTZXliv0/C8gP1MJ00QRswdE9mlboNJl3GUz7KHJSGfVzLOr67nKYGnhK0h 6zD77n81Fy1fF72AOzMyhPJywpXGzmMRwByymI4Hw1wKfWqtBwVthDCz7/U2rocJ91mh /Nhg== X-Gm-Message-State: AOJu0YwnmaqPDNM9Pb/pctg9UvphPGo1RoNNMccBrlv14WWLuBN1w9mp iSG5Ru+HiLKCvr9RACA1UaUABISj3fRcHmG43wDaXo8GxsetoebhJh3LOrg7gry+fHSqrVG2M6e p7jn/FMBN2ji8owdoGV28EsAj X-Received: by 2002:a5d:4dce:0:b0:315:ad1a:5abc with SMTP id f14-20020a5d4dce000000b00315ad1a5abcmr560343wru.5.1691732528059; Thu, 10 Aug 2023 22:42:08 -0700 (PDT) X-Received: by 2002:a5d:4dce:0:b0:315:ad1a:5abc with SMTP id f14-20020a5d4dce000000b00315ad1a5abcmr560328wru.5.1691732527474; Thu, 10 Aug 2023 22:42:07 -0700 (PDT) Received: from redhat.com ([2.55.42.146]) by smtp.gmail.com with ESMTPSA id r10-20020a5d52ca000000b003140fff4f75sm4279428wrv.17.2023.08.10.22.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 22:42:06 -0700 (PDT) Date: Fri, 11 Aug 2023 01:42:02 -0400 From: "Michael S. Tsirkin" To: Jason Wang Cc: Maxime Coquelin , Shannon Nelson , xuanzhuo@linux.alibaba.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net Subject: Re: [PATCH net-next v4 2/2] virtio-net: add cond_resched() to the command waiting loop Message-ID: <20230811012147-mutt-send-email-mst@kernel.org> References: <20230726073453-mutt-send-email-mst@kernel.org> <20230727020930-mutt-send-email-mst@kernel.org> <20230727054300-mutt-send-email-mst@kernel.org> <20230810153744-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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE 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 Fri, Aug 11, 2023 at 10:23:15AM +0800, Jason Wang wrote: > On Fri, Aug 11, 2023 at 3:41 AM Michael S. Tsirkin wrote: > > > > On Tue, Aug 08, 2023 at 10:30:56AM +0800, Jason Wang wrote: > > > On Mon, Jul 31, 2023 at 2:30 PM Jason Wang wrote: > > > > > > > > On Thu, Jul 27, 2023 at 5:46 PM Michael S. Tsirkin wrote: > > > > > > > > > > On Thu, Jul 27, 2023 at 04:59:33PM +0800, Jason Wang wrote: > > > > > > > They really shouldn't - any NIC that takes forever to > > > > > > > program will create issues in the networking stack. > > > > > > > > > > > > Unfortunately, it's not rare as the device/cvq could be implemented > > > > > > via firmware or software. > > > > > > > > > > Currently that mean one either has sane firmware with a scheduler that > > > > > can meet deadlines, or loses ability to report errors back. > > > > > > > > > > > > But if they do they can always set this flag too. > > > > > > > > > > > > This may have false negatives and may confuse the management. > > > > > > > > > > > > Maybe we can extend the networking core to allow some device specific > > > > > > configurations to be done with device specific lock without rtnl. For > > > > > > example, split the set_channels to > > > > > > > > > > > > pre_set_channels > > > > > > set_channels > > > > > > post_set_channels > > > > > > > > > > > > The device specific part could be done in pre and post without a rtnl lock? > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > Would the benefit be that errors can be reported to userspace then? > > > > > Then maybe. I think you will have to show how this works for at least > > > > > one card besides virtio. > > > > > > > > Even for virtio, this seems not easy, as e.g the > > > > virtnet_send_command() and netif_set_real_num_tx_queues() need to > > > > appear to be atomic to the networking core. > > > > > > > > I wonder if we can re-consider the way of a timeout here and choose a > > > > sane value as a start. > > > > > > Michael, any more input on this? > > > > > > Thanks > > > > I think this is just mission creep. We are trying to fix > > vduse - let's do that for starters. > > > > Recovering from firmware timeouts is far from trivial and > > just assuming that just because it timed out it will not > > access memory is just as likely to cause memory corruption > > with worse results than an infinite spin. > > Yes, this might require support not only in the driver > > > > > I propose we fix this for vduse and assume hardware/firmware > > is well behaved. > > One major case is the re-connection, in that case it might take > whatever longer that the kernel virito-net driver expects. > So we can have a timeout in VDUSE and trap CVQ then VDUSE can return > and fail early? Ugh more mission creep. not at all my point. vduse should cache values in the driver, until someone manages to change net core to be more friendly to userspace devices. > > > Or maybe not well behaved firmware will > > set the flag losing error reporting ability. > > This might be hard since it means not only the set but also the get is > unreliable. > > Thanks /me shrugs > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > -- > > > > > MST > > > > > > >