diff mbox

[CI,1/4] drm/i915: Shrink cxsr_latency_table

Message ID 1476353366-13931-1-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin Oct. 13, 2016, 10:09 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

unsigned long is too wide - use smaller types in
struct cxsr_latency to save 800-something bytes of .rodata.

v2: All data even fits in u16 for even more saving. (Ville Syrjala)
v3: Move bitfields to the end of the struct. (Joonas Lahtinen)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++--------
 drivers/gpu/drm/i915/intel_pm.c  |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Tvrtko Ursulin Oct. 13, 2016, 12:08 p.m. UTC | #1
On 13/10/2016 12:50, Patchwork wrote:
> == Series Details ==
>
> Series: series starting with [CI,1/4] drm/i915: Shrink cxsr_latency_table
> URL   : https://patchwork.freedesktop.org/series/13715/
> State : success
>
> == Summary ==
>
> Series 13715v1 Series without cover letter
> https://patchwork.freedesktop.org/api/1.0/series/13715/revisions/1/mbox/
>
> Test kms_pipe_crc_basic:
>          Subgroup bad-source:
>                  dmesg-warn -> PASS       (fi-ilk-650)
>          Subgroup read-crc-pipe-a-frame-sequence:
>                  dmesg-warn -> PASS       (fi-ilk-650)
>          Subgroup suspend-read-crc-pipe-b:
>                  dmesg-warn -> PASS       (fi-byt-j1900)
> Test vgem_basic:
>          Subgroup unload:
>                  skip       -> PASS       (fi-hsw-4770)
>
> fi-bdw-5557u     total:246  pass:231  dwarn:0   dfail:0   fail:0   skip:15
> fi-bsw-n3050     total:246  pass:204  dwarn:0   dfail:0   fail:0   skip:42
> fi-bxt-t5700     total:246  pass:216  dwarn:0   dfail:0   fail:0   skip:30
> fi-byt-j1900     total:246  pass:213  dwarn:1   dfail:0   fail:1   skip:31
> fi-byt-n2820     total:246  pass:210  dwarn:0   dfail:0   fail:1   skip:35
> fi-hsw-4770      total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22
> fi-hsw-4770r     total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22
> fi-ilk-650       total:246  pass:184  dwarn:0   dfail:0   fail:2   skip:60
> fi-ivb-3520m     total:246  pass:221  dwarn:0   dfail:0   fail:0   skip:25
> fi-ivb-3770      total:246  pass:221  dwarn:0   dfail:0   fail:0   skip:25
> fi-kbl-7200u     total:246  pass:222  dwarn:0   dfail:0   fail:0   skip:24
> fi-skl-6260u     total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14
> fi-skl-6700hq    total:246  pass:223  dwarn:0   dfail:0   fail:0   skip:23
> fi-skl-6700k     total:246  pass:221  dwarn:1   dfail:0   fail:0   skip:24
> fi-skl-6770hq    total:246  pass:230  dwarn:1   dfail:0   fail:1   skip:14
> fi-snb-2520m     total:246  pass:210  dwarn:0   dfail:0   fail:0   skip:36
> fi-snb-2600      total:246  pass:209  dwarn:0   dfail:0   fail:0   skip:37
>
> Results at /archive/results/CI_IGT_test/Patchwork_2701/
>
> 75d9d28f7f5d0147ba35e956268c3a3c079dc754 drm-intel-nightly: 2016y-10m-13d-09h-14m-05s UTC integration manifest
> 50173ad drm/i915: Shrink TV modes const data
> a720f56 drm/i915: Shrink per-platform watermark configuration
> d1a52a3 drm/i915: Shrink sdvo_cmd_names
> d8cf1ee5 drm/i915: Shrink cxsr_latency_table
>

Merged to dinq, thanks for the review!

Regards,

Tvrtko
Jani Nikula Oct. 14, 2016, 1:31 p.m. UTC | #2
On Thu, 13 Oct 2016, Tvrtko Ursulin <tursulin@ursulin.net> wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> unsigned long is too wide - use smaller types in
> struct cxsr_latency to save 800-something bytes of .rodata.
>
> v2: All data even fits in u16 for even more saving. (Ville Syrjala)
> v3: Move bitfields to the end of the struct. (Joonas Lahtinen)
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Please learn how to run sparse, make it a habit to run it on your local
branches before submitting patches, and make it a rule to run it before
pushing patches. dim has helpers for this.

