drm/i915: gen 9 can check for unclaimed registers too
Subsystems (2)
PATCH 1/2 drm/i915: gen 9 can check for unclaimed registers too
Dear git bisect user,
Even though this is the patch that introduced the WARN() you're bisecting, please notice that it's very likely that the problem you're facing was already present before this commit. In other words: this commit adds code to detect errors and give WARN()s about them, but the errors were already there.
In order to continue your debug, please use the i915.mmio_debug option, check the backtraces and try to discover which read or write operation is causing the error message. Then check if this is happening because the register does not exist or because its power well is down when the operation is being done.
On my SKL machine, if I use i915.mmio_debug=999, this patch triggers 42 WARNs just by booting. I didn't investigate them yet. Normal users are only going to get a single WARN due to the default i915.mmio_debug setting.
Thank you for your comprehension,
Paulo
--- drivers/gpu/drm/i915/i915_drv.c | 3 +++ drivers/gpu/drm/i915/intel_uncore.c | 5 +++++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +3 -0
@@ -362,6 +362,7 @@ static const struct intel_device_info intel_skylake_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .has_llc = 1, .has_ddi = 1, + .has_fpga_dbg = 1, .has_fbc =1 ,GEN_DEFAULT_PIPEOFFSETS , IVB_CURSOR_OFFSETS,
@@ -374,6 +375,7 @@ static const struct intel_device_info intel_skylake_gt3_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, .has_llc = 1, .has_ddi = 1, + .has_fpga_dbg = 1, .has_fbc =1 ,GEN_DEFAULT_PIPEOFFSETS , IVB_CURSOR_OFFSETS,
@@ -386,6 +388,7 @@ static const struct intel_device_info intel_broxton_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_pipes = 3, .has_ddi = 1, + .has_fpga_dbg = 1, .has_fbc =1 ,GEN_DEFAULT_PIPEOFFSETS , IVB_CURSOR_OFFSETS,
drivers/gpu/drm/i915/intel_uncore.c +5 -0
@@ -770,6 +770,7 @@ static u##x \ gen9_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \ enum forcewake_domains fw_engine; \ GEN6_READ_HEADER(x); \ + hsw_unclaimed_reg_debug(dev_priv, reg, true, true); \ if (!SKL_NEEDS_FORCE_WAKE((dev_priv), (reg))) \ fw_engine = 0; \ else if (FORCEWAKE_GEN9_RENDER_RANGE_OFFSET(reg)) \
@@ -783,6 +784,7 @@ gen9_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \if (fw_engine) \__force_wake_get (dev_priv, fw_engine); \ val = __raw_i915_read##x(dev_priv, reg); \ + hsw_unclaimed_reg_debug(dev_priv, reg, true, false); \ GEN6_READ_FOOTER; \ }
@@ -983,6 +985,7 @@ gen9_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, \ bool trace) { \enum forcewake_domains fw_engine; \GEN6_WRITE_HEADER ; \ +hsw_unclaimed_reg_debug (dev_priv, reg, false, true); \if (!SKL_NEEDS_FORCE_WAKE ((dev_priv), (reg)) || \is_gen9_shadowed (dev_priv, reg)) \ fw_engine =0 ; \
@@ -997,6 +1000,8 @@ gen9_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, \if (fw_engine) \__force_wake_get (dev_priv, fw_engine); \ __raw_i915_write##x(dev_priv, reg, val); \ + hsw_unclaimed_reg_debug(dev_priv, reg, false, false); \ + hsw_unclaimed_reg_detect(dev_priv); \ GEN6_WRITE_FOOTER; \ }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915: restrict unclaimed register checking
The unclaimed register bit is only triggered when someone touches the specified register range.
For the normal use case (with i915.mmio_debug=0), this commit will avoid the extra __raw_i915_read32() call for every register outside the specified range, at the expense of a few additional "if" statements.
--- drivers/gpu/drm/i915/intel_uncore.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +8 -6
@@ -596,6 +596,8 @@ void assert_forcewakes_inactive(struct drm_i915_private *dev_priv) !FORCEWAKE_GEN9_MEDIA_RANGE_OFFSET(reg) && \ !FORCEWAKE_GEN9_COMMON_RANGE_OFFSET(reg)) +#define UNCLAIMED_CHECK_RANGE (reg) REG_RANGE(reg, 0x40000, 0xC0000) +static void ilk_dummy_write (struct drm_i915_private *dev_priv) {
@@ -612,7 +614,7 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read,const char *op = read ?"reading" :"writing to" ;const char *when = before ?"before" :"after" ; -if (!i915.mmio_debug) +if (!i915.mmio_debug || !UNCLAIMED_CHECK_RANGE (reg))return ;if (__raw_i915_read32 (dev_priv,FPGA_DBG ) &FPGA_DBG_RM_NOCLAIM ) {
@@ -624,11 +626,11 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, }static void -hsw_unclaimed_reg_detect (struct drm_i915_private *dev_priv) +hsw_unclaimed_reg_detect (struct drm_i915_private *dev_priv,u32 reg) {static bool mmio_debug_once = true; -if (i915.mmio_debug || !mmio_debug_once) +if (i915.mmio_debug || !UNCLAIMED_CHECK_RANGE (reg) || !mmio_debug_once)return ;if (__raw_i915_read32 (dev_priv,FPGA_DBG ) &FPGA_DBG_RM_NOCLAIM ) {
@@ -893,7 +895,7 @@ hsw_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace)gen6_gt_check_fifodbg (dev_priv); \ } \hsw_unclaimed_reg_debug (dev_priv, reg, false, false); \ -hsw_unclaimed_reg_detect (dev_priv); \ +hsw_unclaimed_reg_detect (dev_priv, reg); \GEN6_WRITE_FOOTER ; \ }
@@ -935,7 +937,7 @@ gen8_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace__force_wake_get (dev_priv,FORCEWAKE_RENDER ); \ __raw_i915_write##x(dev_priv, reg, val); \ hsw_unclaimed_reg_debug(dev_priv, reg, false, false); \ - hsw_unclaimed_reg_detect(dev_priv); \ + hsw_unclaimed_reg_detect(dev_priv, reg); \ GEN6_WRITE_FOOTER; \ }
@@ -1001,7 +1003,7 @@ gen9_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, \__force_wake_get (dev_priv, fw_engine); \ __raw_i915_write##x(dev_priv, reg, val); \ hsw_unclaimed_reg_debug(dev_priv, reg, false, false); \ - hsw_unclaimed_reg_detect(dev_priv); \ + hsw_unclaimed_reg_detect(dev_priv, reg); \ GEN6_WRITE_FOOTER; \ }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: restrict unclaimed register checking
Quoted 13 lines · Paulo Zanoni
The unclaimed register bit is only triggered when someone touches the specified register range.
For the normal use case (with i915.mmio_debug=0), this commit will avoid the extra
__raw_i915_read32()call for every register outside the specified range, at the expense of a few additional "if" statements.Cc Chris Wilson <[email protected]>Signed-off-by Paulo Zanoni <[email protected]>
drivers/gpu/drm/i915/intel_uncore.c hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, · line 618
Quoted 6 lines
drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -612,7 +614,7 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read,const char *op = read ?"reading" :"writing to" ;const char *when = before ?"before" :"after" ; -if (!i915.mmio_debug) +if (!i915.mmio_debug || !UNCLAIMED_CHECK_RANGE (reg))return ;
Place the register check on the preceding line so that it is not confused with checking the debug-enabled status. (Also you can argue that reg will be register/cache-hot and so a cheaper test to do first than loading a module parameter.)
drivers/gpu/drm/i915/intel_uncore.c hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, · line 634
Quoted 13 lines
drivers/gpu/drm/i915/intel_uncore.c +2
-2if (__raw_i915_read32 (dev_priv,FPGA_DBG ) &FPGA_DBG_RM_NOCLAIM ) {@@ -624,11 +626,11 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, }static void -hsw_unclaimed_reg_detect (struct drm_i915_private *dev_priv) +hsw_unclaimed_reg_detect (struct drm_i915_private *dev_priv,u32 reg) {static bool mmio_debug_once = true; -if (i915.mmio_debug || !mmio_debug_once) +if (i915.mmio_debug || !UNCLAIMED_CHECK_RANGE (reg) || !mmio_debug_once)return ;
The use is wrong here though because you never reviewed my patch to enable the single-shot debugging from the interrupt handler to catch invalid usage from elsewhere.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: restrict unclaimed register checking
Em Qua, 2015-08-26 às 08:44 +0100, Chris Wilson escreveu:
Quoted 19 lines · Paulo Zanoni
Quoted 18 lines
The unclaimed register bit is only triggered when someone touches the
specified register range.For the normal use case (with i915.mmio_debug=0), this commit will avoid the extra
__raw_i915_read32()call for every register outside the specified range, at the expense of a few additional "if" statements.Cc Chris Wilson <[email protected]>Signed-off-by Paulo Zanoni <[email protected]>drivers/gpu/drm/i915/intel_uncore.c +0
-0@@ -612,7 +614,7 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, const char *op = read ? "reading" : "writing to";const char *when = before ?"before" :"after" ;
Quoted 8 lines
drivers/gpu/drm/i915/intel_uncore.c hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, · line 618
Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +1
-1-if (!i915.mmio_debug) +if (!i915.mmio_debug || !UNCLAIMED_CHECK_RANGE (reg))return ;Place the register check on the preceding line so that it is not confused with checking the debug-enabled status. (Also you can argue that reg will be register/cache-hot and so a cheaper test to do first than loading a module parameter.)
That makes sense, I'll do it.
Quoted 14 lines
Quoted 14 lines
(quoted diff) +0
-0if (__raw_i915_read32(dev_priv, FPGA_DBG) &
FPGA_DBG_RM_NOCLAIM) {drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -624,11 +626,11 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, } static void -hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv) +hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv, u32 reg) { static bool mmio_debug_once = true;
Quoted 8 lines
Quoted 4 lines
(quoted diff) +1
-1- if (i915.mmio_debug || !mmio_debug_once) + if (i915.mmio_debug || !UNCLAIMED_CHECK_RANGE(reg) || !mmio_debug_once)return;
The use is wrong here though because you never reviewed my patch to enable the single-shot debugging from the interrupt handler to catch invalid usage from elsewhere.
If you're talking about intel_uncore_check_errors(), I think we can just kill it now. I'll submit a patch with the arguments, so we can continue this topic there.
Moving back to the main subject:
In the last time you sent the patch to do the unclaimed checks only on forcewake code, I started the conversations with the HW guys about the range of registers relevant by FPGA_DBG (and CCd you on these conversations). My plan was to write this patch at that time, but priorities happened and it got postponed :(. I also hoped that maybe you would eventually end up writing it and I would just have to review it :)
My main argument was that by doing unclaimed register checking only at forcewake time we would be running a check that is only relevant to display code during non-display code. So my idea is that if we restrict the unclaimed check to the actual range of registers that can be caught we basically remove unclaimed register checking for most (all?) of the performance-sensitive code.
Since we have multiple solutions, I decided to do some experiments. First of all, since I was not really seeing hsw_unclaimed_reg_detect() on perf, I decided to patch it so it would do the read/write check around FPGA_DBG 50 times per call instead of just one. With this, by running "perf record glxgears" for a few seconds I could see hsw_unclaimed_reg_detect() taking about 4.6% of the total time.
Then I applied just this patch, and the time went down to 0.13%. I also applied your patch on top of it all, and it went up to 0.52% (I guess the extra checks at forcewake time cost a little bit). Also notice that since I add a "reg" argument to hsw_unclaimed_reg_detect(), I changed the forcewake call to use a register in the display range.
I also tested your patch without my patch, and the measured result was about 0.56%.
Now this isn't a super relevant experiment: just glxgears with a modified hsw_unclaimed_reg_detect(), but I thought it would be useful information, and maybe you could provide me suggestions for better workloads.
So I'd like to know if you're ok with proceeding with just this patch (considering I implement your suggestions), or if you think we should go with just your patch or both or none.
Thanks,
Paulo
Quoted 2 lines
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: restrict unclaimed register checking
Quoted 75 lines · Paulo R
Em Qua, 2015-08-26 às 08:44 +0100, Chris Wilson escreveu:
Quoted 19 lines · Paulo Zanoni
Quoted 18 lines
The unclaimed register bit is only triggered when someone touches the
specified register range.For the normal use case (with i915.mmio_debug=0), this commit will avoid the extra
__raw_i915_read32()call for every register outside the specified range, at the expense of a few additional "if" statements.Cc Chris Wilson <[email protected]>Signed-off-by Paulo Zanoni <[email protected]>drivers/gpu/drm/i915/intel_uncore.c +0
-0@@ -612,7 +614,7 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, const char *op = read ? "reading" : "writing to";const char *when = before ?"before" :"after" ;Quoted 8 lines
drivers/gpu/drm/i915/intel_uncore.c hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, · line 618
Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +1
-1-if (!i915.mmio_debug) +if (!i915.mmio_debug || !UNCLAIMED_CHECK_RANGE (reg))return ;Place the register check on the preceding line so that it is not confused with checking the debug-enabled status. (Also you can argue that reg will be register/cache-hot and so a cheaper test to do first than loading a module parameter.)
That makes sense, I'll do it.
Quoted 14 lines
Quoted 14 lines
(quoted diff) +0
-0if (__raw_i915_read32(dev_priv, FPGA_DBG) &
FPGA_DBG_RM_NOCLAIM) {drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -624,11 +626,11 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, } static void -hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv) +hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv, u32 reg) { static bool mmio_debug_once = true;Quoted 8 lines
Quoted 4 lines
(quoted diff) +1
-1- if (i915.mmio_debug || !mmio_debug_once) + if (i915.mmio_debug || !UNCLAIMED_CHECK_RANGE(reg) || !mmio_debug_once)return;
The use is wrong here though because you never reviewed my patch to enable the single-shot debugging from the interrupt handler to catch invalid usage from elsewhere.
If you're talking about
intel_uncore_check_errors(), I think we can just kill it now. I'll submit a patch with the arguments, so we can continue this topic there.Moving back to the main subject:
In the last time you sent the patch to do the unclaimed checks only on forcewake code, I started the conversations with the HW guys about the range of registers relevant by
FPGA_DBG(and CCd you on these conversations). My plan was to write this patch at that time, but priorities happened and it got postponed :(. I also hoped that maybe you would eventually end up writing it and I would just have to review it :)My main argument was that by doing unclaimed register checking only at forcewake time we would be running a check that is only relevant to display code during non-display code. So my idea is that if we restrict the unclaimed check to the actual range of registers that can be caught we basically remove unclaimed register checking for most (all?) of the performance-sensitive code.
Quoted 6 lines
Since we have multiple solutions, I decided to do some experiments. First of all, since I was not really seeing
hsw_unclaimed_reg_detect()on perf, I decided to patch it so it would do the read/write check aroundFPGA_DBG50 times per call instead of just one. With this, by running "perf record glxgears" for a few seconds I could seehsw_unclaimed_reg_detect()taking about 4.6% of the total time.
Something is very suspect with your system if you are not observing much hsw_unclaimed_reg_check during trivial workloads.
Quoted 8 lines
Then I applied just this patch, and the time went down to 0.13%. I also applied your patch on top of it all, and it went up to 0.52% (I guess the extra checks at forcewake time cost a little bit). Also notice that since I add a "reg" argument to
hsw_unclaimed_reg_detect(), I changed the forcewake call to use a register in the display range.
I also tested your patch without my patch, and the measured result was about 0.56%.
Quoted 8 lines
Now this isn't a super relevant experiment: just glxgears with a modified
hsw_unclaimed_reg_detect(), but I thought it would be useful information, and maybe you could provide me suggestions for better workloads.So I'd like to know if you're ok with proceeding with just this patch (considering I implement your suggestions), or if you think we should go with just your patch or both or none.
If you really wanted to, you could combine approaches a check in the forcewake handler as demonstrated is an order of magnitude less frequent than the register accesses. The key point is that we *need* the checking against other users, not just our known register access. Checking our own access basically amounts to detecting invalid registers, which your approach more or less erradicates (since it is a flag we add to known good registers, we may as well just compile it and only turn it on during hw bringup) and that we have the power well awake.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: restrict unclaimed register checking
2015-09-02 17:53 GMT-03:00 [email protected] <[email protected]>:
Quoted 99 lines · Paulo R
Quoted 75 lines
Em Qua, 2015-08-26 às 08:44 +0100, Chris Wilson escreveu:
Quoted 19 lines · Paulo Zanoni
Quoted 18 lines
The unclaimed register bit is only triggered when someone touches the
specified register range.For the normal use case (with i915.mmio_debug=0), this commit will avoid the extra
__raw_i915_read32()call for every register outside the specified range, at the expense of a few additional "if" statements.Cc Chris Wilson <[email protected]>Signed-off-by Paulo Zanoni <[email protected]>drivers/gpu/drm/i915/intel_uncore.c +0
-0@@ -612,7 +614,7 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, const char *op = read ? "reading" : "writing to";const char *when = before ?"before" :"after" ;Quoted 8 lines
drivers/gpu/drm/i915/intel_uncore.c hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, · line 618
Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +1
-1-if (!i915.mmio_debug) +if (!i915.mmio_debug || !UNCLAIMED_CHECK_RANGE (reg))return ;Place the register check on the preceding line so that it is not confused with checking the debug-enabled status. (Also you can argue that reg will be register/cache-hot and so a cheaper test to do first than loading a module parameter.)
That makes sense, I'll do it.
Quoted 14 lines
Quoted 14 lines
(quoted diff) +0
-0if (__raw_i915_read32(dev_priv, FPGA_DBG) &
FPGA_DBG_RM_NOCLAIM) {drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -624,11 +626,11 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, } static void -hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv) +hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv, u32 reg) { static bool mmio_debug_once = true;Quoted 8 lines
Quoted 4 lines
(quoted diff) +1
-1- if (i915.mmio_debug || !mmio_debug_once) + if (i915.mmio_debug || !UNCLAIMED_CHECK_RANGE(reg) || !mmio_debug_once)return;The use is wrong here though because you never reviewed my patch to enable the single-shot debugging from the interrupt handler to catch invalid usage from elsewhere.
If you're talking about
intel_uncore_check_errors(), I think we can just kill it now. I'll submit a patch with the arguments, so we can continue this topic there.Moving back to the main subject:
In the last time you sent the patch to do the unclaimed checks only on forcewake code, I started the conversations with the HW guys about the range of registers relevant by
FPGA_DBG(and CCd you on these conversations). My plan was to write this patch at that time, but priorities happened and it got postponed :(. I also hoped that maybe you would eventually end up writing it and I would just have to review it :)My main argument was that by doing unclaimed register checking only at forcewake time we would be running a check that is only relevant to display code during non-display code. So my idea is that if we restrict the unclaimed check to the actual range of registers that can be caught we basically remove unclaimed register checking for most (all?) of the performance-sensitive code.
Quoted 6 lines
Since we have multiple solutions, I decided to do some experiments. First of all, since I was not really seeing
hsw_unclaimed_reg_detect()on perf, I decided to patch it so it would do the read/write check aroundFPGA_DBG50 times per call instead of just one. With this, by running "perf record glxgears" for a few seconds I could seehsw_unclaimed_reg_detect()taking about 4.6% of the total time.Something is very suspect with your system if you are not observing much
hsw_unclaimed_reg_checkduring trivial workloads.Quoted 13 lines
Then I applied just this patch, and the time went down to 0.13%. I also applied your patch on top of it all, and it went up to 0.52% (I guess the extra checks at forcewake time cost a little bit). Also notice that since I add a "reg" argument to
hsw_unclaimed_reg_detect(), I changed the forcewake call to use a register in the display range.
I also tested your patch without my patch, and the measured result was about 0.56%.Now this isn't a super relevant experiment: just glxgears with a modified
hsw_unclaimed_reg_detect(), but I thought it would be useful information, and maybe you could provide me suggestions for better workloads.
Quoted 8 lines
Quoted 3 lines
So I'd like to know if you're ok with proceeding with just this patch (considering I implement your suggestions), or if you think we should go with just your patch or both or none.
If you really wanted to, you could combine approaches a check in the forcewake handler as demonstrated is an order of magnitude less frequent than the register accesses. The key point is that we *need* the checking against other users, not just our known register access.
I'm not sure I fully understood your point. We are still going to check against errors made outside i915.ko, but we'll be doing these checks only when i915.ko decides to touch the display registers. Why is this not good?
Quoted 13 lines
Checking our own
access basically amounts to detecting invalid registers, which your approach more or less erradicates (since it is a flag we add to known good registers, we may as well just compile it and only turn it on during hw bringup) and that we have the power well awake.
-Chris--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Paulo Zanoni _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: restrict unclaimed register checking
In reply to [email protected]2015-09-02 17:53 GMT-03:00 [email protected] <[email protected]>:
Quoted 83 lines · Paulo R
Quoted 75 lines
Em Qua, 2015-08-26 às 08:44 +0100, Chris Wilson escreveu:
Quoted 19 lines · Paulo Zanoni
Quoted 18 lines
The unclaimed register bit is only triggered when someone touches the
specified register range.For the normal use case (with i915.mmio_debug=0), this commit will avoid the extra
__raw_i915_read32()call for every register outside the specified range, at the expense of a few additional "if" statements.Cc Chris Wilson <[email protected]>Signed-off-by Paulo Zanoni <[email protected]>drivers/gpu/drm/i915/intel_uncore.c +0
-0@@ -612,7 +614,7 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, const char *op = read ? "reading" : "writing to";const char *when = before ?"before" :"after" ;Quoted 8 lines
drivers/gpu/drm/i915/intel_uncore.c hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, · line 618
Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +1
-1-if (!i915.mmio_debug) +if (!i915.mmio_debug || !UNCLAIMED_CHECK_RANGE (reg))return ;Place the register check on the preceding line so that it is not confused with checking the debug-enabled status. (Also you can argue that reg will be register/cache-hot and so a cheaper test to do first than loading a module parameter.)
That makes sense, I'll do it.
Quoted 14 lines
Quoted 14 lines
(quoted diff) +0
-0if (__raw_i915_read32(dev_priv, FPGA_DBG) &
FPGA_DBG_RM_NOCLAIM) {drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -624,11 +626,11 @@ hsw_unclaimed_reg_debug(struct drm_i915_private *dev_priv, u32 reg, bool read, } static void -hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv) +hsw_unclaimed_reg_detect(struct drm_i915_private *dev_priv, u32 reg) { static bool mmio_debug_once = true;Quoted 8 lines
Quoted 4 lines
(quoted diff) +1
-1- if (i915.mmio_debug || !mmio_debug_once) + if (i915.mmio_debug || !UNCLAIMED_CHECK_RANGE(reg) || !mmio_debug_once)return;The use is wrong here though because you never reviewed my patch to enable the single-shot debugging from the interrupt handler to catch invalid usage from elsewhere.
If you're talking about
intel_uncore_check_errors(), I think we can just kill it now. I'll submit a patch with the arguments, so we can continue this topic there.Moving back to the main subject:
In the last time you sent the patch to do the unclaimed checks only on forcewake code, I started the conversations with the HW guys about the range of registers relevant by
FPGA_DBG(and CCd you on these conversations). My plan was to write this patch at that time, but priorities happened and it got postponed :(. I also hoped that maybe you would eventually end up writing it and I would just have to review it :)My main argument was that by doing unclaimed register checking only at forcewake time we would be running a check that is only relevant to display code during non-display code. So my idea is that if we restrict the unclaimed check to the actual range of registers that can be caught we basically remove unclaimed register checking for most (all?) of the performance-sensitive code.
Quoted 6 lines
Since we have multiple solutions, I decided to do some experiments. First of all, since I was not really seeing
hsw_unclaimed_reg_detect()on perf, I decided to patch it so it would do the read/write check aroundFPGA_DBG50 times per call instead of just one. With this, by running "perf record glxgears" for a few seconds I could seehsw_unclaimed_reg_detect()taking about 4.6% of the total time.
Quoted 2 lines
Something is very suspect with your system if you are not observing much
hsw_unclaimed_reg_checkduring trivial workloads.
Ok, I should have said "almost not seeing" instead of "not really seeing": my bad. I see about 0.24% on perf with plain drm-intel-nightly. The problem is that any of the next patches reduces this down to 0.01% or 0.02%, so it's hard to compare the optimized patches. By doing 50 reg reads on detect() I can make the numbers of the optimized patches a little bigger, so easier to compare.
Quoted 34 lines
Quoted 9 lines
Then I applied just this patch, and the time went down to 0.13%. I also applied your patch on top of it all, and it went up to 0.52% (I guess the extra checks at forcewake time cost a little bit). Also notice that since I add a "reg" argument to
hsw_unclaimed_reg_detect(), I changed the forcewake call to use a register in the display range.
I also tested your patch without my patch, and the measured result was about 0.56%.Quoted 8 lines
Now this isn't a super relevant experiment: just glxgears with a modified
hsw_unclaimed_reg_detect(), but I thought it would be useful information, and maybe you could provide me suggestions for better workloads.So I'd like to know if you're ok with proceeding with just this patch (considering I implement your suggestions), or if you think we should go with just your patch or both or none.
If you really wanted to, you could combine approaches a check in the forcewake handler as demonstrated is an order of magnitude less frequent than the register accesses. The key point is that we *need* the checking against other users, not just our known register access. Checking our own access basically amounts to detecting invalid registers, which your approach more or less erradicates (since it is a flag we add to known good registers, we may as well just compile it and only turn it on during hw bringup) and that we have the power well awake.
-Chris--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Paulo Zanoni _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: restrict unclaimed register checking
In reply to Paulo ZanoniTask id: 7256 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
ILK -1 302/302 301/302
SNB 315/315 315/315 IVB 336/336 336/336 BYT 283/283 283/283 HSW 378/378 378/378
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*ILK igt@kms_flip@flip-vs-dpms-interruptible PASS(1) DMESG_WARN(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedQuoted 19 lines · Paulo Zanoni
Dear git bisect user,
Even though this is the patch that introduced the
WARN()you're bisecting, please notice that it's very likely that the problem you're facing was already present before this commit. In other words: this commit adds code to detect errors and give WARN()s about them, but the errors were already there.In order to continue your debug, please use the i915.mmio_debug option, check the backtraces and try to discover which read or write operation is causing the error message. Then check if this is happening because the register does not exist or because its power well is down when the operation is being done.
On my SKL machine, if I use i915.mmio_debug=999, this patch triggers 42 WARNs just by booting. I didn't investigate them yet. Normal users are only going to get a single WARN due to the default i915.mmio_debug setting.
Quoted 4 lines
Thank you for your comprehension,
PauloSigned-off-by Paulo Zanoni <[email protected]>
Queued for -next because I'm just evil that way, thanks for the patch. -Daniel
Quoted 77 lines
--- drivers/gpu/drm/i915/i915_drv.c | 3 +++ drivers/gpu/drm/i915/intel_uncore.c | 5 +++++ 2 files changed, 8 insertions(+)drivers/gpu/drm/i915/i915_drv.c +3
-0@@ -362,6 +362,7 @@ static const struct intel_device_info intel_skylake_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .has_llc = 1, .has_ddi = 1, + .has_fpga_dbg = 1, .has_fbc =1 ,GEN_DEFAULT_PIPEOFFSETS , IVB_CURSOR_OFFSETS,@@ -374,6 +375,7 @@ static const struct intel_device_info intel_skylake_gt3_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, .has_llc = 1, .has_ddi = 1, + .has_fpga_dbg = 1, .has_fbc =1 ,GEN_DEFAULT_PIPEOFFSETS , IVB_CURSOR_OFFSETS,@@ -386,6 +388,7 @@ static const struct intel_device_info intel_broxton_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_pipes = 3, .has_ddi = 1, + .has_fpga_dbg = 1, .has_fbc =1 ,GEN_DEFAULT_PIPEOFFSETS , IVB_CURSOR_OFFSETS,drivers/gpu/drm/i915/intel_uncore.c +5
-0@@ -770,6 +770,7 @@ static u##x \ gen9_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \ enum forcewake_domains fw_engine; \ GEN6_READ_HEADER(x); \ + hsw_unclaimed_reg_debug(dev_priv, reg, true, true); \ if (!SKL_NEEDS_FORCE_WAKE((dev_priv), (reg))) \ fw_engine = 0; \ else if (FORCEWAKE_GEN9_RENDER_RANGE_OFFSET(reg)) \@@ -783,6 +784,7 @@ gen9_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \if (fw_engine) \__force_wake_get (dev_priv, fw_engine); \ val = __raw_i915_read##x(dev_priv, reg); \ + hsw_unclaimed_reg_debug(dev_priv, reg, true, false); \ GEN6_READ_FOOTER; \ }@@ -983,6 +985,7 @@ gen9_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, \ bool trace) { \enum forcewake_domains fw_engine; \GEN6_WRITE_HEADER ; \ +hsw_unclaimed_reg_debug (dev_priv, reg, false, true); \if (!SKL_NEEDS_FORCE_WAKE ((dev_priv), (reg)) || \is_gen9_shadowed (dev_priv, reg)) \ fw_engine =0 ; \@@ -997,6 +1000,8 @@ gen9_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, \if (fw_engine) \__force_wake_get (dev_priv, fw_engine); \ __raw_i915_write##x(dev_priv, reg, val); \ + hsw_unclaimed_reg_debug(dev_priv, reg, false, false); \ + hsw_unclaimed_reg_detect(dev_priv); \ GEN6_WRITE_FOOTER; \ }Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx