From nobody Sat Oct 19 15:36:32 2024 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 4XW5Jx4dHvz5bCZw; Sat, 19 Oct 2024 15:36:33 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XW5Jx29RCz4hdv; Sat, 19 Oct 2024 15:36:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729352193; 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: in-reply-to:in-reply-to:references:references; bh=10te78MOFYU7fndnEnPyaHX0N8i3iqFi+BlskeXT8wY=; b=VWnt2+7Vd5toF2tYwXFYmYemeOmg3BXUKrO/GkH42HVQqIz+55w3fgn/lJ8CKrqwBodEYB Ty499gQVMTOPpVJi2t2nQC3x2PMMem9llYPSDmZr6hqwLn3hFZrDK+ZftwoeWH25/y9rQC r/p+DkrGKb/MIho2mbqy2ObCEcLwuF0DOnw5/DW5owbI25BZytE9fkOj022xuEe2WEaVbg S8bcFkb1aWK1+86LRtDU0VdvfUgxIcY43njHs6c0+5QqK0E8h7zh1KKhlInD9BDMRgaSzP qGuTDuKQxvFxoanSvMA8kYJ08eqhRkdml+TKvnmvybJkzdJolm0VGMWxz2QhpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729352193; 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: in-reply-to:in-reply-to:references:references; bh=10te78MOFYU7fndnEnPyaHX0N8i3iqFi+BlskeXT8wY=; b=QLU6SHZ2QKANpmFmNBiNOqsfiZiEkGvVZqLJ9oGHXPtlOFCdo+n/qbpa3IY+N/+WMMnfqA VGDLkx9j6zI3JyhDaBODbYrhNzMTE6oFuPFbW0rkNlzDWjps39Ofgm/HYKDayWMUPISKrx ju6Jt0hJEICy4vmnzcwTAl00KJprt/BjZF3R1K6iN9jFLF2ymHH4uzQlBRs0Luz5/n97ZH uyrGE3GpJbcTDq3tLz4ICvPryywCdkGNMyWLjzBJknw8bpYMAP/PmN4isUSKeF2pN1jkkQ RfrLqLMuPnjvmihG9CN5W8pJxnWROsf2AWpM5qXpysx0+u4eahk2i4GheVDxlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729352193; a=rsa-sha256; cv=none; b=iPajlnV3Kk8erjT5mspT2rfjB4bxSu0eqVKusryiUPc94P2Jns0MLTq8UaH0JsnnwxozNB 4IoezRzl7Tub50xw3W1FIcnhIIAFmewmyw/OT9IC7GKLjpGW1qhdT0fNsh7VyVAYZqwW0H KopzKbBNvvF7kQOFhR5PtaMOdnm6OYC+vxuUt9+XIBNS0vivwt+bLJBKFV9sGvyxKuubUJ lJl36FpNjMTV4lQyhg2Y6ZNrx9P8hjlrxtOs8AmfKyv/WPQ/1cQsc/Z6Cj2vTXCcR5ebRB 3XqXkxlHqSWhwSULpXHFqXlysE8Spmp0pUYjBr7C7G+aZlhr6HpsxjRxiNOFaA== Received: from [IPV6:2601:5c0:4200:b830:5c64:99cf:d897:544b] (unknown [IPv6:2601:5c0:4200:b830:5c64:99cf:d897:544b]) (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 4XW5Jx0QpNz11pV; Sat, 19 Oct 2024 15:36:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Sat, 19 Oct 2024 11:36:32 -0400 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 User-Agent: Mozilla Thunderbird Subject: Re: git: f4e35c044c89 - main - bus: Set the current VNET in device_attach() Content-Language: en-US To: Mark Johnston , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202410191304.49JD4JoM084001@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <202410191304.49JD4JoM084001@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/19/24 09:04, Mark Johnston wrote: > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f4e35c044c8988b7452cefbdcc417f5fd723e021 > > commit f4e35c044c8988b7452cefbdcc417f5fd723e021 > Author: Mark Johnston > AuthorDate: 2024-10-19 13:03:56 +0000 > Commit: Mark Johnston > CommitDate: 2024-10-19 13:03:56 +0000 > > bus: Set the current VNET in device_attach() > > Some drivers, in particular anything which creates an ifnet during > attach, need to have the current VNET set, as if_attach_internal() and > its callees access VNET-global variables. > > device_probe_and_attach() handles this, but this is not the only way to > arrive in DEVICE_ATTACH. In particular, bus drivers may invoke > device_attach() directly, as does devctl2's DEV_ENABLE ioctl handler. > So, set the current VNET in device_attach() instead. > > I believe it is always safe to use vnet0, as devctl2 ioctls are not > permitted within a jail. > > PR: 282168 > Reviewed by: zlei, kevans, bz, imp, glebius > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D47174 Hmm, there was some other review I thought that had a completely different change. That change removed all the vnet stuff from new-bus and instead handled it in if.c. Specifically, that if_attach would set a default vnet to vnet0 if there wasn't an active vnet at the time. See all the discussion in https://reviews.freebsd.org/D42678 which has a patch that I think is correct in the comments. -- John Baldwin