From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: "Dong, Zhanjun" <zhanjun.dong@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: <lucas.demarchi@intel.com>
Subject: Re: [PATCH v5 2/2] drm/xe/guc: Add prefix to guc log buffer macros
Date: Tue, 21 Oct 2025 23:25:49 +0200 [thread overview]
Message-ID: <31d17ab6-6f3a-46fd-8c86-a436e4a2fb11@intel.com> (raw)
In-Reply-To: <f19dea5d-5399-4c1e-b669-9a1cd2bd2c6b@intel.com>
On 10/21/2025 11:13 PM, Dong, Zhanjun wrote:
>
>
> On 2025-10-21 1:49 p.m., Michal Wajdeczko wrote:
>>
>>
>> On 10/9/2025 11:57 PM, Zhanjun Dong wrote:
...
>>> +#define GUC_LOG_SIZE ((SZ_4K) + \
>>> + (XE_GUC_LOG_EVENT_DATA_BUFFER_SIZE) + \
>>> + (XE_GUC_LOG_CRASH_DUMP_BUFFER_SIZE) + \
>>> + (XE_GUC_LOG_STATE_CAPTURE_BUFFER_SIZE))
>>
>> too many ( ), only one set is needed to wrap all additions
>
> will change it to
> +#define GUC_LOG_SIZE (SZ_4K) + \
> + (XE_GUC_LOG_EVENT_DATA_BUFFER_SIZE) + \
> + (XE_GUC_LOG_CRASH_DUMP_BUFFER_SIZE) + \
> + (XE_GUC_LOG_STATE_CAPTURE_BUFFER_SIZE)
>
> I follow the rule that add () to all macros referenced as operand within an expression.
> This way if the operand macro was change in the future, the logic in this macro, like operator precedence will not be effected.
>
but it is the responsibility of each macro definition to provide consistent outcome
while it is possible, it would be an huge mistake to define something like this:
#define SZ_1K 1023 + 1
as that would break not just your code, but 1000's other places
so IMO GUC_LOG_SIZE should be defined as:
#define GUC_LOG_SIZE (SZ_4K + \
XE_GUC_LOG_EVENT_DATA_BUFFER_SIZE + \
XE_GUC_LOG_CRASH_DUMP_BUFFER_SIZE + \
XE_GUC_LOG_STATE_CAPTURE_BUFFER_SIZE)
and just make sure that all other XE_GUC_LOG_xxx macros follows the same BKM
next prev parent reply other threads:[~2025-10-21 21:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 21:57 [PATCH v5 0/2] drm/xe/guc: Cleanup GuC log buffer macros and helpers Zhanjun Dong
2025-10-09 21:57 ` [PATCH v5 1/2] drm/xe/guc: Update GuC log buffer type value Zhanjun Dong
2025-10-21 17:23 ` Michal Wajdeczko
2025-10-21 17:50 ` Dong, Zhanjun
2025-10-09 21:57 ` [PATCH v5 2/2] drm/xe/guc: Add prefix to guc log buffer macros Zhanjun Dong
2025-10-21 17:49 ` Michal Wajdeczko
2025-10-21 21:13 ` Dong, Zhanjun
2025-10-21 21:25 ` Michal Wajdeczko [this message]
2025-10-09 23:22 ` ✓ CI.KUnit: success for drm/xe/guc: Cleanup GuC log buffer macros and helpers (rev2) Patchwork
2025-10-10 0:17 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-10 9:04 ` ✓ Xe.CI.Full: " Patchwork
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=31d17ab6-6f3a-46fd-8c86-a436e4a2fb11@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=zhanjun.dong@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