Skip to contentSkip to conversation

drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

PATCH Superseded [email protected] 3 participants 10 messages Nov 29, 2013 – Dec 4, 2013 3 messages not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

From: Deepak S <[email protected]>

On VLV, FIFO will be shared by both SW and HW. So, we read the free entries through register and update dev_priv variable and wait for only 20 entries to be free

v2: Apply mask when we read the number of free FIFO entries (Ville).

---
 drivers/gpu/drm/i915/intel_uncore.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/intel_uncore.c +7 -0
index 0db5472..adf2b64 100644
@@ -150,6 +150,13 @@ static int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
 {
 	int ret = 0;
 
+	/* On VLV, FIFO will be shared by both SW and HW.
+	 * So, we need to read the FREE_ENTRIES everytime */
+	if (IS_VALLEYVIEW(dev_priv->dev))
+		dev_priv->uncore.fifo_count =
+			__raw_i915_read32(dev_priv, GTFIFOCTL &
+						GT_FIFO_FREE_ENTRIES_MASK);
+
 	if (dev_priv->uncore.fifo_count < GT_FIFO_NUM_RESERVED_ENTRIES) {
 		int loop = 500;
 		u32 fifo = __raw_i915_read32(dev_priv, GTFIFOCTL) & GT_FIFO_FREE_ENTRIES_MASK;
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 5 lines · On Fri, Nov 29, 2013 at 03:44:31PM +0530, [email protected] wrote:

From: Deepak S <[email protected]>

On VLV, FIFO will be shared by both SW and HW. So, we read the free entries through register and update dev_priv variable and wait for only 20 entries to be free

But the whole point of leaving 20 entries is for hardware has a portion of the fifo it can use for its own nefarious deeds. The hw has been emitting mmio through the write fifo since its inception on gen6, so what is so different for vlv?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
author
#2 lore raw

Hi Chris,

In VLV, both hardware and software can use the write fifo in parallel, we are adding this change as a water mark to make sure we atleast have 20 free entries .This will help us to avoid software mmio write being dropped.

Thanks
Deepak

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 29, 2013 4:09 PM
To: S, Deepak
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 5 lines · On Fri, Nov 29, 2013 at 03:44:31PM +0530, [email protected] wrote:

From: Deepak S <[email protected]>

On VLV, FIFO will be shared by both SW and HW. So, we read the free entries through register and update dev_priv variable and wait for only 20 entries to be free

But the whole point of leaving 20 entries is for hardware has a portion of the fifo it can use for its own nefarious deeds. The hw has been emitting mmio through the write fifo since its inception on gen6, so what is so different for vlv? -Chris

--
Chris Wilson, Intel Open Source Technology Centre

#3 lore raw
Quoted 3 lines · Deepak

Hi Chris,

In VLV, both hardware and software can use the write fifo in parallel, we are adding this change as a water mark to make sure we atleast have 20 free entries .This will help us to avoid software mmio write being dropped.

Please think some more and describe the change exactly. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
author
#4 lore raw

Sure Chris, I will recheck the spec and change the commit accordingly.

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 29, 2013 5:07 PM
To: S, Deepak
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 3 lines · Deepak

Hi Chris,

In VLV, both hardware and software can use the write fifo in parallel, we are adding this change as a water mark to make sure we atleast have 20 free entries .This will help us to avoid software mmio write being dropped.

Please think some more and describe the change exactly. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#5 lore raw
Quoted 1 line · Deepak

Sure Chris, I will recheck the spec and change the commit accordingly.

I guess the big question is why vlv is special. We've had these 20 fifo entries ever since gen6, so I'd also really like to know what suddenly changed. Even the 20 entries have just been copied from a spec with no explation. So if this is to allow hw writes to the gt from the display, then I guess we would need this change on all gen6+ platforms?

Hence digging through specs or dragging a hw engineer into this discussion would be highly appreciated.

Thanks, Daniel

Quoted 22 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 29, 2013 5:07 PM
To: S, Deepak
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 3 lines · Deepak

Hi Chris,

In VLV, both hardware and software can use the write fifo in parallel, we are adding this change as a water mark to make sure we atleast have 20 free entries .This will help us to avoid software mmio write being dropped.

Please think some more and describe the change exactly. -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
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

A message that is not in the archive (sent off-list or not yet received): F359EE24E0B97E4A9739736D2C188EF3FB329A@BGSMSX102.gar.corp.intel.com

#7 lore raw

[re-adding intel-gfx]

Quoted 9 lines · Deepak

Hi Daniel/Chris,

I spent some time in digging through the specs and also has chatted with couple of people. Below is my understanding of the FIFO.

"On SB, Out of 64 FIFO Entries, 20 Entries will be used by HW and remaining 44 will be used by the SW,. I think due to this reason, we have a threshold of 20 Entries."

"On VLV, HW and SW can access all 64 fifo entries, I don't think having a threshold of 20 Entries is mandatory on VLV. Also, since both SW and HW can access all 64 Entries. I think on VLV, we need to update the fifo_count before waiting for the FIFO."

Please correct me if I am working.

Looks sane. I've added this to the commit message and merged your patch.

Thanks,

Daniel

Quoted 48 lines

Thanks
Deepak

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Friday, November 29, 2013 7:33 PM
To: S, Deepak
Cc: Chris Wilson; [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 1 line · Deepak

Sure Chris, I will recheck the spec and change the commit accordingly.

I guess the big question is why vlv is special. We've had these 20 fifo entries ever since gen6, so I'd also really like to know what suddenly changed. Even the 20 entries have just been copied from a spec with no explation. So if this is to allow hw writes to the gt from the display, then I guess we would need this change on all gen6+ platforms?

Hence digging through specs or dragging a hw engineer into this discussion would be highly appreciated.

Thanks, Daniel

Quoted 17 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 29, 2013 5:07 PM
To: S, Deepak
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 3 lines · Deepak

Hi Chris,

In VLV, both hardware and software can use the write fifo in parallel, we are adding this change as a water mark to make sure we atleast have 20 free entries .This will help us to avoid software mmio write being dropped.

Please think some more and describe the change exactly. -Chris

Quoted 6 lines

--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
author
#8 lore raw

Thanks Daniel.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Wednesday, December 4, 2013 2:10 PM
To: S, Deepak
Cc: Chris Wilson; intel-gfx
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

[re-adding intel-gfx]

Quoted 9 lines · Deepak

Hi Daniel/Chris,

I spent some time in digging through the specs and also has chatted with couple of people. Below is my understanding of the FIFO.

"On SB, Out of 64 FIFO Entries, 20 Entries will be used by HW and remaining 44 will be used by the SW,. I think due to this reason, we have a threshold of 20 Entries."

"On VLV, HW and SW can access all 64 fifo entries, I don't think having a threshold of 20 Entries is mandatory on VLV. Also, since both SW and HW can access all 64 Entries. I think on VLV, we need to update the fifo_count before waiting for the FIFO."

Please correct me if I am working.

Looks sane. I've added this to the commit message and merged your patch.

Thanks,

Daniel

Quoted 46 lines

Thanks
Deepak

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Friday, November 29, 2013 7:33 PM
To: S, Deepak
Cc: Chris Wilson; [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 1 line · Deepak

Sure Chris, I will recheck the spec and change the commit accordingly.

I guess the big question is why vlv is special. We've had these 20 fifo entries ever since gen6, so I'd also really like to know what suddenly changed. Even the 20 entries have just been copied from a spec with no explation. So if this is to allow hw writes to the gt from the display, then I guess we would need this change on all gen6+ platforms?

Hence digging through specs or dragging a hw engineer into this discussion would be highly appreciated.

Thanks, Daniel

Quoted 17 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, November 29, 2013 5:07 PM
To: S, Deepak
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 3 lines · Deepak

Hi Chris,

In VLV, both hardware and software can use the write fifo in parallel, we are adding this change as a water mark to make sure we atleast have 20 free entries .This will help us to avoid software mmio write being dropped.

Please think some more and describe the change exactly. -Chris

Quoted 6 lines

--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Quoted 4 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): F359EE24E0B97E4A9739736D2C188EF3FB3616@BGSMSX102.gar.corp.intel.com

#11 lore raw

[Dragging the discussion back to the public.]

I agree that the 20 fifo limit is fairly arbitrary and it's still racy. Otoh that seems to be a bit that the hw engineers simply fumbled, so I guess we don't have much choice here.

I've only merged the patch to dinq since there's no real report of this fixing anything and we have a bit of time to figure out something better. If there is such a thing even.

Deepak, can you please poke hw engineers a bit how they've thought the driver should run this exactly?

Thanks, Daniel

Quoted 28 lines · Deepak

Agreed. But if we don't have a threshold, we might hit a high probability of dropping writes if HW or SW uses all 64 entries right?.

Can we create a wq and check for the fifo entries at a periodic interval, this will reduce the fifo checking before every mmio write.

Thank
Deepak S

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Wednesday, December 4, 2013 3:04 PM
To: S, Deepak
Cc: Daniel Vetter
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 7 lines · Deepak

Hi Daniel/Chris,

I spent some time in digging through the specs and also has chatted with couple of people. Below is my understanding of the FIFO.

"On SB, Out of 64 FIFO Entries, 20 Entries will be used by HW and remaining 44 will be used by the SW,. I think due to this reason, we have a threshold of 20 Entries."

"On VLV, HW and SW can access all 64 fifo entries, I don't think having a threshold of 20 Entries is mandatory on VLV. Also, since both SW and HW can access all 64 Entries. I think on VLV, we need to update the fifo_count before waiting for the FIFO."

But there is also no point in waiting for at least 20 entries either. So the current code does not make sense for VLV in that light. Also note that the code is currently like it is as the mmio read before every write adds significant CPU overhead. There is also the problem that if the hw can consume the entire FIFO, it can also do so between us checking for a free entry and use performing the mmio. It seems to be broken by design... -Chris

--
Chris Wilson, Intel Open Source Technology Centre

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
author
#12 lore raw

Hi Daniel,

Sure, I don't have any contact with the hw engineer yet, I will try to get the right contact asap.

Thanks
Deepak

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Wednesday, December 4, 2013 4:37 PM
To: S, Deepak
Cc: Chris Wilson; intel-gfx
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

[Dragging the discussion back to the public.]

I agree that the 20 fifo limit is fairly arbitrary and it's still racy. Otoh that seems to be a bit that the hw engineers simply fumbled, so I guess we don't have much choice here.

I've only merged the patch to dinq since there's no real report of this fixing anything and we have a bit of time to figure out something better. If there is such a thing even.

Deepak, can you please poke hw engineers a bit how they've thought the driver should run this exactly?

Thanks, Daniel

Quoted 22 lines · Deepak

Agreed. But if we don't have a threshold, we might hit a high probability of dropping writes if HW or SW uses all 64 entries right?.

Can we create a wq and check for the fifo entries at a periodic interval, this will reduce the fifo checking before every mmio write.

Thank
Deepak S

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Wednesday, December 4, 2013 3:04 PM
To: S, Deepak
Cc: Daniel Vetter
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v2

Quoted 6 lines · Deepak

Hi Daniel/Chris,

I spent some time in digging through the specs and also has chatted with couple of people. Below is my understanding of the FIFO.

"On SB, Out of 64 FIFO Entries, 20 Entries will be used by HW and remaining 44 will be used by the SW,. I think due to this reason, we have a threshold of 20 Entries."

Quoted 7 lines
Quoted 1 line

"On VLV, HW and SW can access all 64 fifo entries, I don't think having a threshold of 20 Entries is mandatory on VLV. Also, since both SW and HW can access all 64 Entries. I think on VLV, we need to update the fifo_count before waiting for the FIFO."

But there is also no point in waiting for at least 20 entries either. So the current code does not make sense for VLV in that light. Also note that the code is currently like it is as the mmio read before every write adds significant CPU overhead. There is also the problem that if the hw can consume the entire FIFO, it can also do so between us checking for a free entry and use performing the mmio. It seems to be broken by design... -Chris

--
Chris Wilson, Intel Open Source Technology Centre

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch