Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
On Mon, Aug 14, 2023 at 09:50:49AM +, Quan, Evan wrote: > [AMD Official Use Only - General] > > Hi Andrew, > > I sent out a new V8 series last week. > A kernel parameter `wbrf` was introduced there to decide the policy. > Please help to check whether that makes sense to you. > Please share your insights there. netdev has a pretty strong policy of not adding new kernel parameters. It is a really painful interface to use, and there are generally better configuration interfaces within netdev. However, as far as i can see, it is outside of netdev, so this policy does not necessarily apply. Andrew
Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
On Tue, 2023-07-25 at 22:09 +0200, Andrew Lunn wrote: > > > It could well be that AMD based machine has a different ACPI extension > to indicate this policy to what Intel machine has. As far as i > understand it, you have not submitted this yet for formal approval, > this is all vendor specific, so Intel could do it completely > differently. Already do, without the host software being involved in the same way. There, I believe the ACPI tables just indicate what's needed and the WiFi firmware sorts out the rest. johannes
RE: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
[AMD Official Use Only - General] Hi Andrew, I sent out a new V8 series last week. A kernel parameter `wbrf` was introduced there to decide the policy. Please help to check whether that makes sense to you. Please share your insights there. BR, Evan > -Original Message- > From: Andrew Lunn > Sent: Wednesday, July 26, 2023 4:10 AM > To: Limonciello, Mario > Cc: Quan, Evan ; raf...@kernel.org; l...@kernel.org; > Deucher, Alexander ; Koenig, Christian > ; Pan, Xinhui ; > airl...@gmail.com; dan...@ffwll.ch; johan...@sipsolutions.net; > da...@davemloft.net; eduma...@google.com; k...@kernel.org; > pab...@redhat.com; mdaen...@redhat.com; > maarten.lankho...@linux.intel.com; tzimmerm...@suse.de; > hdego...@redhat.com; jingyuwang_...@163.com; Lazar, Lijo > ; jim.cro...@gmail.com; bellosili...@gmail.com; > andrealm...@igalia.com; t...@redhat.com; j...@jsg.id.au; a...@arndb.de; > linux-ker...@vger.kernel.org; linux-a...@vger.kernel.org; amd- > g...@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux- > wirel...@vger.kernel.org; net...@vger.kernel.org > Subject: Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF > > > This comes back to the point that was mentioned by Johannes - you need > > to have deep design understanding of the hardware to know whether or > > not you will have producers that a consumer need to react to. > > Yes, this is the policy is keep referring to. I would expect that there is > something > somewhere in ACPI which says for this machine, the policy is Yes/No. > > It could well be that AMD based machine has a different ACPI extension to > indicate this policy to what Intel machine has. As far as i understand it, you > have not submitted this yet for formal approval, this is all vendor specific, > so > Intel could do it completely differently. Hence i would expect a generic API > to > tell the core what the policy is, and your glue code can call into ACPI to > find out > that information, and then tell the core. > > > If all producers indicate their frequency and all consumers react to > > it you may have activated mitigations that are unnecessary. The > > hardware designer may have added extra shielding or done the layout > > such that they're not needed. > > And the policy will indicate No, nothing needs to be done. The core can then > tell produces and consumes not to bother telling the core anything. > > > So I don't think we're ever going to be in a situation that the > > generic implementation should be turned on by default. It's a "developer > knob". > > Wrong. You should have a generic core, which your AMD CPU DDR device > plugs into. The Intel CPU DDR device can plug into, the nvidea GPU can plug > into, your Radeon GPU can plug into, the intel ARC can plug into, the generic > WiFi core plugs into, etc. > > > If needed these can then be enabled using the AMD ACPI interface, a DT > > one if one is developed or maybe even an allow-list of SMBIOS strings. > > Notice i've not mentioned DT for a while. I just want a generic core, which > AMD, Intel, nvidea, Ampare, Graviton, Qualcomm, Marvell, ..., etc can use. We > should be solving this problem once, for everybody, not adding a solution for > just one vendor. > > Andrew
Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
On 7/25/23 15:09, Andrew Lunn wrote: This comes back to the point that was mentioned by Johannes - you need to have deep design understanding of the hardware to know whether or not you will have producers that a consumer need to react to. Yes, this is the policy is keep referring to. I would expect that there is something somewhere in ACPI which says for this machine, the policy is Yes/No. It's not yes/no for a "model" or "machine". It's yes/no for a given *device* within a machine. It could well be that AMD based machine has a different ACPI extension to indicate this policy to what Intel machine has. As far as i understand it, you have not submitted this yet for formal approval, this is all vendor specific, so Intel could do it completely differently. Hence i would expect a generic API to tell the core what the policy is, and your glue code can call into ACPI to find out that information, and then tell the core. Which is exactly what wbrf_supported_producer() and wbrf_supported_consumer() do. If there is another vendor's implementation introduced they can make those functions return TRUE for their implementations. If all producers indicate their frequency and all consumers react to it you may have activated mitigations that are unnecessary. The hardware designer may have added extra shielding or done the layout such that they're not needed. And the policy will indicate No, nothing needs to be done. The core can then tell produces and consumes not to bother telling the core anything. So I don't think we're ever going to be in a situation that the generic implementation should be turned on by default. It's a "developer knob". Wrong. You should have a generic core, which your AMD CPU DDR device plugs into. The Intel CPU DDR device can plug into, the nvidea GPU can plug into, your Radeon GPU can plug into, the intel ARC can plug into, the generic WiFi core plugs into, etc. It's not a function of "device" though, it's "device within machine". If needed these can then be enabled using the AMD ACPI interface, a DT one if one is developed or maybe even an allow-list of SMBIOS strings. Notice i've not mentioned DT for a while. I just want a generic core, which AMD, Intel, nvidea, Ampare, Graviton, Qualcomm, Marvell, ..., etc can use. We should be solving this problem once, for everybody, not adding a solution for just one vendor. Andrew I don't see why other implementations can't just come up with other platform specific ways to respond affirmatively to wbrf_supported_producer() or wbrf_supported_consumer().
Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
> This comes back to the point that was mentioned by Johannes - you need to > have deep design understanding of the hardware to know whether or not you > will have producers that a consumer need to react to. Yes, this is the policy is keep referring to. I would expect that there is something somewhere in ACPI which says for this machine, the policy is Yes/No. It could well be that AMD based machine has a different ACPI extension to indicate this policy to what Intel machine has. As far as i understand it, you have not submitted this yet for formal approval, this is all vendor specific, so Intel could do it completely differently. Hence i would expect a generic API to tell the core what the policy is, and your glue code can call into ACPI to find out that information, and then tell the core. > If all producers indicate their frequency and all consumers react to it you > may have activated mitigations that are unnecessary. The hardware designer > may have added extra shielding or done the layout such that they're not > needed. And the policy will indicate No, nothing needs to be done. The core can then tell produces and consumes not to bother telling the core anything. > So I don't think we're ever going to be in a situation that the generic > implementation should be turned on by default. It's a "developer knob". Wrong. You should have a generic core, which your AMD CPU DDR device plugs into. The Intel CPU DDR device can plug into, the nvidea GPU can plug into, your Radeon GPU can plug into, the intel ARC can plug into, the generic WiFi core plugs into, etc. > If needed these can then be enabled using the AMD ACPI interface, a DT one > if one is developed or maybe even an allow-list of SMBIOS strings. Notice i've not mentioned DT for a while. I just want a generic core, which AMD, Intel, nvidea, Ampare, Graviton, Qualcomm, Marvell, ..., etc can use. We should be solving this problem once, for everybody, not adding a solution for just one vendor. Andrew
Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
On 7/25/2023 13:57, Andrew Lunn wrote: @@ -1395,6 +1395,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) debugfs_hw_add(local); rate_control_add_debugfs(local); + ieee80211_check_wbrf_support(local); + rtnl_lock(); wiphy_lock(hw->wiphy); +void ieee80211_check_wbrf_support(struct ieee80211_local *local) { + struct wiphy *wiphy = local->hw.wiphy; + struct device *dev; + + if (!wiphy) + return; + + dev = wiphy->dev.parent; + if (!dev) + return; + + local->wbrf_supported = wbrf_supported_producer(dev); + dev_dbg(dev, "WBRF is %s supported\n", + local->wbrf_supported ? "" : "not"); } This seems wrong. wbrf_supported_producer() is about "Should this device report the frequencies it is using?" The answer to that depends on a combination of: Are there consumers registered with the core, and is the policy set so WBRF should take actions. > The problem here is, you have no idea of the probe order. It could be this device probes before others, so wbrf_supported_producer() reports false, but a few second later would report true, once other devices have probed. It should be an inexpensive call into the core, so can be made every time the channel changes. All the core needs to do is check if the list of consumers is empty, and if not, check a Boolean policy value. Andrew No, it's not a combination of whether consumers are registered with the core. If a consumer probes later it needs to know the current in use frequencies too. The reason is because of this sequence of events: 1) Producer probes. 2) Producer selects a frequency. 3) Consumer probes. 4) Producer stays at same frequency. If the producer doesn't notify the frequency because a consumer isn't yet loaded then the consumer won't be able to get the current frequency. Yes, exactly. So now we are back to, what is the point of wbrf_supported_producer()? I'm talking general case here, not your ACPI implementation. All i'm really interested in is the generic API, which is what an Intel CPU, combined with a Radieon GPU and a Qualcomm WiFi device will use. Or an AMD CPU combined with an nvidia GPU and a Mediatek Wifi, etc. The wbrf core should support an combination of produces and consumers in a generic way. If you assume devices can probe in any order, and come and go, it seems like the producers need to always report what frequencies they are using. Otherwise when a noise generator pops into existence, as you say, it has no idea what frequencies the producers are using. As the series stands today if the probe order is reversed everything works fine. 1) Consumer probes 2) Producer probes 3) Producer selects a frequency 4) Consumer reacts to frequency. The exception is when policy says there is no need to actually do anything. If we can assume the policy is fixed, then wbrf_supported_producer() could just report the policy which the wbrf core should know about. Andrew This comes back to the point that was mentioned by Johannes - you need to have deep design understanding of the hardware to know whether or not you will have producers that a consumer need to react to. For example the physical location GDDR6 memory and proximity to the hinge where the antenna was routed might play a big factor in whether you need something like this. If all producers indicate their frequency and all consumers react to it you may have activated mitigations that are unnecessary. The hardware designer may have added extra shielding or done the layout such that they're not needed. So I don't think we're ever going to be in a situation that the generic implementation should be turned on by default. It's a "developer knob". As mentioned in the Kconfig it's intended use is for identifying situations that may benefit from mitigation before support was introduced into the firmware. If needed these can then be enabled using the AMD ACPI interface, a DT one if one is developed or maybe even an allow-list of SMBIOS strings.
Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
> > >> @@ -1395,6 +1395,8 @@ int ieee80211_register_hw(struct > > ieee80211_hw *hw) > > >>debugfs_hw_add(local); > > >>rate_control_add_debugfs(local); > > >> > > >> + ieee80211_check_wbrf_support(local); > > >> + > > >>rtnl_lock(); > > >>wiphy_lock(hw->wiphy); > > >> > > > > > >> +void ieee80211_check_wbrf_support(struct ieee80211_local *local) { > > >> + struct wiphy *wiphy = local->hw.wiphy; > > >> + struct device *dev; > > >> + > > >> + if (!wiphy) > > >> + return; > > >> + > > >> + dev = wiphy->dev.parent; > > >> + if (!dev) > > >> + return; > > >> + > > >> + local->wbrf_supported = wbrf_supported_producer(dev); > > >> + dev_dbg(dev, "WBRF is %s supported\n", > > >> + local->wbrf_supported ? "" : "not"); } > > > > > > This seems wrong. wbrf_supported_producer() is about "Should this > > > device report the frequencies it is using?" The answer to that depends > > > on a combination of: Are there consumers registered with the core, and > > > is the policy set so WBRF should take actions. > The problem here is, > > > you have no idea of the probe order. It could be this device probes > > > before others, so wbrf_supported_producer() reports false, but a few > > > second later would report true, once other devices have probed. > > > > > > It should be an inexpensive call into the core, so can be made every > > > time the channel changes. All the core needs to do is check if the > > > list of consumers is empty, and if not, check a Boolean policy value. > > > > > > Andrew > > > > No, it's not a combination of whether consumers are registered with the > > core. > > If a consumer probes later it needs to know the current in use frequencies > > too. > > > > The reason is because of this sequence of events: > > 1) Producer probes. > > 2) Producer selects a frequency. > > 3) Consumer probes. > > 4) Producer stays at same frequency. > > > > If the producer doesn't notify the frequency because a consumer isn't yet > > loaded then the consumer won't be able to get the current frequency. > Yes, exactly. So now we are back to, what is the point of wbrf_supported_producer()? I'm talking general case here, not your ACPI implementation. All i'm really interested in is the generic API, which is what an Intel CPU, combined with a Radieon GPU and a Qualcomm WiFi device will use. Or an AMD CPU combined with an nvidia GPU and a Mediatek Wifi, etc. The wbrf core should support an combination of produces and consumers in a generic way. If you assume devices can probe in any order, and come and go, it seems like the producers need to always report what frequencies they are using. Otherwise when a noise generator pops into existence, as you say, it has no idea what frequencies the producers are using. The exception is when policy says there is no need to actually do anything. If we can assume the policy is fixed, then wbrf_supported_producer() could just report the policy which the wbrf core should know about. Andrew
RE: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
[AMD Official Use Only - General] > -Original Message- > From: Limonciello, Mario > Sent: Monday, July 24, 2023 9:41 PM > To: Andrew Lunn ; Quan, Evan > Cc: raf...@kernel.org; l...@kernel.org; Deucher, Alexander > ; Koenig, Christian > ; Pan, Xinhui ; > airl...@gmail.com; dan...@ffwll.ch; johan...@sipsolutions.net; > da...@davemloft.net; eduma...@google.com; k...@kernel.org; > pab...@redhat.com; mdaen...@redhat.com; > maarten.lankho...@linux.intel.com; tzimmerm...@suse.de; > hdego...@redhat.com; jingyuwang_...@163.com; Lazar, Lijo > ; jim.cro...@gmail.com; bellosili...@gmail.com; > andrealm...@igalia.com; t...@redhat.com; j...@jsg.id.au; a...@arndb.de; > linux-ker...@vger.kernel.org; linux-a...@vger.kernel.org; amd- > g...@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux- > wirel...@vger.kernel.org; net...@vger.kernel.org > Subject: Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF > > On 7/24/2023 04:22, Andrew Lunn wrote: > >> @@ -1395,6 +1395,8 @@ int ieee80211_register_hw(struct > ieee80211_hw *hw) > >>debugfs_hw_add(local); > >>rate_control_add_debugfs(local); > >> > >> + ieee80211_check_wbrf_support(local); > >> + > >>rtnl_lock(); > >>wiphy_lock(hw->wiphy); > >> > > > >> +void ieee80211_check_wbrf_support(struct ieee80211_local *local) { > >> + struct wiphy *wiphy = local->hw.wiphy; > >> + struct device *dev; > >> + > >> + if (!wiphy) > >> + return; > >> + > >> + dev = wiphy->dev.parent; > >> + if (!dev) > >> + return; > >> + > >> + local->wbrf_supported = wbrf_supported_producer(dev); > >> + dev_dbg(dev, "WBRF is %s supported\n", > >> + local->wbrf_supported ? "" : "not"); } > > > > This seems wrong. wbrf_supported_producer() is about "Should this > > device report the frequencies it is using?" The answer to that depends > > on a combination of: Are there consumers registered with the core, and > > is the policy set so WBRF should take actions. > The problem here is, > > you have no idea of the probe order. It could be this device probes > > before others, so wbrf_supported_producer() reports false, but a few > > second later would report true, once other devices have probed. > > > > It should be an inexpensive call into the core, so can be made every > > time the channel changes. All the core needs to do is check if the > > list of consumers is empty, and if not, check a Boolean policy value. > > > > Andrew > > No, it's not a combination of whether consumers are registered with the core. > If a consumer probes later it needs to know the current in use frequencies > too. > > The reason is because of this sequence of events: > 1) Producer probes. > 2) Producer selects a frequency. > 3) Consumer probes. > 4) Producer stays at same frequency. > > If the producer doesn't notify the frequency because a consumer isn't yet > loaded then the consumer won't be able to get the current frequency. Yes, exactly.
Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
On 7/24/2023 04:22, Andrew Lunn wrote: @@ -1395,6 +1395,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) debugfs_hw_add(local); rate_control_add_debugfs(local); + ieee80211_check_wbrf_support(local); + rtnl_lock(); wiphy_lock(hw->wiphy); +void ieee80211_check_wbrf_support(struct ieee80211_local *local) +{ + struct wiphy *wiphy = local->hw.wiphy; + struct device *dev; + + if (!wiphy) + return; + + dev = wiphy->dev.parent; + if (!dev) + return; + + local->wbrf_supported = wbrf_supported_producer(dev); + dev_dbg(dev, "WBRF is %s supported\n", + local->wbrf_supported ? "" : "not"); +} This seems wrong. wbrf_supported_producer() is about "Should this device report the frequencies it is using?" The answer to that depends on a combination of: Are there consumers registered with the core, and is the policy set so WBRF should take actions. > The problem here is, you have no idea of the probe order. It could be this device probes before others, so wbrf_supported_producer() reports false, but a few second later would report true, once other devices have probed. It should be an inexpensive call into the core, so can be made every time the channel changes. All the core needs to do is check if the list of consumers is empty, and if not, check a Boolean policy value. Andrew No, it's not a combination of whether consumers are registered with the core. If a consumer probes later it needs to know the current in use frequencies too. The reason is because of this sequence of events: 1) Producer probes. 2) Producer selects a frequency. 3) Consumer probes. 4) Producer stays at same frequency. If the producer doesn't notify the frequency because a consumer isn't yet loaded then the consumer won't be able to get the current frequency.
Re: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF
> @@ -1395,6 +1395,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) > debugfs_hw_add(local); > rate_control_add_debugfs(local); > > + ieee80211_check_wbrf_support(local); > + > rtnl_lock(); > wiphy_lock(hw->wiphy); > > +void ieee80211_check_wbrf_support(struct ieee80211_local *local) > +{ > + struct wiphy *wiphy = local->hw.wiphy; > + struct device *dev; > + > + if (!wiphy) > + return; > + > + dev = wiphy->dev.parent; > + if (!dev) > + return; > + > + local->wbrf_supported = wbrf_supported_producer(dev); > + dev_dbg(dev, "WBRF is %s supported\n", > + local->wbrf_supported ? "" : "not"); > +} This seems wrong. wbrf_supported_producer() is about "Should this device report the frequencies it is using?" The answer to that depends on a combination of: Are there consumers registered with the core, and is the policy set so WBRF should take actions. The problem here is, you have no idea of the probe order. It could be this device probes before others, so wbrf_supported_producer() reports false, but a few second later would report true, once other devices have probed. It should be an inexpensive call into the core, so can be made every time the channel changes. All the core needs to do is check if the list of consumers is empty, and if not, check a Boolean policy value. Andrew