From nobody Sun Feb 9 17:27:24 2025 X-Original-To: dev-commits-src-all@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 4YrZQh3XxJz5mjrk; Sun, 09 Feb 2025 17:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YrZQh2qYhz49vw; Sun, 09 Feb 2025 17:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739122044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2q8Vd5G+QW9iIbg8pClOUGX35MEKoHn40kHO1Rp2t+Q=; b=vLCxqppK4cLS/A7fh3KzCefvpmemNAHBz8Wcdu+RZ9kL7XArFYYr9EG5X+b4mNeJGGTpmq hgkxNHYNQOA/onm4tSuRlv6dprckQYZaeB8gvRE2YBttpJGgkRuxd32L1vsORXkKVC7we2 QMW0hVlM5/IknN9iKH4QktFBoIhq+H65Ysu4+j9oNaBuJ5Mv98hU9n54pPZW/ht7OIIOSl 2ZuLnYvL73Ki3IzljFvPV02CRYySIlsBAWhJKjvto1y2dRTvW7cZeklYBDQBXi3Uc8aRBQ C5u/8F9IbBx8YWppkpmbj/i8rueIp8CF63xJ6xCbARVYKXw5PXwIN/1H2q++mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739122044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2q8Vd5G+QW9iIbg8pClOUGX35MEKoHn40kHO1Rp2t+Q=; b=BOIcmsMp8lZH4jatbnVewb4cMg4NbaoFqsbTbh7oHzjFujjkRIq6h4w+iYwIumlC7OdpPg 9JP4fDDhMyyt6udLNmSu99+RWztmxdDMp+ouHp+WQsoYl1DT3kCUMWDcAXvoQrVSbWhjPl 4LvxCgH3iHNZoiHgYH3xHjYYIgAw2TGGHUOp9/wv/iAShOt9V6Tw+4n3JZJqYGJZSye/7d TUCmBsLnTMwcxly2OcOZ6MpBgha1rdvub5UG49jmgC/BsuTpDBP/ZCjMhL67QkOz3lzqA1 rPjR8bjDofT9CuosMYr68qBLS5NHjIwi+o43wod30XAit1MUttFk/ROLV7UgMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739122044; a=rsa-sha256; cv=none; b=Hnk3yX5G5jpvBRnNb9d937GLJLsc82tnmGMDqVsSkxrkcMuLH7vDBjOY5rUqtVEQFGc+zB IdpUg4zpeFtCXGzQrYMu3K5hsjpoi1vVPWdl8z5ImbpTtq/WI0eFie+Lqa9h4wwM3SIZj6 45J0IppEIv+39M9bueJjDSz7ezaY4bWMLZvU2mgaZT+WXneKeks5xrPdGoo1C273Bsi2H1 /qIEudGn9JSmw+6CLpedUlCpI1eeMbjrJOcbKPlphZkLWgw5PeczPVFSRQeMyp/J1J/7aT hlQ7TbudJ33Ig/Quu/d4Rva6WIreL2pfl6Wtp9OxWf2CUucN6H+Z3VuCpq7+qQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YrZQh2C0Yz15fY; Sun, 09 Feb 2025 17:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 519HROFe014451; Sun, 9 Feb 2025 17:27:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 519HROao014448; Sun, 9 Feb 2025 17:27:24 GMT (envelope-from git) Date: Sun, 9 Feb 2025 17:27:24 GMT Message-Id: <202502091727.519HROao014448@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 80ec95226e17 - main - busdma: Always initialize bounce page STAILQ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80ec95226e170d36071b0542ade8fbcf417e7aa5 Auto-Submitted: auto-generated The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=80ec95226e170d36071b0542ade8fbcf417e7aa5 commit 80ec95226e170d36071b0542ade8fbcf417e7aa5 Author: Shawn Anastasio AuthorDate: 2025-02-09 17:27:07 +0000 Commit: Justin Hibbits CommitDate: 2025-02-09 17:29:56 +0000 busdma: Always initialize bounce page STAILQ Summary: Always call STAILQ_INIT in bus_dmamap_create regardless of whether BUS_DMA_COULD_BOUNCE is set. This avoids tripping the assertions added by commit 34740937f7a4 when the queue is checked with STAILQ_EMPTY in free_bounce_pages. Test Plan: Without this patch applied, booting fails as follows (pseries guest on Linux/ppc64le KVM host): vtblk0: numa-domain 0 on virtio_pci1 panic: Empty stailq 0x8ed4480->stqh_last is 0, not head's first field address cpuid = 0 time = 1 KDB: stack backtrace: 0xc00800000000bcc0: at kdb_backtrace+0x60 0xc00800000000bdd0: at vpanic+0x1d4 0xc00800000000be80: at panic+0x44 0xc00800000000beb0: at bus_dmamap_unload+0x394 0xc00800000000bf60: at vtblk_poll_request+0x16c 0xc00800000000bff0: at vtblk_attach_completed+0x208 0xc00800000000c220: at vtpci_legacy_probe_and_attach_child+0x224 0xc00800000000c270: at vtpci_legacy_attach+0x2c0 0xc00800000000c320: at device_attach+0x568 0xc00800000000c400: at bus_attach_children+0x8c 0xc00800000000c440: at ofw_pcibus_attach+0x398 0xc00800000000c550: at device_attach+0x568 0xc00800000000c630: at bus_attach_children+0x8c 0xc00800000000c670: at ofw_pcib_attach+0x68 0xc00800000000c6a0: at rtaspci_attach+0x18c 0xc00800000000c6f0: at device_attach+0x568 0xc00800000000c7d0: at bus_generic_new_pass+0x198 0xc00800000000c820: at bus_generic_new_pass+0x10c 0xc00800000000c870: at bus_generic_new_pass+0x10c 0xc00800000000c8c0: at root_bus_configure+0x6c 0xc00800000000c910: at configure+0x1c 0xc00800000000c940: at mi_startup+0x298 0xc00800000000ca50: at __start+0xfc KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at kdb_enter+0x70: ori r0, r0, 0x0 With the patch applied to properly initialize the STAILQ unconditionally, the assertion is no longer hit and the system boots as expected. Reviewers: jhibbits, jhb, #powerpc, markj Reviewed By: jhibbits, jhb, #powerpc, markj Subscribers: imp, bdragon, luporl, alfredo, #powerpc Tags: #powerpc Differential Revision: https://reviews.freebsd.org/D48600 --- sys/powerpc/powerpc/busdma_machdep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index 34dcea8de9ee..65f90aa4affa 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -303,6 +303,9 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) return (ENOMEM); } + /* Initialize the new map */ + STAILQ_INIT(&((*mapp)->bpages)); + /* * Bouncing might be required if the driver asks for an active * exclusion region, a data alignment that is stricter than 1, and/or @@ -319,9 +322,6 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) } bz = dmat->bounce_zone; - /* Initialize the new map */ - STAILQ_INIT(&((*mapp)->bpages)); - /* * Attempt to add pages to our pool on a per-instance * basis up to a sane limit.