mbox series

[0/4] drm/msm: Clear perf counters across context switch

Message ID 20220303194758.710358-1-robdclark@gmail.com
Headers show
Series drm/msm: Clear perf counters across context switch | expand

Message

Rob Clark March 3, 2022, 7:46 p.m. UTC
From: Rob Clark <robdclark@chromium.org>

Some clever folks figured out a way to use performance counters as a
side-channel[1].  But, other than the special case of using the perf
counters for system profiling, we can reset the counters across context
switches to protect against this.

This series introduces a SYSPROF param which a sufficiently privilaged
userspace (like Mesa's pps-producer, which already must run as root) to
opt-out, and makes the default behavior to reset counters on context
switches.

[1] https://dl.acm.org/doi/pdf/10.1145/3503222.3507757

Rob Clark (4):
  drm/msm: Update generated headers
  drm/msm: Add SET_PARAM ioctl
  drm/msm: Add SYSPROF param
  drm/msm/a6xx: Zap counters across context switch

 drivers/gpu/drm/msm/adreno/a2xx.xml.h         |  26 +-
 drivers/gpu/drm/msm/adreno/a2xx_gpu.c         |   1 +
 drivers/gpu/drm/msm/adreno/a3xx.xml.h         |  30 +-
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c         |   1 +
 drivers/gpu/drm/msm/adreno/a4xx.xml.h         | 112 ++-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c         |   1 +
 drivers/gpu/drm/msm/adreno/a5xx.xml.h         |  63 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c         |   1 +
 drivers/gpu/drm/msm/adreno/a6xx.xml.h         | 674 +++++++++++-------
 drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h     |  26 +-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c         |  30 +
 .../gpu/drm/msm/adreno/adreno_common.xml.h    |  31 +-
 drivers/gpu/drm/msm/adreno/adreno_gpu.c       |  14 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.h       |   2 +
 drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h   |  46 +-
 drivers/gpu/drm/msm/disp/mdp4/mdp4.xml.h      |  37 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5.xml.h      |  37 +-
 drivers/gpu/drm/msm/disp/mdp_common.xml.h     |  37 +-
 drivers/gpu/drm/msm/dsi/dsi.xml.h             |  37 +-
 drivers/gpu/drm/msm/dsi/dsi_phy_10nm.xml.h    |  37 +-
 drivers/gpu/drm/msm/dsi/dsi_phy_14nm.xml.h    |  37 +-
 drivers/gpu/drm/msm/dsi/dsi_phy_20nm.xml.h    |  37 +-
 drivers/gpu/drm/msm/dsi/dsi_phy_28nm.xml.h    |  37 +-
 .../gpu/drm/msm/dsi/dsi_phy_28nm_8960.xml.h   |  37 +-
 drivers/gpu/drm/msm/dsi/dsi_phy_5nm.xml.h     | 480 -------------
 drivers/gpu/drm/msm/dsi/dsi_phy_7nm.xml.h     |  43 +-
 drivers/gpu/drm/msm/dsi/mmss_cc.xml.h         |  37 +-
 drivers/gpu/drm/msm/dsi/sfpb.xml.h            |  37 +-
 drivers/gpu/drm/msm/hdmi/hdmi.xml.h           |  37 +-
 drivers/gpu/drm/msm/hdmi/qfprom.xml.h         |  37 +-
 drivers/gpu/drm/msm/msm_drv.c                 |  28 +
 drivers/gpu/drm/msm/msm_gpu.h                 |  29 +
 drivers/gpu/drm/msm/msm_submitqueue.c         |  34 +
 include/uapi/drm/msm_drm.h                    |  28 +-
 34 files changed, 1051 insertions(+), 1130 deletions(-)
 delete mode 100644 drivers/gpu/drm/msm/dsi/dsi_phy_5nm.xml.h

Comments

Rob Clark March 3, 2022, 9:11 p.m. UTC | #1
On Thu, Mar 3, 2022 at 12:42 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>
> Hi Rob
>
> On 3/3/2022 11:46 AM, Rob Clark wrote:
> > From: Rob Clark <robdclark@chromium.org>
> >
> > Update headers from mesa commit:
> >
> >    commit 7e63fa2bb13cf14b765ad06d046789ee1879b5ef
> >    Author:     Rob Clark <robclark@freedesktop.org>
> >    AuthorDate: Wed Mar 2 17:11:10 2022 -0800
> >
> >        freedreno/registers: Add a couple regs we need for kernel
> >
> >        Signed-off-by: Rob Clark <robdclark@chromium.org>
> >        Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15221>
> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > ---
> >   drivers/gpu/drm/msm/adreno/a2xx.xml.h         |  26 +-
> >   drivers/gpu/drm/msm/adreno/a3xx.xml.h         |  30 +-
> >   drivers/gpu/drm/msm/adreno/a4xx.xml.h         | 112 ++-
> >   drivers/gpu/drm/msm/adreno/a5xx.xml.h         |  63 +-
> >   drivers/gpu/drm/msm/adreno/a6xx.xml.h         | 674 +++++++++++-------
> >   drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h     |  26 +-
> >   .../gpu/drm/msm/adreno/adreno_common.xml.h    |  31 +-
> >   drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h   |  46 +-
> >   drivers/gpu/drm/msm/disp/mdp4/mdp4.xml.h      |  37 +-
> >   drivers/gpu/drm/msm/disp/mdp5/mdp5.xml.h      |  37 +-
> >   drivers/gpu/drm/msm/disp/mdp_common.xml.h     |  37 +-
> >   drivers/gpu/drm/msm/dsi/dsi.xml.h             |  37 +-
> >   drivers/gpu/drm/msm/dsi/dsi_phy_10nm.xml.h    |  37 +-
> >   drivers/gpu/drm/msm/dsi/dsi_phy_14nm.xml.h    |  37 +-
> >   drivers/gpu/drm/msm/dsi/dsi_phy_20nm.xml.h    |  37 +-
> >   drivers/gpu/drm/msm/dsi/dsi_phy_28nm.xml.h    |  37 +-
> >   .../gpu/drm/msm/dsi/dsi_phy_28nm_8960.xml.h   |  37 +-
> >   drivers/gpu/drm/msm/dsi/dsi_phy_5nm.xml.h     | 480 -------------
> Why is the 5nm PHY removed? Am i missing something?

Dmitry removed it in mesa, because it was identical to 7nm

BR,
-R

>
> Thanks
>
> Abhinav
Abhinav Kumar March 3, 2022, 9:22 p.m. UTC | #2
On 3/3/2022 1:11 PM, Rob Clark wrote:
> On Thu, Mar 3, 2022 at 12:42 PM Abhinav Kumar <quic_abhinavk@quicinc.com> wrote:
>>
>> Hi Rob
>>
>> On 3/3/2022 11:46 AM, Rob Clark wrote:
>>> From: Rob Clark <robdclark@chromium.org>
>>>
>>> Update headers from mesa commit:
>>>
>>>     commit 7e63fa2bb13cf14b765ad06d046789ee1879b5ef
>>>     Author:     Rob Clark <robclark@freedesktop.org>
>>>     AuthorDate: Wed Mar 2 17:11:10 2022 -0800
>>>
>>>         freedreno/registers: Add a couple regs we need for kernel
>>>
>>>         Signed-off-by: Rob Clark <robdclark@chromium.org>
>>>         Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15221>
>>>
>>> Signed-off-by: Rob Clark <robdclark@chromium.org>
>>> ---
>>>    drivers/gpu/drm/msm/adreno/a2xx.xml.h         |  26 +-
>>>    drivers/gpu/drm/msm/adreno/a3xx.xml.h         |  30 +-
>>>    drivers/gpu/drm/msm/adreno/a4xx.xml.h         | 112 ++-
>>>    drivers/gpu/drm/msm/adreno/a5xx.xml.h         |  63 +-
>>>    drivers/gpu/drm/msm/adreno/a6xx.xml.h         | 674 +++++++++++-------
>>>    drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h     |  26 +-
>>>    .../gpu/drm/msm/adreno/adreno_common.xml.h    |  31 +-
>>>    drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h   |  46 +-
>>>    drivers/gpu/drm/msm/disp/mdp4/mdp4.xml.h      |  37 +-
>>>    drivers/gpu/drm/msm/disp/mdp5/mdp5.xml.h      |  37 +-
>>>    drivers/gpu/drm/msm/disp/mdp_common.xml.h     |  37 +-
>>>    drivers/gpu/drm/msm/dsi/dsi.xml.h             |  37 +-
>>>    drivers/gpu/drm/msm/dsi/dsi_phy_10nm.xml.h    |  37 +-
>>>    drivers/gpu/drm/msm/dsi/dsi_phy_14nm.xml.h    |  37 +-
>>>    drivers/gpu/drm/msm/dsi/dsi_phy_20nm.xml.h    |  37 +-
>>>    drivers/gpu/drm/msm/dsi/dsi_phy_28nm.xml.h    |  37 +-
>>>    .../gpu/drm/msm/dsi/dsi_phy_28nm_8960.xml.h   |  37 +-
>>>    drivers/gpu/drm/msm/dsi/dsi_phy_5nm.xml.h     | 480 -------------
>> Why is the 5nm PHY removed? Am i missing something?
> 
> Dmitry removed it in mesa, because it was identical to 7nm
> 
> BR,
> -R
Alright got it, for the display bits,
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> 
>>
>> Thanks
>>
>> Abhinav