Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp115091rwo; Tue, 1 Aug 2023 13:59:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlHnYdPDF3813dh4QQpsORuDUAJnGpoQeVA8p6lewch6vgDrwkmftG7UAg7HL+Qi7qek4z1z X-Received: by 2002:a17:902:bc88:b0:1b9:f7f4:5687 with SMTP id bb8-20020a170902bc8800b001b9f7f45687mr10257509plb.24.1690923547111; Tue, 01 Aug 2023 13:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690923547; cv=none; d=google.com; s=arc-20160816; b=ORYDv2SsByh1spOvHcpa5gbGM7tFg7kCc4E9qxtq7W5PyzgFQigCp7QHoQPwaesQTq UotGKkAimsQ+pnQc92KjAB8SZ0jXnCQ7JrPmYtgwFXH20l3CzRnOvD3vnET7+GEOMaUy Q/oSzLxbC3MOs9pDq8OBimDIPPcuR+RyyuVr/KMmDFreeQjmjFATw4Lp2cM3v7yXP/EV fdA1+MRmxNidb21WXoRRzDT4pumU9uiQ2SBYX773uh8lX0inBiIsy3a4WoY9kEBrl+mr 8XFCvIkxATTGOQ2m42P9Etw8NQqIau20cBioSbaX7kI80/AvobkuLIW8pzNEVhRiVl9Q +oKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=nf9b5ArRYyIVdrw7rdZ9H8YQljZ2dhYx/WgjJXtbi90=; fh=qq/qfq5jP+iYotU2kop/9HdzQ64gDGsmqTQOlghYiDU=; b=IEIJ5txd5KuF2Dyjh7U9hMId9ZSuyYeWR6n4zwmc+4JuokpNQiG/6yySamp/IrxYYB Dwg+V5uFquCimbR32dSilz63qsb3/L6TZ0LU4gyGFf5LWnfNm3KuxiDPuytW+F+HjCvH zFN4PH43FUbM57UTMmmWDlZT8NKYAcIRSimThybf9agun2ikJ/6k8a5E3J8Y6ebadHpQ UdZKTXSl6z0uJszxkrTNk9WCkHT2ehnnN+iFDnojbnoJ0pXCb3N6XuJFwscEO1oESoji w5rwcYLRZFZ5ClyIZtzSJXhwlyij9L6IT6ywW8iqKymLUJ6I9uTT4+QWDj3xZmGUzTS3 o1NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=zt+nePwE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r19-20020a170903411300b001bba73ddf5bsi5784901pld.566.2023.08.01.13.58.53; Tue, 01 Aug 2023 13:59:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=zt+nePwE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbjHAUfa (ORCPT + 99 others); Tue, 1 Aug 2023 16:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231769AbjHAUf3 (ORCPT ); Tue, 1 Aug 2023 16:35:29 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAF35269A for ; Tue, 1 Aug 2023 13:35:25 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-63d30554eefso36573116d6.3 for ; Tue, 01 Aug 2023 13:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690922125; x=1691526925; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nf9b5ArRYyIVdrw7rdZ9H8YQljZ2dhYx/WgjJXtbi90=; b=zt+nePwElf098r6sKk/gQOji9C+o+MPTbAwCfrY9GUmRgmE4TTHLRZOV+JPrB0kICg uRiUNQANWEg+KHmRuhggtdxFTvqv9ZANBUuUxTbWx4+kYyQiMVlIQSKe7ZqoFVPmHfDl hDkj10yRFkQNJ9vfIpZTqvyu3xMBjPO01C8VHwDIO51fFt+hBOCj7L7DgPBFEW2/EvFP e84SDiS539tMsKja/psGxarB8iEYt/GZ93WPHy1iyioyR9c4lCVvbGtwYkcZOnk/QI7Q VSM7lb47Gx8vQheU4x9PcqS5DzUKkUya3Xiq26LtFCZ3Offt3FsWu87mf6kTtXydQ+aZ /i7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690922125; x=1691526925; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nf9b5ArRYyIVdrw7rdZ9H8YQljZ2dhYx/WgjJXtbi90=; b=iSmRhyR3oATfU3iybMtEV5bQDgLy/gGrBUXCSd1vX5q/b8C9AuYJauHdL0UZ4wC9NZ dAEK57MuYqNP+tFJxB5FTiqDjlsYH1zyj/iERPnniq1/doV2tq22BgvnUsFJjJmQhdGp clyqOC0b55Jv6IOYfBH2klwgynBCN24pW1sX14ntKEKyeAPwuUQUl3jalufjYktfGnb2 UAIvdyMuLbh4tiP97z5we8DxO9yrblOio3POTvA73M9Lprtk13Q2dWSNHJ1yn3cUeIPN vvwWKa2f7GSFQfUNwKEbXei7QjuNj+0Sj9RG+YNkH8Vwc2w+lfUrj225u9HuUm+q0dky aaug== X-Gm-Message-State: ABy/qLb5/YE7PIbEVOY85kNjXBA8a6zr5g2UihYQUSkVk/23gr4mUVdI OEEIGcXn4fOvIXWYu4D2EMDLSqhRMuFya4RRv2gQRw== X-Received: by 2002:a05:6214:84d:b0:63c:f5c0:cd14 with SMTP id dg13-20020a056214084d00b0063cf5c0cd14mr12573306qvb.49.1690922124679; Tue, 01 Aug 2023 13:35:24 -0700 (PDT) MIME-Version: 1.0 References: <20230731123625.3766-1-christian.koenig@amd.com> In-Reply-To: <20230731123625.3766-1-christian.koenig@amd.com> From: Nick Desaulniers Date: Tue, 1 Aug 2023 13:35:13 -0700 Message-ID: Subject: Re: [PATCH 1/2] drm/exec: use unique instead of local label To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: boris.brezillon@collabora.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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 31, 2023 at 5:36=E2=80=AFAM Christian K=C3=B6nig 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/20219106060208f0c2f5d09= 6eb3aed7b712f5067 > Reported-by: Nathan Chancellor > Reported-by: Naresh Kamboju > CC: Boris Brezillon > Signed-off-by: Christian K=C3=B6nig Works for me; thanks for the patch! Reviewed-by: Nick Desaulniers I suspect it's possible to change the indirect goto into a direct goto with some further refactoring (macros can take block statements; if drm_exec_until_all_locked accepted a block statement arg then you could introduce a new scope, and a new local label to that scope, then just use direct goto), but this will probably apply cleaner. (oh, is 09593216bff1 only in next at the moment? The AuthorDate threw me.) There are some curious cases where __attribute__((cleanup())) doesn't mesh well with indirect gotos. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D37722 May not ever be a problem here... > --- > 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 If you wanted to be more specific (if this addition is due to __PASTE), then `compiler_types.h` is more precise. > #include > > #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 p= ointer > * 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 =3D &&__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 =3D &&__PASTE(__drm_exec_, __LINE__)= ;\ > + (void)__drm_exec_retry_ptr; \ > + drm_exec_cleanup(exec); \ > });) > > /** > -- > 2.34.1 > --=20 Thanks, ~Nick Desaulniers