From: Boris Brezillon <boris.brezillon@collabora.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
ndesaulniers@google.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
daniel@ffwll.ch, trix@redhat.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, naresh.kamboju@linaro.org, dakr@redhat.com
Subject: Re: [PATCH 1/2] drm/exec: use unique instead of local label
Date: Mon, 31 Jul 2023 18:00:20 +0200 [thread overview]
Message-ID: <20230731180020.4c47e0e3@collabora.com> (raw)
In-Reply-To: <20230731153119.GA773004@dev-arch.thelio-3990X>
On Mon, 31 Jul 2023 08:31:19 -0700
Nathan Chancellor <nathan@kernel.org> wrote:
> On Mon, Jul 31, 2023 at 02:36:24PM +0200, Christian König wrote:
> > GCC forbids to jump to labels in loop conditions and a new clang
> > check stumbled over this.
> >
> > So instead using a local label inside the loop condition use an
> > unique label outside of it.
> >
> > Fixes: commit 09593216bff1 ("drm: execution context for GEM buffers v7")
> > Link: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1890
> > Link: https://github.com/llvm/llvm-project/commit/20219106060208f0c2f5d096eb3aed7b712f5067
> > Reported-by: Nathan Chancellor <nathan@kernel.org>
> > Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> > CC: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> > Signed-off-by: Christian König <christian.koenig@amd.com>
>
> Passes my build tests and I inspected the preprocessed output to make
> sure it should work. I ran the KUnit tests, which all pass (although [1]
> is needed to fix a tangential issue):
>
> Tested-by: Nathan Chancellor <nathan@kernel.org>
>
> Thanks for fixing this!
>
> [1]: https://lore.kernel.org/20230728183400.306193-1-arthurgrillo@riseup.net/
>
> > ---
> > include/drm/drm_exec.h | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/drm/drm_exec.h b/include/drm/drm_exec.h
> > index 73205afec162..e0462361adf9 100644
> > --- a/include/drm/drm_exec.h
> > +++ b/include/drm/drm_exec.h
> > @@ -3,6 +3,7 @@
> > #ifndef __DRM_EXEC_H__
> > #define __DRM_EXEC_H__
> >
> > +#include <linux/compiler.h>
> > #include <linux/ww_mutex.h>
> >
> > #define DRM_EXEC_INTERRUPTIBLE_WAIT BIT(0)
> > @@ -74,13 +75,12 @@ struct drm_exec {
> > * 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.
> > */
> > -#define drm_exec_until_all_locked(exec) \
> > - for (void *__drm_exec_retry_ptr; ({ \
> > - __label__ __drm_exec_retry; \
> > -__drm_exec_retry: \
> > - __drm_exec_retry_ptr = &&__drm_exec_retry; \
> > - (void)__drm_exec_retry_ptr; \
> > - drm_exec_cleanup(exec); \
> > +#define drm_exec_until_all_locked(exec) \
> > +__PASTE(__drm_exec_, __LINE__): \
> > + for (void *__drm_exec_retry_ptr; ({ \
> > + __drm_exec_retry_ptr = &&__PASTE(__drm_exec_, __LINE__);\
> > + (void)__drm_exec_retry_ptr; \
> > + drm_exec_cleanup(exec); \
> > });)
> >
> > /**
> > --
> > 2.34.1
> >
> >
WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: ndesaulniers@google.com,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
naresh.kamboju@linaro.org, llvm@lists.linux.dev,
linux-kernel@vger.kernel.org, mripard@kernel.org,
dakr@redhat.com, dri-devel@lists.freedesktop.org,
tzimmermann@suse.de, trix@redhat.com
Subject: Re: [PATCH 1/2] drm/exec: use unique instead of local label
Date: Mon, 31 Jul 2023 18:00:20 +0200 [thread overview]
Message-ID: <20230731180020.4c47e0e3@collabora.com> (raw)
In-Reply-To: <20230731153119.GA773004@dev-arch.thelio-3990X>
On Mon, 31 Jul 2023 08:31:19 -0700
Nathan Chancellor <nathan@kernel.org> wrote:
> On Mon, Jul 31, 2023 at 02:36:24PM +0200, Christian König wrote:
> > GCC forbids to jump to labels in loop conditions and a new clang
> > check stumbled over this.
> >
> > So instead using a local label inside the loop condition use an
> > unique label outside of it.
> >
> > Fixes: commit 09593216bff1 ("drm: execution context for GEM buffers v7")
> > Link: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1890
> > Link: https://github.com/llvm/llvm-project/commit/20219106060208f0c2f5d096eb3aed7b712f5067
> > Reported-by: Nathan Chancellor <nathan@kernel.org>
> > Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> > CC: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> > Signed-off-by: Christian König <christian.koenig@amd.com>
>
> Passes my build tests and I inspected the preprocessed output to make
> sure it should work. I ran the KUnit tests, which all pass (although [1]
> is needed to fix a tangential issue):
>
> Tested-by: Nathan Chancellor <nathan@kernel.org>
>
> Thanks for fixing this!
>
> [1]: https://lore.kernel.org/20230728183400.306193-1-arthurgrillo@riseup.net/
>
> > ---
> > include/drm/drm_exec.h | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/drm/drm_exec.h b/include/drm/drm_exec.h
> > index 73205afec162..e0462361adf9 100644
> > --- a/include/drm/drm_exec.h
> > +++ b/include/drm/drm_exec.h
> > @@ -3,6 +3,7 @@
> > #ifndef __DRM_EXEC_H__
> > #define __DRM_EXEC_H__
> >
> > +#include <linux/compiler.h>
> > #include <linux/ww_mutex.h>
> >
> > #define DRM_EXEC_INTERRUPTIBLE_WAIT BIT(0)
> > @@ -74,13 +75,12 @@ struct drm_exec {
> > * 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.
> > */
> > -#define drm_exec_until_all_locked(exec) \
> > - for (void *__drm_exec_retry_ptr; ({ \
> > - __label__ __drm_exec_retry; \
> > -__drm_exec_retry: \
> > - __drm_exec_retry_ptr = &&__drm_exec_retry; \
> > - (void)__drm_exec_retry_ptr; \
> > - drm_exec_cleanup(exec); \
> > +#define drm_exec_until_all_locked(exec) \
> > +__PASTE(__drm_exec_, __LINE__): \
> > + for (void *__drm_exec_retry_ptr; ({ \
> > + __drm_exec_retry_ptr = &&__PASTE(__drm_exec_, __LINE__);\
> > + (void)__drm_exec_retry_ptr; \
> > + drm_exec_cleanup(exec); \
> > });)
> >
> > /**
> > --
> > 2.34.1
> >
> >
next prev parent reply other threads:[~2023-07-31 16:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 12:36 [PATCH 1/2] drm/exec: use unique instead of local label Christian König
2023-07-31 12:36 ` [PATCH 2/2] drm/exec: add test case for using a drm_exec multiple times Christian König
2023-07-31 15:31 ` [PATCH 1/2] drm/exec: use unique instead of local label Nathan Chancellor
2023-07-31 15:31 ` Nathan Chancellor
2023-07-31 16:00 ` Boris Brezillon [this message]
2023-07-31 16:00 ` Boris Brezillon
2023-08-01 20:35 ` Nick Desaulniers
2023-08-01 20:35 ` Nick Desaulniers
2023-08-02 8:44 ` Boris Brezillon
2023-08-02 8:44 ` Boris Brezillon
2023-08-02 21:24 ` Nick Desaulniers
2023-08-02 21:24 ` Nick Desaulniers
2023-08-10 8:29 ` Rasmus Villemoes
2023-08-10 8:29 ` Rasmus Villemoes
2023-08-09 15:37 ` Nathan Chancellor
2023-08-09 15:37 ` Nathan Chancellor
2023-08-10 6:40 ` Boris Brezillon
2023-08-10 6:40 ` Boris Brezillon
2023-08-10 6:48 ` Christian König
2023-08-10 6:48 ` Christian König
2023-08-10 14:38 ` Nathan Chancellor
2023-08-10 14:38 ` Nathan Chancellor
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=20230731180020.4c47e0e3@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dakr@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=naresh.kamboju@linaro.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=trix@redhat.com \
--cc=tzimmermann@suse.de \
/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.