Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1494254ybv; Fri, 14 Feb 2020 00:34:04 -0800 (PST) X-Google-Smtp-Source: APXvYqyFcOb+EYQtydXvUEtsqgIy5LbZqy6y6cjkegCWNUVY9A6tC3l5ZtyDvnICdFTACuaQ6Hmf X-Received: by 2002:a05:6808:358:: with SMTP id j24mr1119363oie.89.1581669244283; Fri, 14 Feb 2020 00:34:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581669244; cv=none; d=google.com; s=arc-20160816; b=srCr/G34wIiJeb6XlsCjskMn12UScLRnJQ7tkXwZMgiYRoQl8sP52tFZd8wbiTjsEA jaoAn1EBensjqGdMifmmP9cgn548jYHwdBGhxyjGrvCfc5adrP+p90FQ3dICy2biK3Kq Aq5Lshgo8lL163UnaYeZABd6v+nMFCj+ux5XfoLubDHwA0mosGqzMPfs4F7gyPMGh2OA 5I7lMGXNvhFgXGeCb2S7lB1AGpt2xQraCYLenXxDM6+7POntVUw4WF8ZDrKQPesj8OS0 Tjs38Vc+9otTJtdvLvKnA1E/eHg92+bITnsGaGLLSEBWO4bmfXRCMf0C3BQxodIlACHf he5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version; bh=ktmYWNaqrkYy0b559iXDErlpZ5NaLW4HJy5VvT95U6o=; b=or8kSGUaN9wPPDaGJiQ7ZYd/jzkg3r3U2MD7DRqw6+RkpokJCk6e+VrdL0lGk0f+vj +XzBMt5hhn1lRfIH7pCFTn3zOjYDxqGul1xeqhjbv8VirfzDzA/MzFR/Pr7L+6t885h6 CLiFLTngvc/65mwzT/GeLi50bmE7Z/2CYuBCj4mUWow2mT9uLLgPWg5u8v4r7IsfDveZ RSDGQe9sb1JwVYWm8o7V6OdPp7LJP5Hd33RFtlshZovVBOSpzmlmpdosLZoRGzlybmMN umwfu5Ef3g4pM11MSktDnkX3VV10+uSxNjXYmTUE24VIC1pXY8EGYXb7b53rl34AKo/i Kuxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si2515454otp.273.2020.02.14.00.33.51; Fri, 14 Feb 2020 00:34:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728513AbgBNIcg convert rfc822-to-8bit (ORCPT + 99 others); Fri, 14 Feb 2020 03:32:36 -0500 Received: from mail.fireflyinternet.com ([77.68.26.236]:57308 "EHLO fireflyinternet.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725897AbgBNIcg (ORCPT ); Fri, 14 Feb 2020 03:32:36 -0500 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 20220168-1500050 for multiple; Fri, 14 Feb 2020 08:32:23 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Jani Nikula , Joonas Lahtinen , Nathan Chancellor , Rodrigo Vivi From: Chris Wilson In-Reply-To: <87v9o965gg.fsf@intel.com> Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , =?utf-8?q?Michel_D=C3=A4nzer?= References: <20200214054706.33870-1-natechancellor@gmail.com> <87v9o965gg.fsf@intel.com> Message-ID: <158166913989.4660.10674824117292988120@skylake-alporthouse-com> User-Agent: alot/0.6 Subject: Re: [PATCH] drm/i915: Cast remain to unsigned long in eb_relocate_vma Date: Fri, 14 Feb 2020 08:32:19 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Jani Nikula (2020-02-14 06:36:15) > On Thu, 13 Feb 2020, Nathan Chancellor wrote: > > A recent commit in clang added -Wtautological-compare to -Wall, which is > > enabled for i915 after -Wtautological-compare is disabled for the rest > > of the kernel so we see the following warning on x86_64: > > > > ../drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:1433:22: warning: > > result of comparison of constant 576460752303423487 with expression of > > type 'unsigned int' is always false > > [-Wtautological-constant-out-of-range-compare] > > if (unlikely(remain > N_RELOC(ULONG_MAX))) > > ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ > > ../include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' > > # define unlikely(x) __builtin_expect(!!(x), 0) > > ^ > > 1 warning generated. > > > > It is not wrong in the case where ULONG_MAX > UINT_MAX but it does not > > account for the case where this file is built for 32-bit x86, where > > ULONG_MAX == UINT_MAX and this check is still relevant. > > > > Cast remain to unsigned long, which keeps the generated code the same > > (verified with clang-11 on x86_64 and GCC 9.2.0 on x86 and x86_64) and > > the warning is silenced so we can catch more potential issues in the > > future. > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/778 > > Suggested-by: Michel Dänzer > > Signed-off-by: Nathan Chancellor > > Works for me as a workaround, But the whole point was that the compiler could see that it was impossible and not emit the code. Doesn't this break that? -Chris