diff mbox series

[RESEND] drm/i915/gvt: remove unused variable gma_bottom in command parser

Message ID 20230531020411.18987-1-zhi.a.wang@intel.com (mailing list archive)
State New, archived
Headers show
Series [RESEND] drm/i915/gvt: remove unused variable gma_bottom in command parser | expand

Commit Message

Zhi Wang May 31, 2023, 2:04 a.m. UTC
Remove unused variable gma_bottom in scan_workload() and scan_wa_ctx().
commit be1da7070aea ("drm/i915/gvt: vGPU command scanner") introduces
gma_bottom in several functions to calculate the size of the command
buffer. However, some of them are set but actually unused.

When compiling the code with ccflags -Wunused-but-set-variable, gcc
throws warnings.

Remove unused variables to avoid the gcc warnings. Tested via compiling
the code with ccflags -Wunused-but-set-variable.

Fixes: be1da7070aea ("drm/i915/gvt: vGPU command scanner")
Suggested-by: Jani Nikula <jani.nikula@intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: intel-gvt-dev@lists.freedesktop.org
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
---
 drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Zhenyu Wang May 31, 2023, 5:39 a.m. UTC | #1
On 2023.05.31 02:04:11 +0000, Zhi Wang wrote:
> Remove unused variable gma_bottom in scan_workload() and scan_wa_ctx().
> commit be1da7070aea ("drm/i915/gvt: vGPU command scanner") introduces
> gma_bottom in several functions to calculate the size of the command
> buffer. However, some of them are set but actually unused.
> 
> When compiling the code with ccflags -Wunused-but-set-variable, gcc
> throws warnings.
> 
> Remove unused variables to avoid the gcc warnings. Tested via compiling
> the code with ccflags -Wunused-but-set-variable.
> 
> Fixes: be1da7070aea ("drm/i915/gvt: vGPU command scanner")
> Suggested-by: Jani Nikula <jani.nikula@intel.com>
> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> Cc: intel-gvt-dev@lists.freedesktop.org
> Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
> ---

Good with me. I think I also caught this before but never send the change..
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>

