Skip to contentSkip to conversation

drm/fb: Proper support of boundary conditions in bitmasks.

PATCH In review Tomasz Lis 6 participants 12 messages Feb 17, 2017 – Feb 24, 2017

Subsystems (4)
lore
Share & tools
lore

Tomasz Lis

author
#0 lore raw

PATCH 1/1 drm/fb: Proper support of boundary conditions in bitmasks.

The recently introduced patch changed behavior of masks when the bit number is negative. Instead of no bits set, the new way makes all bits set. Problematic patch:
drm/i915: Avoid BIT(max) - 1 and use GENMASK(max - 1, 0)

This behaviour was not considered when making changes, and boundary value of count (=0) is now resulting in a mask with all bits on, since the value is directly decreased and therefore negative. Checking if all bits are set leads to infinite loop.

This patch introduces an additional check to avoid empty masks. It reverts the control flow to the exact same way it worked before the problematic patch.

---
 drivers/gpu/drm/i915/intel_fbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
index e6f3eb2d..bc65ecf 100644
@@ -496,7 +496,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		conn_configured |= BIT(i);
 	}
 
-	if ((conn_configured & mask) != mask) {
+	if (count > 0 && (conn_configured & mask) != mask) {
 		pass++;
 		goto retry;
 	}
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#1 lore raw

RFC 1/1 drm/fb: Avoid infinite loop when no response from connector.

This fixes an old patch so it doesn't cause infinite retries:
drm/fb: add support for tiled monitor configurations.

The max count of iterations, 0xa10070f, was carefully selected based on the fact that it looks cool.

---
 drivers/gpu/drm/drm_fb_helper.c    | 4 +++-
 drivers/gpu/drm/i915/intel_fbdev.c | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +3 -1
index 0dd5da8..8e6c535 100644
@@ -2011,7 +2011,9 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper,
 
 	if ((conn_configured & mask) != mask) {
 		tile_pass++;
-		goto retry;
+		if (tile_pass < 0xa10070f)
+			goto retry;
+		DRM_ERROR("Max connector check retry count exceeded\n");
 	}
 	return true;
 }
