Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12903645rwd; Fri, 23 Jun 2023 12:23:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5r9g91ojGeW2nALbCzx422luIDb7DnF91993i8sBcS2zDsJbbQtnCzJ8RdwykUoLSaFR4g X-Received: by 2002:a05:6a00:1788:b0:668:723e:6248 with SMTP id s8-20020a056a00178800b00668723e6248mr14792879pfg.18.1687548203109; Fri, 23 Jun 2023 12:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687548203; cv=none; d=google.com; s=arc-20160816; b=hat2xSsTRsg/AstJd6Dk25CN19+sDwLFIQGFXNWDcq4FMDVl3iqYRezXPub5/dRIRb khqX9HSWgY3cax7o86Fm0BPmkQ8rSk2nCW5marbFVOu22v3DcraCibZN4wzCg9bUBC/w 4pmmO28BZAQObri+N63xDmq+6ACJTUL7T/S7BVpkJfxXaYh7VUzOR1tEwQFuy/DOF8/s tfu/K3C4zmw6y35EfP0cZTPE4JO8aRlbuEpvAtGkqT+dKz5g71fL11mfOKbpU1zMVcwl R7rb6Y7QsZZoHJGyeu7IhGo0V7dKpJBj9AbfN+5HtE4OR02DYaoviEXHERpRwQFObBv2 AOOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=CMWwB5zzoupqeze3ME9YKWWoAX1dTedhi9arjRqeau8=; b=LTEsexkf8vH11EfW01HNPgXltgBMOlAYcALaXOLAhdIeXTR/VboyJFAmGkp0uKG55p +H6OppJ35qQufC//uq5LbIcdBMM8YeYkjDzPN2m2JE6TlEmV8ilicctfYI15gyUOtUtK g7BwCri6dVDHsnmXQHPnV4wckwDpLzRjmtAn2h69DSKthN8nfRbJYirFWY+F2POiU666 XuknWDrhFS9i3Ll603vH+gSxjRWpFNwZpMmgJ2IuZAk38vzUQEF8axAQAQBbXiLr7SsP LOwwz/8ALntMpqgg6yLUN25hf2T7RWya3tevdYCII4f/DUd1ztAx/Sxn99PfJOcSsGg5 ZSlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=fan6tNSJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f29-20020aa79d9d000000b0066975f3a955si8164385pfq.74.2023.06.23.12.23.08; Fri, 23 Jun 2023 12:23:23 -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=@linux-foundation.org header.s=google header.b=fan6tNSJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231556AbjFWSxC (ORCPT + 99 others); Fri, 23 Jun 2023 14:53:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231506AbjFWSw6 (ORCPT ); Fri, 23 Jun 2023 14:52:58 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31D471BD2 for ; Fri, 23 Jun 2023 11:52:57 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2b477e9d396so16069401fa.3 for ; Fri, 23 Jun 2023 11:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1687546375; x=1690138375; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CMWwB5zzoupqeze3ME9YKWWoAX1dTedhi9arjRqeau8=; b=fan6tNSJM/Q8QaNRAQZqNGAYyzDhbXARufMEhDRg5ZCHet5r3gGFTxCRpEgoLJT6M5 vavjXNiHRHhQka4M7JN2fWSO2jYSygtrF3jztlJQ0VHXBIJJBRc+DIIjQVFoScO1Z6bA Q6KGRX3LlrIjd2DB+T1rMcSzpQNNfnxYngJTU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687546375; x=1690138375; h=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=CMWwB5zzoupqeze3ME9YKWWoAX1dTedhi9arjRqeau8=; b=HB7g0YVhB7PPFAN+kqmJdOPdNVALeVC3HE/zmhb1BCcamdq3rbuwSl81xAA0L1uHi7 kdn7aQsDQc5LbXYzlmnKasgdrxKHJIabWT9tTaEZZCLbBx1qoF1cpD/UI8Uzgx5uMpBm WE6Vxi/iujp4f3zp7EuPC+hbNxici/flWNYPmpQnXp32jyoNE6sCUl+N2PlG4vr8S/PN aFJQlqxO0CgCkANm7YZMmIaY8RVx+RwukTDE5IyF7bVpYGdvUM/QMV2IocZox0kMcquo 2zrpt3iu5xjuCkQTjSxftdxP+TjjDLKxqqtfFh/STJk9FnUa8tdLgxQkJbGrlqSDxpax Gw6w== X-Gm-Message-State: AC+VfDzJwQB5BxmtrOWgu2J5imnlsmmuRp8klg/LGdou8fuE1C0GywLv +apVZIJB22sHWeDFLLi/tG+ezy8dCFZ3RFMKugfAiAGV X-Received: by 2002:a2e:3816:0:b0:2b5:68ad:2921 with SMTP id f22-20020a2e3816000000b002b568ad2921mr10200757lja.28.1687546375090; Fri, 23 Jun 2023 11:52:55 -0700 (PDT) Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com. [209.85.208.41]) by smtp.gmail.com with ESMTPSA id u22-20020aa7d996000000b0051bfb7de166sm777188eds.39.2023.06.23.11.52.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Jun 2023 11:52:54 -0700 (PDT) Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-51be61663c8so1001596a12.2 for ; Fri, 23 Jun 2023 11:52:54 -0700 (PDT) X-Received: by 2002:aa7:db89:0:b0:51a:265a:8fca with SMTP id u9-20020aa7db89000000b0051a265a8fcamr13544034edt.27.1687546374192; Fri, 23 Jun 2023 11:52:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Fri, 23 Jun 2023 11:52:37 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: arm32 build warnings in workqueue.c To: Dave Airlie , Nathan Chancellor , Nick Desaulniers Cc: Arnd Bergmann , Tejun Heo , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,LOTS_OF_MONEY, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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 [ Adding clang people. See this for background: https://lore.kernel.org/all/CAHk-=wi=eDN4Ub0qSN27ztBAvHSXCyiY2stu3_XbTpYpQX4x7w@mail.gmail.com/ where that patch not only cleans things up, but seems to make a difference to clang ] On Fri, 23 Jun 2023 at 11:24, Linus Torvalds wrote: > > So I really think that code needs fixing, and the gcc warning was very valid. > > Maybe something like the attached. Does this fix the gcc warning? > Tejun, comments? Whee. Inexplicably, that patch also improves code generation with clang, with things like this: - movabsq $137438953440, %rcx # imm = 0x1FFFFFFFE0 - andq %rax, %rcx - movabsq $68719476704, %rdx # imm = 0xFFFFFFFE0 - cmpq %rdx, %rcx + shrq $5, %rax + cmpl $2147483647, %eax # imm = 0x7FFFFFFF in several places. Or, even more amusingly, this: - movabsq $68719476704, %rax # imm = 0xFFFFFFFE0 - orq $1, %rax + movabsq $68719476705, %rax # imm = 0xFFFFFFFE1 where the old code was some truly crazy stuff. I have *no* idea what drugs clang is on, but clearly clang does some really really bad things with large enums, and doesn't simplify things correctly. That "I can't even do a constant 'or' at compile time when it involves an enum" is all kinds of odd. Does this matter in the big picture? No. But I think the take-away here should be that you really shouldn't use enums for random things. Compilers know enums are used as small enumerated constants, and get pissy and confused when you use them as some kind of generic storage pool for values. My guess is that clang keeps an enum as an enum as long as possible - including past some (really) simple simplification phases of the optimizer. With gcc, code generation didn't change from that patch with my defconfig on x86-64 (apart from line numbers changing). Now, clang improving code generation with that patch is obviously a good thing for the patch, but it does mean that clang really messed up before. Linus