>  drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> index 3c4ae1da0d41..05f9348b7a9d 100644
> --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
> +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
> @@ -2833,7 +2833,7 @@ static int command_scan(struct parser_exec_state *s,
>  
>  static int scan_workload(struct intel_vgpu_workload *workload)
>  {
> -	unsigned long gma_head, gma_tail, gma_bottom;
> +	unsigned long gma_head, gma_tail;
>  	struct parser_exec_state s;
>  	int ret = 0;
>  
> @@ -2843,7 +2843,6 @@ static int scan_workload(struct intel_vgpu_workload *workload)
>  
>  	gma_head = workload->rb_start + workload->rb_head;
>  	gma_tail = workload->rb_start + workload->rb_tail;
> -	gma_bottom = workload->rb_start +  _RING_CTL_BUF_SIZE(workload->rb_ctl);
>  
>  	s.buf_type = RING_BUFFER_INSTRUCTION;
>  	s.buf_addr_type = GTT_BUFFER;
> @@ -2874,7 +2873,7 @@ static int scan_workload(struct intel_vgpu_workload *workload)
>  static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
>  {
>  
> -	unsigned long gma_head, gma_tail, gma_bottom, ring_size, ring_tail;
> +	unsigned long gma_head, gma_tail, ring_size, ring_tail;
>  	struct parser_exec_state s;
>  	int ret = 0;
>  	struct intel_vgpu_workload *workload = container_of(wa_ctx,
> @@ -2891,7 +2890,6 @@ static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
>  			PAGE_SIZE);
>  	gma_head = wa_ctx->indirect_ctx.guest_gma;
>  	gma_tail = wa_ctx->indirect_ctx.guest_gma + ring_tail;
> -	gma_bottom = wa_ctx->indirect_ctx.guest_gma + ring_size;
>  
>  	s.buf_type = RING_BUFFER_INSTRUCTION;
>  	s.buf_addr_type = GTT_BUFFER;
> -- 
> 2.25.1
>
Andi Shyti May 31, 2023, 9:20 a.m. UTC | #2
Hi Zhi,

On Wed, May 31, 2023 at 02:04:11AM +0000, Zhi Wang wrote:
> Remove unused variable gma_bottom in scan_workload() and scan_wa_ctx().
> commit be1da7070aea ("drm/i915/gvt: vGPU command scanner") introduces
> gma_bottom in several functions to calculate the size of the command
> buffer. However, some of them are set but actually unused.
> 
> When compiling the code with ccflags -Wunused-but-set-variable, gcc
> throws warnings.
> 
> Remove unused variables to avoid the gcc warnings. Tested via compiling
> the code with ccflags -Wunused-but-set-variable.
> 
> Fixes: be1da7070aea ("drm/i915/gvt: vGPU command scanner")
> Suggested-by: Jani Nikula <jani.nikula@intel.com>
> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> Cc: intel-gvt-dev@lists.freedesktop.org
> Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>

looks good:

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Andi
Jani Nikula May 31, 2023, 9:27 a.m. UTC | #3
On Wed, 31 May 2023, Zhenyu Wang <zhenyuw@linux.intel.com> wrote:
> On 2023.05.31 02:04:11 +0000, Zhi Wang wrote:
>> Remove unused variable gma_bottom in scan_workload() and scan_wa_ctx().
>> commit be1da7070aea ("drm/i915/gvt: vGPU command scanner") introduces
>> gma_bottom in several functions to calculate the size of the command
>> buffer. However, some of them are set but actually unused.
>> 
>> When compiling the code with ccflags -Wunused-but-set-variable, gcc
>> throws warnings.
>> 
>> Remove unused variables to avoid the gcc warnings. Tested via compiling
>> the code with ccflags -Wunused-but-set-variable.
>> 
>> Fixes: be1da7070aea ("drm/i915/gvt: vGPU command scanner")
>> Suggested-by: Jani Nikula <jani.nikula@intel.com>
>> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
>> Cc: intel-gvt-dev@lists.freedesktop.org
>> Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
>> ---
>
> Good with me. I think I also caught this before but never send the change..
> Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>

I'd like to pick this up via drm-intel-next if that's all right.

BR,
Jani.

>
>>  drivers/gpu/drm/i915/gvt/cmd_parser.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
>> index 3c4ae1da0d41..05f9348b7a9d 100644
>> --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
>> +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
>> @@ -2833,7 +2833,7 @@ static int command_scan(struct parser_exec_state *s,
>>  
>>  static int scan_workload(struct intel_vgpu_workload *workload)
>>  {
>> -	unsigned long gma_head, gma_tail, gma_bottom;
>> +	unsigned long gma_head, gma_tail;
>>  	struct parser_exec_state s;
>>  	int ret = 0;
>>  
>> @@ -2843,7 +2843,6 @@ static int scan_workload(struct intel_vgpu_workload *workload)
>>  
>>  	gma_head = workload->rb_start + workload->rb_head;
>>  	gma_tail = workload->rb_start + workload->rb_tail;
>> -	gma_bottom = workload->rb_start +  _RING_CTL_BUF_SIZE(workload->rb_ctl);
>>  
>>  	s.buf_type = RING_BUFFER_INSTRUCTION;
>>  	s.buf_addr_type = GTT_BUFFER;
>> @@ -2874,7 +2873,7 @@ static int scan_workload(struct intel_vgpu_workload *workload)
>>  static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
>>  {
>>  
>> -	unsigned long gma_head, gma_tail, gma_bottom, ring_size, ring_tail;
>> +	unsigned long gma_head, gma_tail, ring_size, ring_tail;
>>  	struct parser_exec_state s;
>>  	int ret = 0;
>>  	struct intel_vgpu_workload *workload = container_of(wa_ctx,
>> @@ -2891,7 +2890,6 @@ static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
>>  			PAGE_SIZE);
>>  	gma_head = wa_ctx->indirect_ctx.guest_gma;
>>  	gma_tail = wa_ctx->indirect_ctx.guest_gma + ring_tail;
>> -	gma_bottom = wa_ctx->indirect_ctx.guest_gma + ring_size;
>>  
>>  	s.buf_type = RING_BUFFER_INSTRUCTION;
>>  	s.buf_addr_type = GTT_BUFFER;
>> -- 
>> 2.25.1
>>
Jani Nikula June 2, 2023, 5:02 p.m. UTC | #4
On Wed, 31 May 2023, Patchwork <patchwork@emeril.freedesktop.org> wrote:
> == Series Details ==
>
> Series: drm/i915/gvt: remove unused variable gma_bottom in command parser (rev2)
> URL   : https://patchwork.freedesktop.org/series/118512/
> State : warning
>
> == Summary ==
>
> Error: dim checkpatch failed
> c6878ab01be9 drm/i915/gvt: remove unused variable gma_bottom in command parser
> -:63: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address mismatch: 'From: Zhi Wang <zhi.wang.linux@gmail.com>' != 'Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>'

I can fix this while applying, but please indicate whether you intended
to have From: Zhi Wang <zhi.a.wang@intel.com> or Signed-off-by: Zhi Wang
<zhi.wang.linux@gmail.com>.

BR,
Jani.

>
> total: 0 errors, 1 warnings, 0 checks, 30 lines checked
>
>
Jani Nikula June 5, 2023, 2:35 p.m. UTC | #5
On Fri, 02 Jun 2023, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Wed, 31 May 2023, Patchwork <patchwork@emeril.freedesktop.org> wrote:
>> == Series Details ==
>>
>> Series: drm/i915/gvt: remove unused variable gma_bottom in command parser (rev2)
>> URL   : https://patchwork.freedesktop.org/series/118512/
>> State : warning
>>
>> == Summary ==
>>
>> Error: dim checkpatch failed
>> c6878ab01be9 drm/i915/gvt: remove unused variable gma_bottom in command parser
>> -:63: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address mismatch: 'From: Zhi Wang <zhi.wang.linux@gmail.com>' != 'Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>'
>
> I can fix this while applying, but please indicate whether you intended
> to have From: Zhi Wang <zhi.a.wang@intel.com> or Signed-off-by: Zhi Wang
> <zhi.wang.linux@gmail.com>.

Ping. I can't apply this with this warning, and I can't fix
Signed-off-by unless you tell me what to do.


BR,
Jani.
Zhenyu Wang June 7, 2023, 9:34 a.m. UTC | #6
On 2023.05.31 12:27:11 +0300, Jani Nikula wrote:
> On Wed, 31 May 2023, Zhenyu Wang <zhenyuw@linux.intel.com> wrote:
> > On 2023.05.31 02:04:11 +0000, Zhi Wang wrote:
> >> Remove unused variable gma_bottom in scan_workload() and scan_wa_ctx().
> >> commit be1da7070aea ("drm/i915/gvt: vGPU command scanner") introduces
> >> gma_bottom in several functions to calculate the size of the command
> >> buffer. However, some of them are set but actually unused.
> >> 
> >> When compiling the code with ccflags -Wunused-but-set-variable, gcc
> >> throws warnings.
> >> 
> >> Remove unused variables to avoid the gcc warnings. Tested via compiling
> >> the code with ccflags -Wunused-but-set-variable.
> >> 
> >> Fixes: be1da7070aea ("drm/i915/gvt: vGPU command scanner")
> >> Suggested-by: Jani Nikula <jani.nikula@intel.com>
> >> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> >> Cc: intel-gvt-dev@lists.freedesktop.org
> >> Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
> >> ---
> >
> > Good with me. I think I also caught this before but never send the change..
> > Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> 
> I'd like to pick this up via drm-intel-next if that's all right.
> 

Sorry for missed this. Pls feel free to do so. I'll sync to check anything left in gvt tree.

Thanks.
Wang, Zhi A June 8, 2023, 8:14 a.m. UTC | #7
Hi Jani:

Please take the <zhi.a.wang@intel.com> as my S-O-B since this is a patch about GVT-g. I still don't know why my intel email smtp doesn't work.

Thanks,
Zhi.

-----Original Message-----
From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Jani Nikula
Sent: Monday, June 5, 2023 10:36 PM
To: Zhi Wang <zhi.wang.linux@gmail.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gvt: remove unused variable gma_bottom in command parser (rev2)

On Fri, 02 Jun 2023, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Wed, 31 May 2023, Patchwork <patchwork@emeril.freedesktop.org> wrote:
>> == Series Details ==
>>
>> Series: drm/i915/gvt: remove unused variable gma_bottom in command parser (rev2)
>> URL   : https://patchwork.freedesktop.org/series/118512/
>> State : warning
>>
>> == Summary ==
>>
>> Error: dim checkpatch failed
>> c6878ab01be9 drm/i915/gvt: remove unused variable gma_bottom in 
>> command parser
>> -:63: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address mismatch: 'From: Zhi Wang <zhi.wang.linux@gmail.com>' != 'Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>'
>
> I can fix this while applying, but please indicate whether you 
> intended to have From: Zhi Wang <zhi.a.wang@intel.com> or 
> Signed-off-by: Zhi Wang <zhi.wang.linux@gmail.com>.

Ping. I can't apply this with this warning, and I can't fix Signed-off-by unless you tell me what to do.


BR,
Jani.


--
Jani Nikula, Intel Open Source Graphics Center
Jani Nikula June 8, 2023, 9 a.m. UTC | #8
On Thu, 08 Jun 2023, "Wang, Zhi A" <zhi.a.wang@intel.com> wrote:
> Please take the <zhi.a.wang@intel.com> as my S-O-B since this is a
> patch about GVT-g. I still don't know why my intel email smtp doesn't
> work.

Thanks, pushed.

You should be able to configure git to set your author From: in the
patch, even when sending the patch email with a different From:.

See e.g. [1].

BR,
Jani.


[1] https://lore.kernel.org/r/20230606191504.18099-2-ville.syrjala@linux.intel.com
Wang, Zhi A June 8, 2023, 9:04 a.m. UTC | #9
Thanks so much for the trick. Learned.

-----Original Message-----
From: Jani Nikula <jani.nikula@linux.intel.com> 
Sent: Thursday, June 8, 2023 5:01 PM
To: Wang, Zhi A <zhi.a.wang@intel.com>; Zhi Wang <zhi.wang.linux@gmail.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: RE: [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gvt: remove unused variable gma_bottom in command parser (rev2)

On Thu, 08 Jun 2023, "Wang, Zhi A" <zhi.a.wang@intel.com> wrote:
> Please take the <zhi.a.wang@intel.com> as my S-O-B since this is a 
> patch about GVT-g. I still don't know why my intel email smtp doesn't 
> work.

Thanks, pushed.

You should be able to configure git to set your author From: in the patch, even when sending the patch email with a different From:.

See e.g. [1].

BR,
Jani.


[1] https://lore.kernel.org/r/20230606191504.18099-2-ville.syrjala@linux.intel.com


--
Jani Nikula, Intel Open Source Graphics Center
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
index 3c4ae1da0d41..05f9348b7a9d 100644
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
@@ -2833,7 +2833,7 @@  static int command_scan(struct parser_exec_state *s,
 
 static int scan_workload(struct intel_vgpu_workload *workload)
 {
-	unsigned long gma_head, gma_tail, gma_bottom;
+	unsigned long gma_head, gma_tail;
 	struct parser_exec_state s;
 	int ret = 0;
 
@@ -2843,7 +2843,6 @@  static int scan_workload(struct intel_vgpu_workload *workload)
 
 	gma_head = workload->rb_start + workload->rb_head;
 	gma_tail = workload->rb_start + workload->rb_tail;
-	gma_bottom = workload->rb_start +  _RING_CTL_BUF_SIZE(workload->rb_ctl);
 
 	s.buf_type = RING_BUFFER_INSTRUCTION;
 	s.buf_addr_type = GTT_BUFFER;
@@ -2874,7 +2873,7 @@  static int scan_workload(struct intel_vgpu_workload *workload)
 static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
 {
 
-	unsigned long gma_head, gma_tail, gma_bottom, ring_size, ring_tail;
+	unsigned long gma_head, gma_tail, ring_size, ring_tail;
 	struct parser_exec_state s;
 	int ret = 0;
 	struct intel_vgpu_workload *workload = container_of(wa_ctx,
@@ -2891,7 +2890,6 @@  static int scan_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
 			PAGE_SIZE);
 	gma_head = wa_ctx->indirect_ctx.guest_gma;
 	gma_tail = wa_ctx->indirect_ctx.guest_gma + ring_tail;
-	gma_bottom = wa_ctx->indirect_ctx.guest_gma + ring_size;
 
 	s.buf_type = RING_BUFFER_INSTRUCTION;
 	s.buf_addr_type = GTT_BUFFER;