From owner-dev-commits-src-main@freebsd.org Thu Mar 11 18:35:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69D355A9AC4; Thu, 11 Mar 2021 18:35:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DxHgm09Rxz3k9w; Thu, 11 Mar 2021 18:35:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 12BIZNWL011269 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 11 Mar 2021 20:35:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12BIZNWL011269 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12BIZNce011267; Thu, 11 Mar 2021 20:35:23 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 11 Mar 2021 20:35:23 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . Message-ID: References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.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=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DxHgm09Rxz3k9w X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 18:35:32 -0000 On Thu, Mar 11, 2021 at 07:17:41PM +0100, Hans Petter Selasky wrote: > On 3/11/21 6:13 PM, John Baldwin wrote: > > On 3/10/21 2:09 AM, Hans Petter Selasky wrote: > > > On 3/10/21 11:04 AM, Konstantin Belousov wrote: > > > > This probably hangs machine instead of panicing.  In low memory > > > > condition, > > > > you do not handle interrupt, which probably mean that the source is not > > > > silenced, and after EOI the same interrupt will be generated again. > > > > > > Hi, > > > > > > This usually happens during boot. Another possibility is to panic() > > > there. I don't see so many options. > > > > Is there no way to pre-allocate this?  That is, could we not have all > > ithreads invoke this during their initialization, and have the module > > handler for linuxkpi iterate over ithreads allocating one for > > each ithread during MOD_LOAD? > > > > I think there are few enough ithreads that allocating "extra" ones > > is probably ok.  Alternatively, you could hook into the path when an > > interrupt is registered perhaps by passing some sort of INTR_LINUX > > flag or the like that causes kern_intr.c to allocate one for the > > associated ithread when the interrupt is registered. > > > > Yes, I have a review for that: > https://reviews.freebsd.org/D29183 And I dislike this. It is yet another case of introducing consumer-specific logic into core. Isn't netepoch example enough? I presented another patch to Hans, where task and mm allocations are switched to zones, and the zones have reserve applied. Then allocations from ithreads use the reserve. There is one detail there, reserve is finite, for x86 I set it to the total limit of interrupts. This somewhat breaks if interrupts are deallocated and reallocated, but I think it is good enough even with this wart.