intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 0/2] Define generic helpers for manipulating macro arguments
Date: Thu, 2 May 2024 21:50:59 +0200	[thread overview]
Message-ID: <b8db3b73-beee-443f-b3cd-f2e1ddfe3775@intel.com> (raw)
In-Reply-To: <tk6kfeniwc3jl3vyuw3ntrwbyyss2sjdeuy6hojzri636mfadn@enhnebj6k34f>



On 02.05.2024 19:38, Lucas De Marchi wrote:
> On Thu, May 02, 2024 at 11:24:36AM GMT, Michal Wajdeczko wrote:
>>
>>
>> On 02.05.2024 09:24, Andy Shevchenko wrote:
>>> On Thu, May 02, 2024 at 12:32:19AM +0200, Michal Wajdeczko wrote:
>>>> Michal Wajdeczko (2):
>>>>   args.h: add more helpers for manipulating macro arguments
>>>>   drm/xe/rtp: Prefer helper macros from args.h
>>>>
>>>>  drivers/gpu/drm/xe/xe_rtp.h         |   4 +-
>>>>  drivers/gpu/drm/xe/xe_rtp_helpers.h |  26 +++----
>>>>  include/linux/args.h                | 103 ++++++++++++++++++++++++++++
>>>>  3 files changed, 115 insertions(+), 18 deletions(-)
>>>
>>> It's good in general to have the code being deduplicated, but the above
>>> statistics is a bit scary.
>>
>> The statistics here might be little blurred due to added documentation.
>> Without documentation this would look a little better:
>>
>> drivers/gpu/drm/xe/xe_rtp.h         |  4 ++--
>> drivers/gpu/drm/xe/xe_rtp_helpers.h | 26 ++++++++++----------------
>> include/linux/args.h                | 26 ++++++++++++++++++++++++++
>> 3 files changed, 38 insertions(+), 18 deletions(-)
>>
>>> Do we have more users where we indeed make code much
>>> nicer?
>>
>> A new user (still inside Xe driver) for these macro is on it's way, but
>> before that I wanted to start with a preparation step and promote any
>> generic helpers to the outside of the Xe driver, as it was pointed in
>> similar case with other helper macro [1]
>>
>> [1] https://patchwork.freedesktop.org/patch/578134/?series=129854&rev=1
>>
>>> If not, let's keep these where it belongs to for now.
>>>
>>
>> If this proposal didn't get any traction, which won't surprise me based
>> on outcome of [2], then at least I would have some ground for creating a
>> local xe_args.h or use xe_macros.h as a location for common args macros.
>>
>> [2]
>> https://lore.kernel.org/lkml/20240214214654.1700-1-michal.wajdeczko@intel.com/
> 
> I share the same concern as Andy. When I saw this series I was a bit
> more concerned because there are plans to change the rtp part in xe,
> moving it partially to code generation rather than using CPP.
> 
> However looking at the changes you are moving here, they are more about
> the simpler macros. And it's nice to have more documentation and make
> them less magical.
> 
> We need to be careful that some of the macros are not generic and were
> purposely built. Example:  _XE_COUNT_ARGS() and COUNT_ARGS() are not the
> same thing and return a different value for 0 args for example. I think

it wasn't that obvious as the macro name didn't suggest any special case
(btw, maybe it should be named as _XE_NUM_ARGS_OR_EMPTY to make it clear
it is not as simple as COUNT_ARGS)

> we don't rely on that anymore, but we should really pass this through
> CI. It should generate 100% the same code, so checking the .o matches
> after this change would be good.

yeah, this special case didn't show up during compilation, so I've
replaced it with generic COUNT_ARGS as custom variant is not needed

CI didn't found anything new and just double checked that following

  CC [M]  drivers/gpu/drm/xe/xe_hw_engine.o
  CC [M]  drivers/gpu/drm/xe/xe_reg_whitelist.o
  CC [M]  drivers/gpu/drm/xe/xe_rtp.o
  CC [M]  drivers/gpu/drm/xe/xe_tuning.o
  CC [M]  drivers/gpu/drm/xe/xe_wa.o

are the same before and after applying these changes

> 
> As per xe_args.h vs args.h: I think we can take the intermediate step
> doing a cleanup + documentation by moving to xe_args.h and later try
> to promote xe_args.h to args.h.

will post v2 shortly with macros defined in xe_args.h

Michal

> 
> thanks
> Lucas De Marchi

      reply	other threads:[~2024-05-02 19:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01 22:32 [PATCH 0/2] Define generic helpers for manipulating macro arguments Michal Wajdeczko
2024-05-01 22:32 ` [PATCH 1/2] args.h: add more " Michal Wajdeczko
2024-05-02  7:27   ` Andy Shevchenko
2024-05-02  9:49     ` Michal Wajdeczko
2024-05-02 10:17       ` Andy Shevchenko
2024-05-01 22:32 ` [PATCH 2/2] drm/xe/rtp: Prefer helper macros from args.h Michal Wajdeczko
2024-05-01 22:38 ` ✓ CI.Patch_applied: success for Define generic helpers for manipulating macro arguments Patchwork
2024-05-01 22:38 ` ✗ CI.checkpatch: warning " Patchwork
2024-05-01 22:39 ` ✓ CI.KUnit: success " Patchwork
2024-05-01 22:51 ` ✓ CI.Build: " Patchwork
2024-05-01 22:53 ` ✓ CI.Hooks: " Patchwork
2024-05-01 22:54 ` ✗ CI.checksparse: warning " Patchwork
2024-05-01 23:17 ` ✓ CI.BAT: success " Patchwork
2024-05-02  0:21 ` ✓ CI.FULL: " Patchwork
2024-05-02  7:24 ` [PATCH 0/2] " Andy Shevchenko
2024-05-02  9:24   ` Michal Wajdeczko
2024-05-02 17:38     ` Lucas De Marchi
2024-05-02 19:50       ` Michal Wajdeczko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8db3b73-beee-443f-b3cd-f2e1ddfe3775@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).