All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
To: "Falkowski, Maciej" <maciej.falkowski@linux.intel.com>,
	dri-devel@lists.freedesktop.org
Cc: oded.gabbay@gmail.com, jacek.lawrynowicz@linux.intel.com,
	lizhi.hou@amd.com,
	Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Subject: Re: [PATCH] accel/ivpu: Add turbo flag to the DRM_IVPU_CMDQ_CREATE ioctl
Date: Thu, 12 Jun 2025 07:42:59 -0600	[thread overview]
Message-ID: <fbc00bc7-19c0-413a-bfdc-625255c12c33@oss.qualcomm.com> (raw)
In-Reply-To: <62bb72af-d633-442f-a598-ec632508f074@linux.intel.com>

On 6/12/2025 7:31 AM, Falkowski, Maciej wrote:
> On 6/6/2025 6:30 PM, Jeff Hugo wrote:
> 
>> On 6/5/2025 10:20 AM, Maciej Falkowski wrote:
>>> From: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
>>>
>>> Introduces a new parameter to the DRM_IVPU_CMDQ_CREATE ioctl,
>>
>> Introduce
> Ack, thanks.
>>
>>> enabling turbo mode for jobs submitted via the command queue.
>>> Turbo mode allows jobs to run at higher frequencies,
>>> potentially improving performance for demanding workloads.
>>>
>>> The change also adds the IVPU_TEST_MODE_TURBO_DISABLE flag
>>
>> "This change" is redundant. Just start with "Also add the..."
> Ack, thanks.
>>
>>> to allow test mode to explicitly disable turbo mode
>>> requested by the application.
>>> The IVPU_TEST_MODE_TURBO mode has been renamed to
>>> IVPU_TEST_MODE_TURBO_ENABLE for clarity and consistency.
>>>
>>> +/* Command queue flags */
>>> +#define DRM_IVPU_CMDQ_FLAG_TURBO 0x00000001
>>> +
>>>   /**
>>>    * struct drm_ivpu_cmdq_create - Create command queue for job 
>>> submission
>>>    */
>>> @@ -462,6 +465,17 @@ struct drm_ivpu_cmdq_create {
>>>        * %DRM_IVPU_JOB_PRIORITY_REALTIME
>>>        */
>>>       __u32 priority;
>>> +    /**
>>> +     * @flags:
>>> +     *
>>> +     * Supported flags:
>>> +     *
>>> +     * %DRM_IVPU_CMDQ_FLAG_TURBO
>>> +     *
>>> +     * Enable low-latency mode for the command queue. The NPU will 
>>> maximize performance
>>> +     * when executing jobs from such queue at the cost of increased 
>>> power usage.
>>> +     */
>>> +    __u32 flags;
>>
>> This is going to break the struct size on compat.  You probably need a 
>> __u32 reserved to maintain 64-bit alignment. 
> 
> Thank you for suggestion,
> I think compat is preserved here as u32 imposes 4 byte alignment on 64bit
> so the alignment is going to be 12 bytes on both 32bit and 64bit, I 
> tested this manually.
> Please correct me if I am wrong.

Looks like I'm wrong.  Majority of the structures have 64-bit values, 
and I didn't clearly see that this specific one is only 32-bit values.

My initial comment was based on 
https://docs.kernel.org/process/botching-up-ioctls.html - specifically:

Pad the entire struct to a multiple of 64-bits if the structure contains 
64-bit types - the structure size will otherwise differ on 32-bit versus 
64-bit. Having a different structure size hurts when passing arrays of 
structures to the kernel, or if the kernel checks the structure size, 
which e.g. the drm core does.

Ok. This was the only functional comment, and it is resolved. The other 
two are trivial fixups, so I think with those -

Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>

  reply	other threads:[~2025-06-12 13:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 16:20 [PATCH] accel/ivpu: Add turbo flag to the DRM_IVPU_CMDQ_CREATE ioctl Maciej Falkowski
2025-06-06 16:30 ` Jeff Hugo
2025-06-12 13:31   ` Falkowski, Maciej
2025-06-12 13:42     ` Jeff Hugo [this message]
2025-06-13  8:01       ` Jacek Lawrynowicz
2025-06-16 11:39 ` Jacek Lawrynowicz

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=fbc00bc7-19c0-413a-bfdc-625255c12c33@oss.qualcomm.com \
    --to=jeff.hugo@oss.qualcomm.com \
    --cc=Andrzej.Kacprowski@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=lizhi.hou@amd.com \
    --cc=maciej.falkowski@linux.intel.com \
    --cc=oded.gabbay@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.