From nobody Tue Jun 14 16:41:58 2022 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 11D85838833; Tue, 14 Jun 2022 16:42:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LMvNT4JWnz3HdJ; Tue, 14 Jun 2022 16:42:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655224921; 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=sjZD9dc7N/IBTKsnp/MAEjC0kW4C4nOsj/OFytGRpIo=; b=nxV4MZxE0YHAXXqY+bCFRBm278ddCdvQG8JBTSa2d+dO81oVjMqyC1sYEgNIDaithWcECp kaRUXXe3qBWcwwgPiTb5/sKLGOYYvZAEbg6w1hGEx8jm6fp9YhUOqrPlstp7r+Q6Juj3mk FDfDLdkdO3WkGAjK0J+Rg8NdMNf0s1aiTEXmoKIpuCXB9w0EkYSkF08gdSatSfwNjxyCmM cyuyULOQn8CTRJjeHVQb7wBVGI6LdaqUbXVR62bqNAW7pXV0y+Of7t/7z0WBkTTECrEi2w hBfiDob3JFQ7dJi1Vhro9RXc2u0YaQMw/ocg1h+IlFVqCV8xHt5lxDYWslNi+g== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 70911B579; Tue, 14 Jun 2022 16:42:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <0e2172f8-21c1-afb1-9d2b-03ef14a4edf5@FreeBSD.org> Date: Tue, 14 Jun 2022 09:41:58 -0700 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: "Bjoern A. Zeeb" , Warner Losh Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202206121843.25CIhcLr014633@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: 0f7b9777f8f3 - main - rtw88: split driver up into a core and pci part In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655224921; 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=sjZD9dc7N/IBTKsnp/MAEjC0kW4C4nOsj/OFytGRpIo=; b=fr59BTwUj0lzsudGgBjiFu+yyxbK36f6lxMJI2NuGQbm6hfIzP4lfLuv7c0IFx3unFnKNp n/rO9Z+k9VIKQ6V/ZMwO2PQTb5EKggddo+W4YV/5kpxZ9aWfWA2ilbHVHyw/7a9/KHlj8n 0L8cbTUUos4c/AkZkIMIhLU2MPQbIHjH0fayasazS6miy4GfwA+IWicfkV+RauUUQXEOPj vg3XR4+kN2ufyoTuokeCT02910vvP1kAjjwR4G6FbCt1EU1N3wH9ra5WNI1YhYbBsst0Bj A0Fc8xNhrY5oXZzx9k1fl+gkUWZS+r3yoY504gpTgcXVTqFkD2BvtUQEO0KrZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655224921; a=rsa-sha256; cv=none; b=WxAn5LGiRyKsEIx0oEbb2eUbK4U1Mas8KDIVHb4DpJecXVCqfueip7RG5unit1/nvyAZIW FCk6EWLJXb40j3535oNB7J37vHuWO0hR9tXtXVYzb+vY7eo4S6Y02zf+apQ47VKrAASDw8 LlSHXi6BO5uO1NyskdiCEfQBD/0/viir81p7HRalByGA7R2sojhAFKjxSXmYsYC2ByVNuD TFZsU540Ap5tolXSRQIdn/MHvZ4ENUoq0qTjI2+lRqHN5D56+P47rsMSDh4I3RYI7soWbk Z2ZNNlqyNkoVqWgo/bWWt2qHkb4qSasjovxT0RS/9f7slhRxxTt+0wcMY0DtUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 6/13/22 10:37 AM, Bjoern A. Zeeb wrote: > On Mon, 13 Jun 2022, Warner Losh wrote: > >> On Mon, Jun 13, 2022, 8:28 AM John Baldwin wrote: >> >>> On 6/12/22 11:43 AM, Bjoern A. Zeeb wrote: >>>> The branch main has been updated by bz: >>>> >>>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=0f7b9777f8f39fbc230b3e1de2f844d9f839adea >>>> >>>> commit 0f7b9777f8f39fbc230b3e1de2f844d9f839adea >>>> Author: Bjoern A. Zeeb >>>> AuthorDate: 2022-06-12 18:35:58 +0000 >>>> Commit: Bjoern A. Zeeb >>>> CommitDate: 2022-06-12 18:35:58 +0000 >>>> >>>> rtw88: split driver up into a core and pci part >>>> >>>> Split the driver up into two modules (if_rtw88_pci.ko and >>> rtw88_core.ko). >>>> This is in preparation for the hopefully eventually upcoming USB >>> support >>>> using the same driver core. >>>> >>>> Note: this changes the module name to load to if_rtw88_pci.ko >>> instead of >>>> if_rtw88.ko. If using devmatch(8) everything should stay the same >>> as >>>> the driver name (used for net.wlan.devices) stays rtw88. If using >>>> kld_list in rc.conf or loader.conf you will need to adjust the name. >>>> Update man page for this. >>>> >>>> MFC after: 3 days >>> >>> This sort of split in a .ko is kind of rare for drivers in the tree that >>> support >>> multiple bus attachments. Usually we just lump all the attachments into >>> the same >>> .ko. It's true that with the death of ISA, etc. we no longer have as many >>> drivers >>> with multiple bus attachments, but the norm has been to include them all >>> in a >>> single .ko. Is there a reason you can't follow the normal practice here? > > I am not oppsed to one big blob but I wonder if it is "normal practise" > these days? > > I honestly didn't think much beyond PCI is in PCI and USB load where I > plug USB in but I couldn't think of many times having both and more > code exposure than needed. > > > So you made me go and think a bit about it and look into it: > > rtwn(4) is split up as "predecessor"; probably also influenced my > above thinking. Upstream has this one written in a way that it can > be split up natively between buses. In theory I this could be split > up into even per-chipset mostly apart from "core" and then one could > even start bundling chipset+fw together as an entity but that didn't > seem like "common practise". > > I think the main argument is that this isn't just a few lines of bus > attachment but larger parts of the driver (PCI vs. USB to come) given the > PCI per-chipset files contain tables etc. and is way bigger than the > actual common code (and USB will be fairly small I believe). > > -r-xr-xr-x 1 root wheel 308536 Jun 13 13:33 /boot/kernel/rtw88_core.ko > -r-xr-xr-x 1 root wheel 998712 Jun 13 13:33 /boot/kernel/if_rtw88_pci.ko > > And I don't neccessarily want to pull in two bus dependencies into the > same driver even if that seems the historical way of thinking; "MINIMAL" > is still a goal we once set out for and a way of thinking and autoloading > does sort things out these days without users having to fiddle anything > in the default case. > > Why do I need to load 1M file for PCI on a machine w/o PCI? Even many SoC boards have PCI, and anything approaching desktop class will have PCI, so lack of PCI is quite specious. That said, historically per-bus attachment code was indeed much smaller. OTOH, you can also selectively include files in the .ko at build-time, e.g. based on whether or not the base kernel included 'device pci' by checking for DEV_PCI in KERN_OPTS, something like: .if ${KERN_OPTS:MDEV_PCI} SRCS+= if_rtw88_pci.c .endif This more closely matches what happens in the kernel where you would have the sys/conf/files line be 'if_rtw88_pci.c optional rtw88 pci' > Why do we have separate parts for ACPI vs. FDT? Separate modules just for foo_acpi.c and foo_fdt.c? Those are probably bugs. > Why don't we have NTB support for AMD and Intel and ... together in > one .ko? Why is mac-* not one module? Why are geom part > implementations not one, or why are congestion control protocols, or > ipfw modules separate? > Why do I not get Panasonic, Fujitsu, Toshiba and HP ACPI modules on my > Thinkpad (even same bus attachments)? This is not the same as these are differently named drivers in most parts with different user interfaces. However, if you are going to have the 'foo0' interface, we assume that it loaded by 'if_foo.ko'. ifconfig(8) even has this knowledge baked in. > Or why do we not put all firmware blobs for the same driver in one > file (given firmware 9 can)? Because there is no point in loading > 12 firmware images into memory when 1 suffices? Firmware is not user facing in that it doesn't show up in the UI. > Isn't it actually more common to put things apart these days for > various reasons? Not for user-facing things. Note that urtwn and rtwn use different driver names. I'm not sure that was really the best decision and it is probably worth revisiting it in this case if it's really the same hardware just with different bus attachments. > I'd tend to argue that time has moved on and making things self-contained > smaller and simpler is a good thing in a too complex world. So the prior history is that I think ath(4) did this once and it was a POLA nightmare due to things like ifconfig(8), etc. -- John Baldwin