Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp321964imw; Fri, 8 Jul 2022 03:44:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sFpEWkfoIH7BUlOz7lKtvGFWYFOrm48SCNNdYx0CZOF/V7ktUL7+lNHImZxcBRCdRZkSdC X-Received: by 2002:a17:907:75ca:b0:726:313b:8b0d with SMTP id jl10-20020a17090775ca00b00726313b8b0dmr2831445ejc.214.1657277066835; Fri, 08 Jul 2022 03:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657277066; cv=none; d=google.com; s=arc-20160816; b=ZMYC/pk9Zz4q0bvrDFaNKf7evhxw+hzcn66G4ftI1tTjBMiGhfHM4gJZ8Emqn0u2lD lCtorJ1LUNYRqwQzqFA8ma4nWZolPM/s2TUJ9Fy58pImsgrt9r/96JC5sm8SY+olAn11 eLaXUgh1PYVdunAdFt0Ury2fzY8/gG5O93jKe4uMZB9TRWEtcLcy4vOs2PEW4JFBea7Q S8IWNRKWcGP5/2iWSsUFLjcIuKdweNgLzQJtuOQ7VbJzPjrqEzzB/Y5GCk6x3kxspvY4 7fYF9Dm6xgx9T0c09MyCOUbOSN8DS6+OSCOAdDg5+x/qTXg2lTBEj9ftSw3qmOUDcXWD Yodw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=99rSQeHafgbRxHWOu2JfmcwUCoy/HYb3bmvsaH7S9FA=; b=lA8VhQvVl3znI+JlDJY4xzhvHZgaIDEYN6r8NpOYSY0skN23pF8k971Fp/Ep62UZmk xf47Bz7L985QTiJC5YfgTch3ylHSx8CH07GUOSmXSlkBGcVN8dhdX5ABA57I8J0i7Me6 CrjLd3JHeWX/KWbb3X7GTbKXzdzqvo3ZlvQ2UVLwvwAa+PxCFOimSXMj93FVBy+L43aG gToXoMNi9JfteToKfQNxLJ39oD0TLiu4KGQrdiYnlwArGEhiw+ggklRu+RHdxioGKv80 bGu+kE7EU8X9rKB2VT64P/Z8lqTWBIUM2sTi870EKyGuPtFx/s3C4qJuFP6gLvdWfM2o vKIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=eLkMcQxA; 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=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw10-20020a170907a0ca00b0072ac5da9df6si3993649ejc.364.2022.07.08.03.44.00; Fri, 08 Jul 2022 03:44:26 -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=@linux.microsoft.com header.s=default header.b=eLkMcQxA; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237623AbiGHKmF (ORCPT + 99 others); Fri, 8 Jul 2022 06:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230392AbiGHKmF (ORCPT ); Fri, 8 Jul 2022 06:42:05 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 532AA7E03F; Fri, 8 Jul 2022 03:42:04 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1127) id E2009204C3FD; Fri, 8 Jul 2022 03:42:03 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E2009204C3FD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1657276923; bh=99rSQeHafgbRxHWOu2JfmcwUCoy/HYb3bmvsaH7S9FA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eLkMcQxAZBSwRbXNKgs3/0CKQ6oWSWLzxkK0eKZvuWEOWzZQVeif/ruEFgFmSr7MD 1wxtYq4/hFNDHvVSIXHgVrUmx5gLzYt80ni6nGbxD5wYTKTHh9pnP4jPTah4Tfu8R8 XEAHWyx0dkArbQ8nlLQcE8oQ5d6LZL9U1NHKD6xk= Date: Fri, 8 Jul 2022 03:42:03 -0700 From: Saurabh Singh Sengar To: David Laight Cc: 'Praveen Kumar' , "kys@microsoft.com" , "haiyangz@microsoft.com" , "sthemmin@microsoft.com" , "wei.liu@kernel.org" , "decui@microsoft.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "linux-hyperv@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "ssengar@microsoft.com" , "mikelley@microsoft.com" Subject: Re: [PATCH] scsi: storvsc: Prevent running tasklet for long Message-ID: <20220708104203.GA10366@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1657035141-2132-1-git-send-email-ssengar@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham 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 Wed, Jul 06, 2022 at 11:09:43AM +0000, David Laight wrote: > From: Praveen Kumar > > Sent: 06 July 2022 10:15 > > > > On 05-07-2022 21:02, Saurabh Sengar wrote: > > > There can be scenarios where packets in ring buffer are continuously > > > getting queued from upper layer and dequeued from storvsc interrupt > > > handler, such scenarios can hold the foreach_vmbus_pkt loop (which is > > > executing as a tasklet) for a long duration. Theoretically its possible > > > that this loop executes forever. Add a condition to limit execution of > > > this tasklet for finite amount of time to avoid such hazardous scenarios. > > Does this really make much difference? > > I'd guess the tasklet gets immediately rescheduled as soon as > the upper layer queues another packet? > > Or do you get a different 'bug' where it is never woken again > because the ring is stuck full? > > David My initial understanding was that staying in a tasklet for "too long" may not be a good idea, however I was not sure what the "too long" value be, thus we are thinking to provide this parameter as a configurable sysfs entry. I couldn't find any linux doc justifying this, so please correct me here if I am mistaken. We have also considered the networking drivers NAPI budget feature while deciding this approach, where softirq exits once the budget is crossed. This budget feature act as a performance tuning parameter for driver, and also can help with ring buffer overflow. I believe similar reasons are true for scsi softirq as well. NAPI budget Ref : https://wiki.linuxfoundation.org/networking/napi. - Saurabh > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales)