Message ID | 20190423132823.7915-1-georgi.djakov@linaro.org (mailing list archive) |
---|---|
Headers | show |
Series | Introduce OPP bandwidth bindings | expand |
I'll have to Nack this series because it's making a couple of wrong assumptions about bandwidth voting. Firstly, it's mixing up OPP to bandwidth mapping (Eg: CPU freq to CPU<->DDR bandwidth mapping) with the bandwidth levels that are actually supported by an interconnect path (Eg: CPU<->DDR bandwidth levels). For example, CPU0 might decide to vote for a max of 10 GB/s because it's a little CPU and never needs anything higher than 10 GB/s even at CPU0's max frequency. But that has no bearing on bandwidth level available between CPU<->DDR. There needs to be a separate BW OPP table describing the bandwith levels available for the CPU<->DDR path and then a separate mapping between CPU OPP to CPU<->DDR BW OPP. That way, the mapping decision (policy or voltage based config decision) doesn't affect the description of what the hardware really is capable of. Put another way, if someone comes around and decides the CPU0's max freq should ask for 15 GB/s because some shared voltage rail would already be pushed to a voltage sufficient to support 15 GB/s, then it shouldn't change the HW description of what bandwidth levels are available between CPU<->DDR. If the CPU<->DDR path supports 20 GB/s, it always does independent of the CPU OPP table mapping. By splitting out the available bandwidth levels of the CPU<->DDR path into a separate BW OPP table, we avoid these kinds of issues. Also, one could easily imagine using a bandwidth counter or some other means of BW measurement hardware to vote for bandwidth between CPU<->DDR and CPU<->L3. That entity should be able to know/learn all the available bandwidth levels in the CPU<->DDR path without forcing bandwidth levels to be listed in CPU OPP table. And if it's measuring bandwidth at a point common for all CPUs, what CPU OPP table is it even supposed to look at to learn all the available bandwidth levels. It just doesn't make sense. It's also easy to envision having multiple policies or devfreq governors voting for an interconnect path. The mapping you are talking about in this series is just an input for one of them (the cpufreq-map governor I sent out a while ago). Secondly, when it comes to bandwidth OPP tables, the peak bandwidth should be the key/first element (similar to how frequency is now). Long explanation follows. All the sensible frequency combinations of all the hardware interconnects between the master and slave port (Eg: GPU -> MMNOC -> BIMC -> DDR) determine the peak bandwidth levels available in that interconnect path. If multiple devices (GPU, CPU, etc) vote for different peak bandwidths for an interconnect (say BIMC), the interconnect provider picks the max peak bandwidth amongst all the requests and then picks the lowest interconnect frequency that can support the max peak bandwidth. So the devices (GPU, CPU, etc), actually have some control on what interconnect frequencies are picked by asking for a specific peak bandwidth -- so there's actually a notion of useful levels. Average bandwidth is an additive property -- so if CPU and GPU ask for 5 GB/s and 3 GB/s respectively for an interconnect, the interconnect provider adds them up and configures the interconnect for 8 GB/s. So if GPU asks for 5 GB/s average bandwidth, it has no idea what frequency the interconnect will actually get configured to. So, average bandwidth really doesn't provide a sense of levels to pick from for a given interconnect path. So peak bandwidth is a much better pick than average bandwidth for being a key to the bandwidth OPP table. So what I think we need is: * Bandwidth OPP support in the kernel * Bandwidth OPP DT binding to describe the bandwidth levels available for different interconnect paths. * A new "interconnect-opp" property that can point to different BW OPP tables for each of the interconnect paths listed under interconnects property. Then for mapping from device OPP to interconnect path bandwidth OPPs, you just used the existing required-opps binding to link an entry in GPU OPP to an entry in GPU<->DDR bandwidth OPP table. That way the hardware is actually described correctly and the mapping is kept separate. So, in the end, it'll look something like this in DT. gpu_cache_opp_table: gpu_cache_opp_table { compatible = "operating-points-v2"; gpu_cache_3000: opp-3000 { opp-peak-mbps = <3000>; avg-mbps = <1000>; }; gpu_cache_6000: opp-6000 { opp-peak-mbps = <6000>; avg-mbps = <2000>; }; gpu_cache_9000: opp-9000 { opp-peak-mbps = <9000>; avg-mbps = <9000>; }; }; gpu_ddr_opp_table: gpu_ddr_opp_table { compatible = "operating-points-v2"; gpu_ddr_1525: opp-1525 { opp-peak-mbps = <1525>; avg-mbps = <452>; }; gpu_ddr_3051: opp-3051 { opp-peak-mbps = <3051>; avg-mbps = <915>; }; gpu_ddr_7500: opp-7500 { opp-peak-mbps = <7500>; avg-mbps = <3000>; }; }; gpu_opp_table: gpu_opp_table { compatible = "operating-points-v2"; opp-shared; opp-200000000 { opp-hz = /bits/ 64 <200000000>; required-opps = <&gpu_cache_3000>, <&gpu_ddr_1525>; }; opp-400000000 { opp-hz = /bits/ 64 <400000000>; required-opps = <&gpu_cache_6000>, <&gpu_ddr_3051>; }; }; gpu@7864000 { ... operating-points-v2 = <&gpu_opp_table>; interconnects = <&mmnoc MASTER_GPU_1 &bimc SLAVE_SYSTEL_CACHE>, <&mmnoc MASTER_GPU_1 &bimc SLAVE_DDR>; interconnect-names = "gpu-cache", "gpu-mem"; interconnect-opps = <&gpu_cache_bw_opp>, <&gpu_ddr_bw_opp> }; It's very clear what the HW supports vs what the mapping chooses to use. It's also very clearer what the mapping is doing because it actually points to entries in appropriately names OPP tables. There's no confusion on what mapping corresponds to what interconnect paths -- which is why this doesn't need a comment to clarify the intent here whereas in this patch series, the mappings needed comments on which interconnect they are referring to. Sorry about the long email and jumping in out of nowhere. The need for something like this has been in my mind for a long time and my situation has also changed where I can be more active upstream compared to before. Thanks and have a nice weekend. -Saravana --
On Fri, May 31, 2019 at 07:12:28PM -0700, Saravana Kannan wrote: > I'll have to Nack this series because it's making a couple of wrong assumptions > about bandwidth voting. > > Firstly, it's mixing up OPP to bandwidth mapping (Eg: CPU freq to CPU<->DDR > bandwidth mapping) with the bandwidth levels that are actually supported by an > interconnect path (Eg: CPU<->DDR bandwidth levels). For example, CPU0 might > decide to vote for a max of 10 GB/s because it's a little CPU and never needs > anything higher than 10 GB/s even at CPU0's max frequency. But that has no > bearing on bandwidth level available between CPU<->DDR. I'm going to just quote this part of the email to avoid forcing people to scroll too much. I agree that there is an enormous universe of new and innovative things that can be done for bandwidth voting. I would love to have smart governors and expansive connections between different components that are all aware of each other. I don't think that anybody is discounting that these things are possible. But as it stands today, as a leaf driver developer my primary concern is that I need to vote something for the GPU->DDR path. Right now I'm voting the maximum because that is the bare minimum we need to get working GPU. Then the next incremental baby step is to allow us to select a minimum vote based on a GPU frequency level to allow for some sort of very coarse power savings. It isn't perfect, but better than cranking everything to 11. This is why we need the OPP bandwidth bindings to allow us to make the association and tune down the vote. I fully agree that this isn't the optimal solution but it is the only knob we have right now. And after that we should go nuts. I'll gladly put the OPP bindings in the rear-view mirror and turn over all bandwidth to a governor or two or three. I'll be happy to have nothing to do with it again. But until then we need a solution for the leaf drivers that lets us provide some modicum of power control. Jordan
On Mon, Jun 3, 2019 at 8:56 AM Jordan Crouse <jcrouse@codeaurora.org> wrote: > > On Fri, May 31, 2019 at 07:12:28PM -0700, Saravana Kannan wrote: > > I'll have to Nack this series because it's making a couple of wrong assumptions > > about bandwidth voting. > > > > Firstly, it's mixing up OPP to bandwidth mapping (Eg: CPU freq to CPU<->DDR > > bandwidth mapping) with the bandwidth levels that are actually supported by an > > interconnect path (Eg: CPU<->DDR bandwidth levels). For example, CPU0 might > > decide to vote for a max of 10 GB/s because it's a little CPU and never needs > > anything higher than 10 GB/s even at CPU0's max frequency. But that has no > > bearing on bandwidth level available between CPU<->DDR. > > I'm going to just quote this part of the email to avoid forcing people to > scroll too much. > > I agree that there is an enormous universe of new and innovative things that can > be done for bandwidth voting. I would love to have smart governors and expansive > connections between different components that are all aware of each other. I > don't think that anybody is discounting that these things are possible. > > But as it stands today, as a leaf driver developer my primary concern is that I > need to vote something for the GPU->DDR path. Right now I'm voting the maximum > because that is the bare minimum we need to get working GPU. > > Then the next incremental baby step is to allow us to select a minimum > vote based on a GPU frequency level to allow for some sort of very coarse power > savings. It isn't perfect, but better than cranking everything to 11. I completely agree. I'm not saying you shouldn't do bandwidth voting based on device frequency. In some cases, it's actually the right thing to do too. > This is > why we need the OPP bandwidth bindings to allow us to make the association and > tune down the vote. Again, I'm perfectly fine with this too. > I fully agree that this isn't the optimal solution but > it is the only knob we have right now. > And after that we should go nuts. I'll gladly put the OPP bindings in the > rear-view mirror and turn over all bandwidth to a governor or two or three. This is the problem part in the series. Once a property is exposed in DT, we can't just take it back. A new kernel needs to continue supporting old compiled DT binaries. So if we know we'll have to change a DT property in the future to be "more correct", then we should just do that one instead of "for now" bindings. And I even proposed what the new bindings should look like and why we should do it that way. I'll try to get some patches out for that in the near future. But doesn't have to be just from me. I'm just pointing out why the current bindings aren't good/scalable. > I'll be happy to have nothing to do with it again. But until then we need > a solution for the leaf drivers that lets us provide some modicum of power > control. Agreed. -Saravana