The following is caused by this patch, fix or revert ASAP.

BR,
Jani.


  CHECK   drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/i915/intel_pm.c:218:39: warning: cast truncates bits from constant value (f8f becomes 1)
drivers/gpu/drm/i915/intel_pm.c:218:45: warning: cast truncates bits from constant value (84bf becomes 1)
drivers/gpu/drm/i915/intel_pm.c:219:39: warning: cast truncates bits from constant value (edf becomes 1)
drivers/gpu/drm/i915/intel_pm.c:219:45: warning: cast truncates bits from constant value (840f becomes 1)
drivers/gpu/drm/i915/intel_pm.c:220:39: warning: cast truncates bits from constant value (eb3 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:220:45: warning: cast truncates bits from constant value (83e3 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:221:39: warning: cast truncates bits from constant value (1ad9 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:221:45: warning: cast truncates bits from constant value (9009 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:222:39: warning: cast truncates bits from constant value (18ae becomes 0)
drivers/gpu/drm/i915/intel_pm.c:222:45: warning: cast truncates bits from constant value (8dde becomes 0)
drivers/gpu/drm/i915/intel_pm.c:224:39: warning: cast truncates bits from constant value (fb5 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:224:45: warning: cast truncates bits from constant value (84e5 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:225:39: warning: cast truncates bits from constant value (f05 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:225:45: warning: cast truncates bits from constant value (8435 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:226:39: warning: cast truncates bits from constant value (eee becomes 0)
drivers/gpu/drm/i915/intel_pm.c:226:45: warning: cast truncates bits from constant value (841e becomes 0)
drivers/gpu/drm/i915/intel_pm.c:227:39: warning: cast truncates bits from constant value (1aff becomes 1)
drivers/gpu/drm/i915/intel_pm.c:227:45: warning: cast truncates bits from constant value (902f becomes 1)
drivers/gpu/drm/i915/intel_pm.c:228:39: warning: cast truncates bits from constant value (18e9 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:228:45: warning: cast truncates bits from constant value (8e19 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:230:39: warning: cast truncates bits from constant value (104d becomes 1)
drivers/gpu/drm/i915/intel_pm.c:230:45: warning: cast truncates bits from constant value (857d becomes 1)
drivers/gpu/drm/i915/intel_pm.c:231:39: warning: cast truncates bits from constant value (f9c becomes 0)
drivers/gpu/drm/i915/intel_pm.c:231:45: warning: cast truncates bits from constant value (84cc becomes 0)
drivers/gpu/drm/i915/intel_pm.c:232:39: warning: cast truncates bits from constant value (f6a becomes 0)
drivers/gpu/drm/i915/intel_pm.c:232:45: warning: cast truncates bits from constant value (849a becomes 0)
drivers/gpu/drm/i915/intel_pm.c:233:39: warning: cast truncates bits from constant value (1b96 becomes 0)
drivers/gpu/drm/i915/intel_pm.c:233:45: warning: cast truncates bits from constant value (90c6 becomes 0)
drivers/gpu/drm/i915/intel_pm.c:234:39: warning: cast truncates bits from constant value (1965 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:234:45: warning: cast truncates bits from constant value (8e95 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:236:39: warning: cast truncates bits from constant value (fe1 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:236:45: warning: cast truncates bits from constant value (8511 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:237:39: warning: cast truncates bits from constant value (f31 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:237:45: warning: cast truncates bits from constant value (8461 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:238:39: warning: cast truncates bits from constant value (f05 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:238:45: warning: cast truncates bits from constant value (8435 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:239:39: warning: cast truncates bits from constant value (1b2b becomes 1)
drivers/gpu/drm/i915/intel_pm.c:239:45: warning: cast truncates bits from constant value (905b becomes 1)
drivers/gpu/drm/i915/intel_pm.c:240:39: warning: cast truncates bits from constant value (1900 becomes 0)
drivers/gpu/drm/i915/intel_pm.c:240:45: warning: cast truncates bits from constant value (8e30 becomes 0)
drivers/gpu/drm/i915/intel_pm.c:242:39: warning: cast truncates bits from constant value (1007 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:242:45: warning: cast truncates bits from constant value (853a becomes 0)
drivers/gpu/drm/i915/intel_pm.c:243:39: warning: cast truncates bits from constant value (f57 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:243:45: warning: cast truncates bits from constant value (8487 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:244:39: warning: cast truncates bits from constant value (f41 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:244:45: warning: cast truncates bits from constant value (8471 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:245:39: warning: cast truncates bits from constant value (1b51 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:245:45: warning: cast truncates bits from constant value (9081 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:246:39: warning: cast truncates bits from constant value (193c becomes 0)
drivers/gpu/drm/i915/intel_pm.c:246:45: warning: cast truncates bits from constant value (8e6c becomes 0)
drivers/gpu/drm/i915/intel_pm.c:248:39: warning: cast truncates bits from constant value (109f becomes 1)
drivers/gpu/drm/i915/intel_pm.c:248:45: warning: cast truncates bits from constant value (85cf becomes 1)
drivers/gpu/drm/i915/intel_pm.c:249:39: warning: cast truncates bits from constant value (fef becomes 1)
drivers/gpu/drm/i915/intel_pm.c:249:45: warning: cast truncates bits from constant value (851f becomes 1)
drivers/gpu/drm/i915/intel_pm.c:250:39: warning: cast truncates bits from constant value (fbd becomes 1)
drivers/gpu/drm/i915/intel_pm.c:250:45: warning: cast truncates bits from constant value (84ed becomes 1)
drivers/gpu/drm/i915/intel_pm.c:251:39: warning: cast truncates bits from constant value (1be9 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:251:45: warning: cast truncates bits from constant value (9119 becomes 1)
drivers/gpu/drm/i915/intel_pm.c:252:39: warning: cast truncates bits from constant value (19b8 becomes 0)
drivers/gpu/drm/i915/intel_pm.c:252:45: warning: cast truncates bits from constant value (8ee8 becomes 0)


> ---
>  drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++--------
>  drivers/gpu/drm/i915/intel_pm.c  |  4 ++--
>  2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index f48e79ae2ac6..1663000023b9 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -807,14 +807,14 @@ struct intel_watermark_params {
>  };
>  
>  struct cxsr_latency {
> -	int is_desktop;
> -	int is_ddr3;
> -	unsigned long fsb_freq;
> -	unsigned long mem_freq;
> -	unsigned long display_sr;
> -	unsigned long display_hpll_disable;
> -	unsigned long cursor_sr;
> -	unsigned long cursor_hpll_disable;
> +	u16 fsb_freq;
> +	u16 mem_freq;
> +	u16 display_sr;
> +	u16 display_hpll_disable;
> +	u16 cursor_sr;
> +	u16 cursor_hpll_disable;
> +	bool is_desktop : 1;
> +	bool is_ddr3 : 1;
>  };
>  
>  #define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base)
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index fe6c1c61c388..6d1d4022dbdb 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -252,8 +252,8 @@ static const struct cxsr_latency cxsr_latency_table[] = {
>  	{0, 1, 400, 800, 6042, 36042, 6584, 36584},    /* DDR3-800 SC */
>  };
>  
> -static const struct cxsr_latency *intel_get_cxsr_latency(int is_desktop,
> -							 int is_ddr3,
> +static const struct cxsr_latency *intel_get_cxsr_latency(bool is_desktop,
> +							 bool is_ddr3,
>  							 int fsb,
>  							 int mem)
>  {
Tvrtko Ursulin Oct. 14, 2016, 2:08 p.m. UTC | #3
On 14/10/2016 14:31, Jani Nikula wrote:
> On Thu, 13 Oct 2016, Tvrtko Ursulin <tursulin@ursulin.net> wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> unsigned long is too wide - use smaller types in
>> struct cxsr_latency to save 800-something bytes of .rodata.
>>
>> v2: All data even fits in u16 for even more saving. (Ville Syrjala)
>> v3: Move bitfields to the end of the struct. (Joonas Lahtinen)
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Please learn how to run sparse, make it a habit to run it on your local
> branches before submitting patches, and make it a rule to run it before
> pushing patches. dim has helpers for this.

Yeah I saw that you added dim sparse this week, however it only runs if 
the dim tree is used for building it seems.

I will try to figure out how to run in a separate build tree.

> The following is caused by this patch, fix or revert ASAP.

Fix sent, you are on cc.

Regards,

Tvrtko
Chris Wilson Oct. 14, 2016, 2:14 p.m. UTC | #4
On Fri, Oct 14, 2016 at 03:08:29PM +0100, Tvrtko Ursulin wrote:
> 
> On 14/10/2016 14:31, Jani Nikula wrote:
> >On Thu, 13 Oct 2016, Tvrtko Ursulin <tursulin@ursulin.net> wrote:
> >>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >>
> >>unsigned long is too wide - use smaller types in
> >>struct cxsr_latency to save 800-something bytes of .rodata.
> >>
> >>v2: All data even fits in u16 for even more saving. (Ville Syrjala)
> >>v3: Move bitfields to the end of the struct. (Joonas Lahtinen)
> >>
> >>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >>Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> >Please learn how to run sparse, make it a habit to run it on your local
> >branches before submitting patches, and make it a rule to run it before
> >pushing patches. dim has helpers for this.
> 
> Yeah I saw that you added dim sparse this week, however it only runs
> if the dim tree is used for building it seems.
> 
> I will try to figure out how to run in a separate build tree.

apt-get install sparse
make C=1

Start fuming.
-Chris
Jani Nikula Oct. 14, 2016, 2:20 p.m. UTC | #5
On Fri, 14 Oct 2016, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> On 14/10/2016 14:31, Jani Nikula wrote:
>> On Thu, 13 Oct 2016, Tvrtko Ursulin <tursulin@ursulin.net> wrote:
>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>
>>> unsigned long is too wide - use smaller types in
>>> struct cxsr_latency to save 800-something bytes of .rodata.
>>>
>>> v2: All data even fits in u16 for even more saving. (Ville Syrjala)
>>> v3: Move bitfields to the end of the struct. (Joonas Lahtinen)
>>>
>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> Please learn how to run sparse, make it a habit to run it on your local
>> branches before submitting patches, and make it a rule to run it before
>> pushing patches. dim has helpers for this.
>
> Yeah I saw that you added dim sparse this week, however it only runs if 
> the dim tree is used for building it seems.
>
> I will try to figure out how to run in a separate build tree.

There was 'dim checker' before, and now also 'dim sparse'. Both do the
builds in the current directory, and do not cd to drm-intel directories,
so they can be used independent of other dim stuff.

In any case, running sparse is just a matter of having sparse in PATH,
and building using make C=1 or C=2. The former will run sparse on just
the files that need to be recompiled, the latter on everything. See also
'make help'. The helpers in dim first touch the the sources or rm the
object files, and run C=1.

>> The following is caused by this patch, fix or revert ASAP.
>
> Fix sent, you are on cc.

Thanks.

BR,
Jani.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f48e79ae2ac6..1663000023b9 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -807,14 +807,14 @@  struct intel_watermark_params {
 };
 
 struct cxsr_latency {
-	int is_desktop;
-	int is_ddr3;
-	unsigned long fsb_freq;
-	unsigned long mem_freq;
-	unsigned long display_sr;
-	unsigned long display_hpll_disable;
-	unsigned long cursor_sr;
-	unsigned long cursor_hpll_disable;
+	u16 fsb_freq;
+	u16 mem_freq;
+	u16 display_sr;
+	u16 display_hpll_disable;
+	u16 cursor_sr;
+	u16 cursor_hpll_disable;
+	bool is_desktop : 1;
+	bool is_ddr3 : 1;
 };
 
 #define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index fe6c1c61c388..6d1d4022dbdb 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -252,8 +252,8 @@  static const struct cxsr_latency cxsr_latency_table[] = {
 	{0, 1, 400, 800, 6042, 36042, 6584, 36584},    /* DDR3-800 SC */
 };
 
-static const struct cxsr_latency *intel_get_cxsr_latency(int is_desktop,
-							 int is_ddr3,
+static const struct cxsr_latency *intel_get_cxsr_latency(bool is_desktop,
+							 bool is_ddr3,
 							 int fsb,
 							 int mem)
 {