From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D755135B63B for ; Tue, 31 Mar 2026 11:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774954989; cv=none; b=Ptkii6Nze/25Xor+35FrTi5faBNorQBtH0cKNCfEKQzTJH13RuFZrnH+Xvp0PdeTKaSWCElHh+09S5Qu2DGD/FGKiN9dwVcGEkMLpm27MzloZ6FwN6qtBh+CShEA2lTJYMPFwgrMz2wIdDdHm02myswrSv+1xX32qH75xWeJBEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774954989; c=relaxed/simple; bh=CXKoAy7O5Rpwmv3YWsWhSdf1a0F4IU82daIfMAP2+1w=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=lZ2gak+dzhwqbGO8oiRh1/1hfAt7F2Hmbf2yT6RfFOz5TIQjyESzgBfKDiyoTmJLgxVV9eW4WiPVg76bsou0O/qh9rifbb39P1qYjyzXcuMw21KiUQeCT2OpvAi3oW627rLOxEHF5b+WdNCvZS0KvmJwSErgx76AmzzKSS6NsMY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CLwA+w5O; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CLwA+w5O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774954988; x=1806490988; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=CXKoAy7O5Rpwmv3YWsWhSdf1a0F4IU82daIfMAP2+1w=; b=CLwA+w5Oc9XgYPrHxT4/bUR0TUfXALwIgEsPE73LrHf/77AVgXhiBCVq XNf+K2G1QGClLFEeVH9figLPKid9Ms2sK0dvo0Tfc/uJTeDSGwrRXfBK2 cJ6BZBDMq1m3HgMoILeIpP9K+tLhPfcTB+x3cW3gcIi6D9hv5ptIO66xI CRKfxiuQNfeTntNpYIb37MGxLN4ViCkbTq06X94e3H2aUoIFc7Pf4rpd4 dU6BZ57NfhBaOK3NdhzfML3QrQi2eJQeF88YaxiW2/cA81PJH+Q1Ha8PA mx/NCTtwNzv+vut6cmS+/0Eyx0Xer1bXniAi+gLTQr0mJCm/jk/Fw7lCk g==; X-CSE-ConnectionGUID: 4d39jDJ/TlCQf8jBMiazhQ== X-CSE-MsgGUID: JEMZP6KeQZiO7MUCpbY9tA== X-IronPort-AV: E=McAfee;i="6800,10657,11744"; a="87040447" X-IronPort-AV: E=Sophos;i="6.23,151,1770624000"; d="scan'208";a="87040447" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 04:03:08 -0700 X-CSE-ConnectionGUID: z9/dny+NQpCVQjTWng+qnA== X-CSE-MsgGUID: tkbCaRf9SKW72Bb5vOGUQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,151,1770624000"; d="scan'208";a="219688900" Received: from smoticic-mobl1.ger.corp.intel.com (HELO [10.245.244.28]) ([10.245.244.28]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2026 04:03:03 -0700 Message-ID: <30209daf9db82c0c96e64989b3ade704904c5bc9.camel@linux.intel.com> Subject: Re: [PATCH 3/5] drm/exec: Make the drm_exec_until_all_locked() macro more readable From: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= To: Christian =?ISO-8859-1?Q?K=F6nig?= , intel-xe@lists.freedesktop.org Cc: Felix Kuehling , Alex Deucher , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Danilo Krummrich , Matthew Brost , Alice Ryhl , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Date: Tue, 31 Mar 2026 13:03:00 +0200 In-Reply-To: References: <20260331092023.81616-1-thomas.hellstrom@linux.intel.com> <20260331092023.81616-4-thomas.hellstrom@linux.intel.com> Organization: Intel Sweden AB, Registration Number: 556189-6027 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2026-03-31 at 11:39 +0200, Christian K=C3=B6nig wrote: >=20 >=20 > On 3/31/26 11:20, Thomas Hellstr=C3=B6m wrote: > > Use __UNIQUE_ID as done elsewhere in the kernel rather than a > > hand-rolled __PASTE to craft a unique id. > >=20 > > Also use __maybe_unused rather than (void) to signify that a > > variable, althrough written to, may not actually be used. > >=20 > > Signed-off-by: Thomas Hellstr=C3=B6m > > --- > > =C2=A0include/drm/drm_exec.h | 23 ++++++++++++++--------- > > =C2=A01 file changed, 14 insertions(+), 9 deletions(-) > >=20 > > diff --git a/include/drm/drm_exec.h b/include/drm/drm_exec.h > > index 25db52dd2af0..fc95a979e253 100644 > > --- a/include/drm/drm_exec.h > > +++ b/include/drm/drm_exec.h > > @@ -89,6 +89,19 @@ drm_exec_obj(struct drm_exec *exec, unsigned > > long index) > > =C2=A0 for (unsigned long _index =3D (exec)->num_objects - > > 1; \ > > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ((obj) =3D drm_exec_obj(exec, _index));= --_index) > > =C2=A0 > > +/* > > + * Helper to drm_exec_until_all_locked(). Don't use directly. > > + * > > + * Since labels can't be defined local to the loop's body we use a > > jump pointer > > + * to make sure that the retry is only used from within the loop's > > body. > > + */ > > +#define __drm_exec_until_all_locked(exec, > > _label) \ > > +_label: =09 > > \ > > + for (void * __maybe_unused __drm_exec_retry_ptr; > > ({ \ > > + __drm_exec_retry_ptr =3D > > &&_label; \ >=20 > I think when using __maybe_unused we could also move assigning the > variable to the deceleration and drop the extra ({}). Sure. Looks even better. Thanks, Thomas >=20 > Apart from that looks good to me. >=20 > Regards, > Christian. >=20 > > + drm_exec_cleanup(exec); =09 > > \ > > + });) > > + > > =C2=A0/** > > =C2=A0 * drm_exec_until_all_locked - loop until all GEM objects are > > locked > > =C2=A0 * @exec: drm_exec object > > @@ -96,17 +109,9 @@ drm_exec_obj(struct drm_exec *exec, unsigned > > long index) > > =C2=A0 * Core functionality of the drm_exec object. Loops until all GEM > > objects are > > =C2=A0 * locked and no more contention exists. At the beginning of the > > loop it is > > =C2=A0 * guaranteed that no GEM object is locked. > > - * > > - * Since labels can't be defined local to the loops body we use a > > jump pointer > > - * to make sure that the retry is only used from within the loops > > body. > > =C2=A0 */ > > =C2=A0#define > > drm_exec_until_all_locked(exec) \ > > -__PASTE(__drm_exec_, > > __LINE__): \ > > - for (void *__drm_exec_retry_ptr; > > ({ \ > > - __drm_exec_retry_ptr =3D &&__PASTE(__drm_exec_, > > __LINE__);\ > > - > > (void)__drm_exec_retry_ptr; \ > > - > > drm_exec_cleanup(exec); \ > > - });) > > + __drm_exec_until_all_locked(exec, __UNIQUE_ID(drm_exec)) > > =C2=A0 > > =C2=A0/** > > =C2=A0 * drm_exec_retry_on_contention - restart the loop to grap all > > locks