Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2727617rdb; Fri, 22 Sep 2023 07:00:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEc8u/WY7FUgGwBCGbdFUz+P5Vek+ch7FhlgeUYpaeBXqu4siawCasswNO77JjUnc5eWrEO X-Received: by 2002:a05:6808:200e:b0:3a8:4e25:38e7 with SMTP id q14-20020a056808200e00b003a84e2538e7mr9651936oiw.49.1695391247569; Fri, 22 Sep 2023 07:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695391247; cv=none; d=google.com; s=arc-20160816; b=y132jrgXRDktE6hIlxlRg+Q5H/gWxLm0T5zZPpir3B4wZiV3Ia76IksPgW1Rf/GReo LC9W8DgYlKJ1Voow2UkQfb/pcNNyc1zkvs76eBXm3FJsSm9WU2CX1W/xxklpNRbYlzDN mtG5nMnjFB8VdoGjXJ5MSQTXx6DXTcgR8WCHekV9R8IaAElMuaQvLhPWMh7w2PQw2us7 6lafWCis4y/VnaREbMY4T7iy8SQOeL4K7MU7uqamwoQTlZGE0OHSI3Iu0H83aMpV1Zso J5b5qsU6Fpp93MyCEnly869UX9/aTL8pFByKJxuRVZ1WQSSjyJZt+gEpR2+w9OBaUcSx omrA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=6gtB/j1aJ/v54tV0PTQ7LW78TWmuTnW88E+MNr8Zzbc=; fh=dkC+l4EQa4O/cvbWucv8pX74Eu1bRMUJwoXD8j+yTYI=; b=gaNHqXWPf/EKrleFHuBUEROlEo499DL5YGrU24NgLf0zM6GRqlc2PI2VsXrqzmTqxu YSEwNmkXIKPLB/Nb9E9R6aUmG88PHRncTo5M4I8mDOiiS2SA5mQOUUQiEDXvvjU/rs8C eyFzoMRM9LC1ckqtXjQFF6nTKCBSaaxHqQhoVdcibMp7RL1Zp9mAv8j2g563uFonze91 V4tp6j0DjSbe6e3PcXQN3ubpaIJIldEWvg6yGGB23XpqsUdpWGo4tVgk3Bjd8aWDU2Hl FYz5h0IE6VZzPbXxPrWBxaWgMj3cgNfVxv93weC7+mk0zI0NGiDiTk7HIlm3RqsOqA5q czHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zAUpq1Z6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="7Bc/A7kO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z6-20020a633306000000b005740ab95917si3160099pgz.45.2023.09.22.07.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 07:00:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zAUpq1Z6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="7Bc/A7kO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2D3DF8455589; Fri, 22 Sep 2023 00:27:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbjIVH1B (ORCPT + 99 others); Fri, 22 Sep 2023 03:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbjIVH0l (ORCPT ); Fri, 22 Sep 2023 03:26:41 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A17DE6A; Fri, 22 Sep 2023 00:26:19 -0700 (PDT) Date: Fri, 22 Sep 2023 09:26:14 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695367577; 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: in-reply-to:in-reply-to:references:references; bh=6gtB/j1aJ/v54tV0PTQ7LW78TWmuTnW88E+MNr8Zzbc=; b=zAUpq1Z6lwsBmAdroV/pNRDfHu6BTjZHV09Fy6xTJusAK3k7MO2EJvsNjmSiv3KmzrqYW0 U7pxSAkcHEXMuNJJcmUsezuKhRg79S/9/g9tVXUSGTQNaNLyDfyj599Tk0EoJmQ+PaO0Ej xJKVkXU+UlFHTLcHkwWgatqf3GURoLkZ9+3lwyExyXwh/C0dYvyJKJskNaCUXB5iXjOeyc zcL9n+IK6RpvdCZfNljxykIJxZ6Vu4v8nH0z6FO0ZaEKsREOCq//KbohzBzZd/nNFx77de FNJd8noV/kI9Vbv3LYyZ6EMm7hibZKlCVIp3dmteJ88uOYPqWwhMmEtGCsIDgA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695367577; 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: in-reply-to:in-reply-to:references:references; bh=6gtB/j1aJ/v54tV0PTQ7LW78TWmuTnW88E+MNr8Zzbc=; b=7Bc/A7kODDY2eUV5JhgyXJ+mE5qj9cz/GAe83+rGVd7TroDCdTEyh1lyIJeJCu04Wxkny6 Sein6bbaGP37xBCw== From: Sebastian Andrzej Siewior To: Ferenc Fejes Cc: Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Peter Zijlstra , Thomas Gleixner , Wander Lairson Costa Subject: Re: [RFC PATCH net-next 1/2] net: Use SMP threads for backlog NAPI. Message-ID: <20230922072614.aT8vDgAy@linutronix.de> References: <20230814093528.117342-1-bigeasy@linutronix.de> <20230814093528.117342-2-bigeasy@linutronix.de> <0a842574fd0acc113ef925c48d2ad9e67aa0e101.camel@redhat.com> <20230920155754.KzYGXMWh@linutronix.de> <2eb9af65d098bb54ed54178d7269e7197d6de5a0.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2eb9af65d098bb54ed54178d7269e7197d6de5a0.camel@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 00:27:02 -0700 (PDT) On 2023-09-21 12:41:33 [+0200], Ferenc Fejes wrote: > Hi! Hi, > > If we could somehow define a DoS condition once we are overwhelmed > > with > > packets, then we could act on it and throttle it. This in turn would > > allow a SCHED_FIFO priority without the fear of a lockup if the > > system > > is flooded with packets. > > Can this be avoided if we reuse gro_flush_timeout as the maximum time > the NAPI thread can be scheduled? First your run time needs to be accounted somehow. I observed that some cards/ systems tend pull often a few packets on each interrupt and others pull more packets at a time. So probably packets in a time frame would make sense. Maybe even plus packet size assuming larger packets require more processing time. If you run at SCHED_OTHER you don't care, you can keep it running. With SCHED_FIFO you would need to decide: - how much is too much - what to do once you reach too much Once you reach too much you could: - change the scheduling policy to SCHED_OTHER and keep going until it is no longer "too much in a given period" so you can flip it back. - stop processing for a period of time and risk packet loss which is defined as better than to continue. - pulling packets and dropping them instead of injecting into the stack. Using xdp/ebpf might be easy since there is an API for that. One could even peek at packets to decide if some can be kept. This would rely on the fact that the system can do this quick enough under a DoS condition. > > Ferenc Sebastian