drivers/gpu/drm/i915/intel_fbdev.c +4 -1
index bc65ecf..2fd0f09 100644
@@ -498,7 +498,10 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 
 	if (count > 0 && (conn_configured & mask) != mask) {
 		pass++;
-		goto retry;
+		if (pass < 0xa10070f)
+			goto retry;
+		DRM_ERROR("Max connector check retry count exceeded\n");
+		goto bail;
 	}
 
 	/*
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [RFC] drm/fb: Avoid infinite loop when no response from connector.

drivers/gpu/drm/drm_fb_helper.c

Quoted 11 lines · Tomasz Lis

This fixes an old patch so it doesn't cause infinite retries:
drm/fb: add support for tiled monitor configurations.

The max count of iterations, 0xa10070f, was carefully selected based on the fact that it looks cool.

---
 drivers/gpu/drm/drm_fb_helper.c    | 4 +++-
 drivers/gpu/drm/i915/intel_fbdev.c | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0

Change to that file should go through dri-devel.

drivers/gpu/drm/drm_fb_helper.c static bool drm_target_preferred(struct drm_fb_helper *fb_helper, · line 2014

Quoted 9 lines

index 0dd5da8..8e6c535 100644

drivers/gpu/drm/drm_fb_helper.c +1 -1
@@ -2011,7 +2011,9 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper,
 
 	if ((conn_configured & mask) != mask) {
 		tile_pass++;
-		goto retry;
+		if (tile_pass < 0xa10070f)

Can we have this named? Also it could be more sensible to go with something representing order of how many retries we want rather than going full wizard on it?

Quoted 5 lines
drivers/gpu/drm/drm_fb_helper.c +2 -0
+			goto retry;
+		DRM_ERROR("Max connector check retry count exceeded\n");
 	}
 	return true;
 }
Signature · 6 lines
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [RFC] drm/fb: Avoid infinite loop when no response from connector.

Quoted 20 lines · Arkadiusz Hiler

drivers/gpu/drm/drm_fb_helper.c

Quoted 11 lines · Tomasz Lis

This fixes an old patch so it doesn't cause infinite retries:
drm/fb: add support for tiled monitor configurations.

The max count of iterations, 0xa10070f, was carefully selected based on the fact that it looks cool.

---
 drivers/gpu/drm/drm_fb_helper.c    | 4 +++-
 drivers/gpu/drm/i915/intel_fbdev.c | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +0 -0

Change to that file should go through dri-devel.

Quoted 5 lines

index 0dd5da8..8e6c535 100644

drivers/gpu/drm/drm_fb_helper.c +0 -0
@@ -2011,7 +2011,9 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper,
 
Quoted 8 lines

drivers/gpu/drm/drm_fb_helper.c static bool drm_target_preferred(struct drm_fb_helper *fb_helper, · line 2014

Quoted 4 lines
drivers/gpu/drm/drm_fb_helper.c +1 -1
 	if ((conn_configured & mask) != mask) {
 		tile_pass++;
-		goto retry;
+		if (tile_pass < 0xa10070f)

Can we have this named? Also it could be more sensible to go with something representing order of how many retries we want rather than going full wizard on it?

A more suitable approach might be:

drivers/gpu/drm/i915/intel_fbdev.c +3 -4
index 041322fef607..32d0af6b07a7 100644
@@ -348,7 +348,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
                                    bool *enabled, int width, int height)
 {
        struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
-       unsigned long conn_configured, mask;
+       unsigned long conn_configured, conn_seq, mask;
        unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
        int i, j;
        bool *save_enabled;
@@ -365,6 +365,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
        mask = GENMASK(count - 1, 0);
        conn_configured = 0;
 retry:
+       conn_seq = conn_configured;
        for (i = 0; i < count; i++) {
                struct drm_fb_helper_connector *fb_conn;
                struct drm_connector *connector;
@@ -489,10 +490,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
                conn_configured |= BIT(i);
        }
 
-       if ((conn_configured & mask) != mask) {
-               pass++;
+       if ((conn_configured & mask) != mask && conn_configured != conn_seq)
                goto retry;
-       }
 
        /*
         * If the BIOS didn't enable everything it could, fall back to have the
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 1/1 drm/i915/fbdev: Stop repeating tile configuration on stagnation

In reply to Tomasz Lis

If we cease making progress in finding matching outputs for a tiled configuration, stop looping over the remaining unconfigured outputs.

Fixes b0ee9e7fa5b4 ("drm/fb: add support for tiled monitor configurations. (v2)")
Cc Tomasz Lis <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc <[email protected]> # v3.19+
---
 drivers/gpu/drm/i915/intel_fbdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_fbdev.c +3 -4
index 041322fef607..32d0af6b07a7 100644
@@ -348,7 +348,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 				    bool *enabled, int width, int height)
 {
 	struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
-	unsigned long conn_configured, mask;
+	unsigned long conn_configured, conn_seq, mask;
 	unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
 	int i, j;
 	bool *save_enabled;
@@ -365,6 +365,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 	mask = GENMASK(count - 1, 0);
 	conn_configured = 0;
 retry:
+	conn_seq = conn_configured;
 	for (i = 0; i < count; i++) {
 		struct drm_fb_helper_connector *fb_conn;
 		struct drm_connector *connector;
@@ -489,10 +490,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		conn_configured |= BIT(i);
 	}
 
-	if ((conn_configured & mask) != mask) {
-		pass++;
+	if ((conn_configured & mask) != mask && conn_configured != conn_seq)
 		goto retry;
-	}
 
 	/*
 	 * If the BIOS didn't enable everything it could, fall back to have the
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#5 lore raw

Re: [PATCH] drm/i915/fbdev: Stop repeating tile configuration on stagnation

I tested this variant (reverted the change to "pass" variable before testing), and it fixes the issue with count=0 as well as possible infinite loop issue.

But something needs to be done with the "pass" var, one way or the other - commented below.

W dniu 2017-02-18 o 16:37, Chris Wilson pisze:

Quoted 36 lines

If we cease making progress in finding matching outputs for a tiled configuration, stop looping over the remaining unconfigured outputs.

Fixes b0ee9e7fa5b4 ("drm/fb: add support for tiled monitor configurations. (v2)")
Cc Tomasz Lis <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc <[email protected]> # v3.19+
---
  drivers/gpu/drm/i915/intel_fbdev.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_fbdev.c +2 -1
index 041322fef607..32d0af6b07a7 100644
@@ -348,7 +348,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
  				    bool *enabled, int width, int height)
  {
  	struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
-	unsigned long conn_configured, mask;
+	unsigned long conn_configured, conn_seq, mask;
  	unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
  	int i, j;
  	bool *save_enabled;
@@ -365,6 +365,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
  	mask = GENMASK(count - 1, 0);
  	conn_configured = 0;
  retry:
+	conn_seq = conn_configured;
  	for (i = 0; i < count; i++) {
  		struct drm_fb_helper_connector *fb_conn;
  		struct drm_connector *connector;

drivers/gpu/drm/i915/intel_fbdev.c static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, · line 493

Quoted 5 lines
drivers/gpu/drm/i915/intel_fbdev.c +0 -2
@@ -489,10 +490,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
  		conn_configured |= BIT(i);
  	}
 
-	if ((conn_configured & mask) != mask) {
-		pass++;

This doesn't seem right; increasing the amount of passes should stay, or the use of "pass" variable should be completely replaced by conn_seq.
- Tomasz

drivers/gpu/drm/i915/intel_fbdev.c static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, · line 497

Quoted 6 lines
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
+	if ((conn_configured & mask) != mask && conn_configured != conn_seq)
  		goto retry;
-	}
 
  	/*
  	 * If the BIOS didn't enable everything it could, fall back to have the

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [PATCH] drm/i915/fbdev: Stop repeating tile configuration on stagnation

Quoted 44 lines · Tomasz Lis

I tested this variant (reverted the change to "pass" variable before testing), and it fixes the issue with count=0 as well as possible infinite loop issue.

But something needs to be done with the "pass" var, one way or the other - commented below.

W dniu 2017-02-18 o 16:37, Chris Wilson pisze:

Quoted 35 lines

If we cease making progress in finding matching outputs for a tiled configuration, stop looping over the remaining unconfigured outputs.

Fixes b0ee9e7fa5b4 ("drm/fb: add support for tiled monitor configurations. (v2)")
Cc Tomasz Lis <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc <[email protected]> # v3.19+
---
 drivers/gpu/drm/i915/intel_fbdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_fbdev.c +2 -1
index 041322fef607..32d0af6b07a7 100644
@@ -348,7 +348,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 				    bool *enabled, int width, int height)
 {
 	struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
-	unsigned long conn_configured, mask;
+	unsigned long conn_configured, conn_seq, mask;
 	unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
 	int i, j;
 	bool *save_enabled;
@@ -365,6 +365,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 	mask = GENMASK(count - 1, 0);
 	conn_configured = 0;
 retry:
+	conn_seq = conn_configured;
 	for (i = 0; i < count; i++) {
 		struct drm_fb_helper_connector *fb_conn;
 		struct drm_connector *connector;
Quoted 8 lines

drivers/gpu/drm/i915/intel_fbdev.c static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, · line 492

Quoted 5 lines
drivers/gpu/drm/i915/intel_fbdev.c +0 -2
@@ -489,10 +490,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		conn_configured |= BIT(i);
 	}
-	if ((conn_configured & mask) != mask) {
-		pass++;

This doesn't seem right; increasing the amount of passes should stay, or the use of "pass" variable should be completely replaced by conn_seq.

Good catch.

drivers/gpu/drm/i915/intel_fbdev.c +1 -2
index 32d0af6b07a7..f7e9a4e69595 100644
@@ -355,7 +355,6 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
        bool fallback = true;
        int num_connectors_enabled = 0;
        int num_connectors_detected = 0;
-       int pass = 0;
 
        save_enabled = kcalloc(count, sizeof(bool), GFP_KERNEL);
        if (!save_enabled)
@@ -379,7 +378,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
                if (conn_configured & BIT(i))
                        continue;
 
-               if (pass == 0 && !connector->has_tile)
+               if (conn_seq == 0 && !connector->has_tile)
                        continue;
 
                if (connector->status == connector_status_connected)

Suggestions for a better name than conn_seq much appreciated. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
author Reviewed-by
#7 lore raw

Re: [PATCH] drm/i915/fbdev: Stop repeating tile configuration on stagnation

Looks good to me.

W dniu 2017-02-20 o 16:46, Chris Wilson pisze:

Quoted 80 lines · Tomasz Lis
Quoted 44 lines

I tested this variant (reverted the change to "pass" variable before testing), and it fixes the issue with count=0 as well as possible infinite loop issue.

But something needs to be done with the "pass" var, one way or the other - commented below.

W dniu 2017-02-18 o 16:37, Chris Wilson pisze:

Quoted 35 lines

If we cease making progress in finding matching outputs for a tiled configuration, stop looping over the remaining unconfigured outputs.

Fixes b0ee9e7fa5b4 ("drm/fb: add support for tiled monitor configurations. (v2)")
Cc Tomasz Lis <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc <[email protected]> # v3.19+
---
  drivers/gpu/drm/i915/intel_fbdev.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_fbdev.c +2 -1
index 041322fef607..32d0af6b07a7 100644
@@ -348,7 +348,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
  				    bool *enabled, int width, int height)
  {
  	struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
-	unsigned long conn_configured, mask;
+	unsigned long conn_configured, conn_seq, mask;
  	unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
  	int i, j;
  	bool *save_enabled;
@@ -365,6 +365,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
  	mask = GENMASK(count - 1, 0);
  	conn_configured = 0;
  retry:
+	conn_seq = conn_configured;
  	for (i = 0; i < count; i++) {
  		struct drm_fb_helper_connector *fb_conn;
  		struct drm_connector *connector;
Quoted 8 lines

drivers/gpu/drm/i915/intel_fbdev.c static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, · line 492

Quoted 5 lines
drivers/gpu/drm/i915/intel_fbdev.c +0 -2
@@ -489,10 +490,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
  		conn_configured |= BIT(i);
  	}
-	if ((conn_configured & mask) != mask) {
-		pass++;

This doesn't seem right; increasing the amount of passes should stay, or the use of "pass" variable should be completely replaced by conn_seq.

Good catch.

drivers/gpu/drm/i915/intel_fbdev.c +1 -2
index 32d0af6b07a7..f7e9a4e69595 100644
@@ -355,7 +355,6 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
         bool fallback = true;
         int num_connectors_enabled = 0;
         int num_connectors_detected = 0;
-       int pass = 0;
 
         save_enabled = kcalloc(count, sizeof(bool), GFP_KERNEL);
         if (!save_enabled)
@@ -379,7 +378,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
                 if (conn_configured & BIT(i))
                         continue;
 
-               if (pass == 0 && !connector->has_tile)
+               if (conn_seq == 0 && !connector->has_tile)
                         continue;
 
                 if (connector->status == connector_status_connected)

Suggestions for a better name than conn_seq much appreciated. -Chris

Reviewed-by on v1 1/1
#8 lore raw
In reply to Tomasz Lis
Quoted 10 lines · Tomasz Lis

The recently introduced patch changed behavior of masks when the bit number is negative. Instead of no bits set, the new way makes all bits set. Problematic patch:
drm/i915: Avoid BIT(max) - 1 and use GENMASK(max - 1, 0)

This behaviour was not considered when making changes, and boundary value of count (=0) is now resulting in a mask with all bits on, since the value is directly decreased and therefore negative. Checking if all bits are set leads to infinite loop.

Quoted 5 lines

This patch introduces an additional check to avoid empty masks. It reverts the control flow to the exact same way it worked before the problematic patch.

Change commit tile to "drm/i915/fbdev: Proper support of boundary".

Other than that:

Signature · 6 lines
Cheers,
Arek
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

✓ Fi.CI.BAT: success for drm/fb: Proper support of boundary conditions in bitmasks. (rev4)

In reply to Tomasz Lis
== Series Details ==

== Series Details ==

Series: drm/fb: Proper support of boundary conditions in bitmasks. (rev4)
URL : https://patchwork.freedesktop.org/series/19826/
State : success

== Summary ==

Series 19826v4 drm/fb: Proper support of boundary conditions in bitmasks.
https://patchwork.freedesktop.org/api/1.0/series/19826/revisions/4/mbox/

fi-bdw-5557u     total:252  pass:241  dwarn:0   dfail:0   fail:0   skip:11 
fi-bsw-n3050     total:252  pass:213  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:252  pass:233  dwarn:0   dfail:0   fail:0   skip:19 
fi-bxt-t5700     total:83   pass:70   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:252  pass:225  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:252  pass:221  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-hsw-4770r     total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-ilk-650       total:252  pass:202  dwarn:0   dfail:0   fail:0   skip:50 
fi-ivb-3520m     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-ivb-3770      total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-kbl-7500u     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-skl-6260u     total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-skl-6700hq    total:252  pass:235  dwarn:0   dfail:0   fail:0   skip:17 
fi-skl-6700k     total:252  pass:230  dwarn:4   dfail:0   fail:0   skip:18 
fi-skl-6770hq    total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-snb-2520m     total:252  pass:224  dwarn:0   dfail:0   fail:0   skip:28 
fi-snb-2600      total:252  pass:223  dwarn:0   dfail:0   fail:0   skip:29 

d13370a042e9d05329bcac34eb43c64e4f6704e0 drm-tip: 2017y-02m-17d-21h-23m-28s UTC integration manifest 671f065 drm/i915/fbdev: Stop repeating tile configuration on stagnation

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3895/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#10 lore raw
In reply to Tomasz Lis
Quoted 4 lines · Tomasz Lis

The recently introduced patch changed behavior of masks when the bit number is negative. Instead of no bits set, the new way makes all bits set. Problematic patch:
drm/i915: Avoid BIT(max) - 1 and use GENMASK(max - 1, 0)

For future reference, please find the commit id of the committed patch, and reference that with the Fixes: tag. Please Cc the folks from the commit.

Whoever commits this must add:

Fixes 3c779a49bd7c ("drm/i915: Avoid BIT(max) - 1 and use GENMASK(max - 1, 0)")
Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>

Joonas, Chris, please check the rest of the regressing commit that it doesn't suffer from the same issue.

Thanks,
Jani.

Quoted 27 lines

This behaviour was not considered when making changes, and boundary value of count (=0) is now resulting in a mask with all bits on, since the value is directly decreased and therefore negative. Checking if all bits are set leads to infinite loop.

This patch introduces an additional check to avoid empty masks. It reverts the control flow to the exact same way it worked before the problematic patch.

---
 drivers/gpu/drm/i915/intel_fbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
index e6f3eb2d..bc65ecf 100644
@@ -496,7 +496,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		conn_configured |= BIT(i);
 	}
 
-	if ((conn_configured & mask) != mask) {
+	if (count > 0 && (conn_configured & mask) != mask) {
 		pass++;
 		goto retry;
 	}
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by
#11 lore raw
Quoted 19 lines · Jani Nikula
Quoted 5 lines · Tomasz Lis

The recently introduced patch changed behavior of masks when the bit number is negative. Instead of no bits set, the new way makes all bits set. Problematic patch:
  drm/i915: Avoid BIT(max) - 1 and use GENMASK(max - 1, 0)

For future reference, please find the commit id of the committed patch, and reference that with the Fixes: tag. Please Cc the folks from the commit.

Whoever commits this must add:

Fixes 3c779a49bd7c ("drm/i915: Avoid BIT(max) - 1 and use GENMASK(max - 1, 0)")
Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Quoted 5 lines

Joonas, Chris, please check the rest of the regressing commit that it doesn't suffer from the same issue.

Thanks,
Jani.

This line was actually rest of the commit. So all good, thanks for catching this.

Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx