Hi Sidong,
> +
> static int
> rocket_open(struct drm_device *dev, struct drm_file *file)
> {
> @@ -86,10 +107,19 @@ rocket_open(struct drm_device *dev, struct drm_file
> *file)
> }
>
> rocket_priv->rdev = rdev;
> +
> + rocket_priv->engine_usage = kzalloc_flex(*rocket_priv->engine_usage,
> + elapsed_ns, rdev->max_cores);
> + if (!rocket_priv->engine_usage) {
> + ret = -ENOMEM;
> + goto err_free;
> + }
> + kref_init(&rocket_priv->engine_usage->kref);
How about moving these lines into a rocket_engine_usage_create() helper, to pair
with rocket_engine_usage_destroy()?
Otherwise LGTM. Tested on RK3588 (ROCK 5B) with KASAN: the OOB from v1 no
longer reproduces, and drm-engine-npu* times are accounted as expected
while running benchmark_model with teflon.
Reviewed-by: Gyeyoung Baek <[email protected]>
Tested-by: Gyeyoung Baek <[email protected]>
--
Thanks,
Gyeyoung