From nobody Tue Apr 01 16:21:16 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZRtY14ykfz5rlhg; Tue, 01 Apr 2025 16:21:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZRtY118l9z3dnd; Tue, 01 Apr 2025 16:21:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743524485; 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=OS6O3QAvaXYnh+UM0ilVGsqmYZtgabL1m8cb0WhQqw0=; b=cjUKdsNG9OC0J5B3q3ZbqU3Q/LCD9dn9nyuRL568M0DezYorGJRrVauZ27BFTUtSwE8lNr KbESNE620NbHPJXh7AKmZmgzMvz4eLkO+wZxaMVBHesBwB2DASLZsrDqBKHBDG/gWjPf6G a1W1G5ckZnDp90Rp9mTFPbY1uJUu/9YR5hqTc8kTE9kwsDTPnggJ9nB1PSp/uGlYxHr5ov RllyGr/NNRnxLDslGIHq3UH+wVgCi2VgIWM8OI2BXN81ceaRzkIyNJ8XBHPTzTmIU1anXN 63+fTeGJxkp16AsHlmDDDX1Jhkwa15JcwiauumZSfbJSZ/mte1PX7kKoRX5x3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1743524485; a=rsa-sha256; cv=none; b=oOhcrtGfEBymE2q74VpBkzhmZ3+Hu6Euf2kInR2H5icAIWo6yFNA0kQaS/NvyAUgfd7D4b dHg3RP9TqIGQK6AZjvLGDAgFcvOd2bq9G/g18tlIpwdRTuS/H0rkloe4LYTLWsv1yC10hb kLxEJZrFJFxln5KUfoTJuFpnc5ggDUs4xWU+cYs6oxzFcewoZa8h3rlSYepWf6wH7MEmKB uQCLebwfKSIVLdlcBEbXKdfYmRD9I3IL2iZtclYFAUU316i1BG9JNhtg/Ottbg8c8aF8f2 CLU/8FphG1cJE1uAV1lqxFSuTS+zktgqWVzhis9AtwaS4D4DgN/mYQJzQb5RvQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743524485; 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=OS6O3QAvaXYnh+UM0ilVGsqmYZtgabL1m8cb0WhQqw0=; b=SYxDcKZSetvS3MW+W2WzKU+tj/56Wz2sh4Um5TfZRM4kko9ICcJRn0mGpqzoDERTTH8t15 RiavwMxw2yZBFtaDHJN2Z3l2USQlt/X/pOx2Rm0Jz7/xJgwjxxV6RCd6d5/1aId7YEUDVr JjtRRvaNJs8RIurnIlc/EIVmwmI+xAcjJh9XaI6HrWfsz4c+FmGnkuJ599KvwUq9qr7VKw G17LTy6sMpZpjJ/dPxlywJLMsTLPylhP0nuq7/akdTBTTtQoD/ZstFS4N342Jzk2MlBGFL bZIap10fwni6/EA/XO3WoahncIoYqgxB9Kw+J83mtU34C3uOhjjvBzFb0POLhg== Received: from [IPV6:2a05:b400:110:12fe::54] (user-12fe-54.svr-vpn-1.vpn.cl.cam.ac.uk [IPv6:2a05:b400:110:12fe::54]) (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 did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4ZRtXz6J5vzGBY; Tue, 01 Apr 2025 16:21:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Tue, 1 Apr 2025 12:21:16 -0400 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 0e33c2e6df7a - main - pci: Only re-route IRQs based on firmware on x86 Content-Language: en-US To: Jessica Clarke , Colin Percival Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202503292018.52TKI7va048377@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/31/25 14:14, Jessica Clarke wrote: > On 29 Mar 2025, at 20:18, Colin Percival wrote: >> >> The branch main has been updated by cperciva: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=0e33c2e6df7a5de65db40c7cc0fc97f66da28ccd >> >> commit 0e33c2e6df7a5de65db40c7cc0fc97f66da28ccd >> Author: Colin Percival >> AuthorDate: 2025-03-28 18:07:01 +0000 >> Commit: Colin Percival >> CommitDate: 2025-03-29 20:17:29 +0000 >> >> pci: Only re-route IRQs based on firmware on x86 >> >> There is a (very historical) call to pci_assign_interrupt for the >> purpose of routing IRQs which may have been set up wrong by x86 BIOS >> or firmware. On non-x86 systems, this is unnecessary; and on INTRNG >> systems it results in a (synthetic) IRQ leak and ultimately a kernel >> panic after many hotplug/unplug cycles. > > This is in fact incorrect. Whilst there may well be a leak that needs > fixing, the rerouting is absolutely needed on non-x86 platforms. See > 5884fab46153dee52bda660bcabca95c3cc97f44 and > 7de649170fd804668da78f005c7966941b402106 for some of the history behind > this. As a result of this commit the problem described in the second > commit is reintroduced. Hmm, this is my bad as I should have remembered those. However, as the second commit log alludes to, INTRng does not really match the design of what is intended here and what the PCI bus currently expects. The intr_map[] entry should probably only be allocated when the INTx IRQ is allocated via bus_alloc_resource() with a rid of 0, not when the IRQ is routed. In particular, there is no "unroute" callback which is where the leak comes from. The intention of routing is to confirm which pin on a PIC a PCI INTx line is connected to. It is not to actually allocate the interrupt as the routing may never get used if either MSI is used instead or if no driver attaches. The 0x20-0x23 you mention in the second commit log should probably be the IRQ value used instead of a dynamically allocated value, and the dynamically allocated value should be allocated as a result of bus_alloc_resource and stored internally. x86 manages to do this today with the mapping of (local APIC, IDT vector) tuples not encoded in the IRQ values. -- John Baldwin