From owner-dev-commits-src-all@freebsd.org Tue Jan 19 19:42:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9A56D4DCEB9; Tue, 19 Jan 2021 19:42:23 +0000 (UTC) (envelope-from meloun.michal@gmail.com) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKzZR3gLdz4bgG; Tue, 19 Jan 2021 19:42:23 +0000 (UTC) (envelope-from meloun.michal@gmail.com) Received: by mail-ed1-x52b.google.com with SMTP id h16so22964640edt.7; Tue, 19 Jan 2021 11:42:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cxNK7KMhXM9GWGlY7tTCai/+TnJ050uA7jxqdyQ0J2o=; b=PNhFbiFR35Ii4CSEyylCNEp9bXo35zmrRx+R7ASgi71rlguQluc9ePIklgcVfjX7Rt 2LJJNOSDHIXzFkmfxpPFbykJ6WOeX4wslV1Xml25B4sx/ErUre9uXUpjjm/jUtfk5aZI PrCfOMSGiiTM+/ZIHl85SU+wBDZsjavmZ0srGwRefvmjJPegxxGdGYLur7PThlKecFBQ jY3gJO91Pso7WOB0wG8h6dtO+WhHJQ3Yw0hCzAptuDHjHkHZdPt8XoxuDnl/qHXeEerQ GKNxKHTyc6wCr7bm2jxLQ+XR36d0oo/1790WBh9B3vtvPwvobuQZgq1lNcw/otRg4wsz U9NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=cxNK7KMhXM9GWGlY7tTCai/+TnJ050uA7jxqdyQ0J2o=; b=Ey5vaeGQ2Dt+EIERkac9LtaI0kWlCjGphI5ZD6ScPMi/Zd8PKxMwRixdKE631Vyg3O Zi+/PD1yJ2IQq1YXQ/P6lTy+RQMWUvpUOGNCM5Pnr8c6ld9zJzXBDSKFiBMvGMSao3Hu AvqV0xsE4PNajstuavwhFLVwSn+3ow12dFrOFt9hW+h6kJYoHRys4/FP2Z1rK0rhC2+x fLEXFJ0HbIU+Ggo14wXGjdZ2ic/s3iodie7HcVE/QRwbdKY/zhBG0hM+bYF2zvUzH9g4 hVm/S0Z/M6+v+e1PH2NfnqJWLJXG2SGrqswOvdBYKIJiq42kB1sQI5nvKXr+g0ErRTu6 PBPg== X-Gm-Message-State: AOAM5320zbDZszKIHziSQMFZeGvsNMgXfmGGsZHlfjC6Xb7oU8pyRCy4 beQedDrv+h3Hl0I+V2u9l2HMYEu+HyakWA== X-Google-Smtp-Source: ABdhPJxg4J7lWIAEeuw2LZ6ItlcteoVBithZ/2UJX/kM8PVd+6IXIXcdZhhv7Ni0VdgESV0E5Z3Drg== X-Received: by 2002:a50:e719:: with SMTP id a25mr4678922edn.12.1611085341710; Tue, 19 Jan 2021 11:42:21 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id p3sm12607354edh.50.2021.01.19.11.42.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jan 2021 11:42:13 -0800 (PST) Sender: Michal Meloun Reply-To: meloun.michal@gmail.com Subject: Re: git: 248f0cabca75 - main - make maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V To: John Baldwin , Jessica Clarke , Oleksandr Tymoshenko Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101190036.10J0aj3O033256@gitrepo.freebsd.org> <8FE79D0F-602A-4C98-893A-806E72ED991B@freebsd.org> From: Michal Meloun Message-ID: <80a3722c-16d1-0e8e-b6e1-4bdcfb554aa4@gmail.com> Date: Tue, 19 Jan 2021 20:42:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DKzZR3gLdz4bgG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 19:42:23 -0000 On 19.01.2021 19:41, John Baldwin wrote: > On 1/19/21 8:43 AM, Jessica Clarke wrote: >> On 19 Jan 2021, at 00:36, Oleksandr Tymoshenko wrote: >>> @@ -142,21 +143,15 @@ static bool irq_assign_cpu = false; >>> #endif >>> #endif >>> >>> -/* >>> - * - 2 counters for each I/O interrupt. >>> - * - MAXCPU counters for each IPI counters for SMP. >>> - */ >>> -#ifdef SMP >>> -#define INTRCNT_COUNT (NIRQ * 2 + INTR_IPI_COUNT * MAXCPU) >>> -#else >>> -#define INTRCNT_COUNT (NIRQ * 2) >>> -#endif >>> +int intr_nirq = NIRQ; >>> +SYSCTL_UINT(_machdep, OID_AUTO, nirq, CTLFLAG_RDTUN, &intr_nirq, 0, >>> + "Number of IRQs"); >> >> Unsigned integer, given the SYSCTL_UINT? >> >> What's stopping us from dynamically resizing rather than forcing the >> user to use a tunable (which also means that, in practice, the limit >> will remain unchanged, because you want GENERIC kernels to work out of >> the box)? > > For x86 (and probably the same here), the biggest headache is that there > is a dynamically allocated array indexed by IRQ value at interrupt > invocation time. Currently it uses no locks since the value of the > pointer is set during boot time and then never changes. Making it > dynamic would require allowing that pointer to change and dealing with > what that entails in a very hot path. Generally speaking, the majority > of interrupts used in a given system are allocated during boot and not > by hotplug devices added post-boot, so there is also not a lot of utility > in having this run-time tunable vs a boot-time tunable. > To be exact, the main headaches are intrcnt and intrnames arrays and their relationship to the sysctl interface. These fields are used without locking, they do not have the ability to mark interrupt at given index as unused. This is the real reason why we can't unload a driver that acts as an interrupt controller (e.g. USB parallel port with the possibility of interrupts on each pin). Everything else in subr_intr.c should be prepared for dynamic allocation/delete of interrupt sources. Michal