Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp502843imw; Fri, 15 Jul 2022 07:27:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1unLyjqz3jxB+bh5JTFhGO5JpYPNhwyS1OTbx79o80G3GrtvjGL4wGTu8N59nZKFc1fUOVw X-Received: by 2002:a05:6402:320b:b0:43a:73ee:6273 with SMTP id g11-20020a056402320b00b0043a73ee6273mr19348075eda.365.1657895265752; Fri, 15 Jul 2022 07:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657895265; cv=none; d=google.com; s=arc-20160816; b=ySt7CRI2HtfM6ybVQ/mv0amWhlv4xZW7bKWvIQ/8zpDREPcb/+dJ1H4QflqasITNB2 dSzBYXrupizVzG0RE61IyfHGLDubsviJCxylWh6rufKOb/q/GQxgSIgC7KDi4Hn90aA6 ucytBzA3rkYfuMWAA3Y0cUTyvSWwK9xeIpyxBvmNKbfCs5R0M+q1wEUJVhGWWXMWuybi r2tZJR2+MI9ohWmVzQcxRgtOh2tmqu0HIpl3+zZQtyWLBGNBJQ0cCLD7enC7h410s5ao DGGnZTirUZkqa6pGk3b65BjSm86U9fXyvhTWN1drO0AjgOfVk1o21G+lMxhD/Le/aGu5 wjKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VM8umUUF8nWEq+3AaJAtV0L0dG1DVjrEYAJskHQ0LoQ=; b=i2xH/3pC7LhmhdltuPHrVr4GQeIZ5/yjhkhdrpcMLdOZzYY4LHZ9p+n+nrO16ACjIg hKmj//rkAfe90B4MDIl7f7bX2WzWtisiMVdq+OySt0E+0R5TBOzYoRzsaUsB1YDAQXw+ JlAj4ww3FTO2uGCeB5LMjdgTJEuj5fisnwcAbPPxgN6ZYxhw1DCxcfcuBQ95NX7OAGzs BFSPYTexnuw6lB1wKQlbBviQscwHkghQgOp+VAYMWTl8GYRm8GtXTT+Zs5X8QwtX5E2c QkwgyyI2BJCZt2rvh3gMGOF5ZBsbiNAL9M/mLMniIUCbrmT3RBUPJ0j0sZ4Jw4zjba5u T47w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oPyPC8JN; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j24-20020aa7ca58000000b0043ab3c46218si5503198edt.487.2022.07.15.07.26.59; Fri, 15 Jul 2022 07:27:45 -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=@gmail.com header.s=20210112 header.b=oPyPC8JN; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233264AbiGOOTV (ORCPT + 99 others); Fri, 15 Jul 2022 10:19:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiGOOTP (ORCPT ); Fri, 15 Jul 2022 10:19:15 -0400 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B18F57235; Fri, 15 Jul 2022 07:19:14 -0700 (PDT) Received: by mail-oi1-x232.google.com with SMTP id j3so6208799oif.8; Fri, 15 Jul 2022 07:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VM8umUUF8nWEq+3AaJAtV0L0dG1DVjrEYAJskHQ0LoQ=; b=oPyPC8JND1jmk0qt6wIXCgqcuLOOl8rGUp32GLJy5a41WTs+t/zQKDnMPfvvn9vQYG hVNBmIiqK0CZJ7KeXvsfaLz5vgoIdjp4xEo6HcryvOJ98g7OVrHRBi+33W44+bXjbIH5 YTxxqMTh3CAaGcgmPDUM6IDfsaSWOJEpSpSzax//VcMzEfSiDPKfKy5X9/uWPGIMq9/y OeaA8Q6pvUv8mQay4ZtyK/hv8ZgKNk7gzzL0D5IazIZCptUcaMBMEKuq1L6v3n/0eq4Y jp3xHaJTKOhHzVpoh4jgNGbZoiH7M3R8hbqK5sFOwtVyzVo8kMBlwqPLUiV42dTI7CkI X85w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VM8umUUF8nWEq+3AaJAtV0L0dG1DVjrEYAJskHQ0LoQ=; b=F2I1PhEYcTCcq0ARxr6bNwki5D8p+OZwmTmD7iE4otN2wCeIvvq+Tx7u2nWMuWhrj7 vBCOP0fFmsebnkOCM+2edT2/rk4hLqXFMK4dQWkpsTdB3AuTpt+5Vb/6BNHAdYcKCrqp EfVbNrlrMvAnHfKMv5wo25kSouAcOtonIFCh3Obh/094afIpITHuGuNMadzRt9cx2N6i 9um3kJG2J1XUswl0/aphTYFxSZf/9imSRtgkF5nIYacVUBdLwXv3Gs16FMEVZ8immAV6 D//2RH1BVthik7fQJtpZhTxX8XWJoQPXUMVQLXPic7pnbqnDiDkWutrkMvEALymVBI9q jYfw== X-Gm-Message-State: AJIora9WVWkRYSGklmrvD68eN+G2e3ynGnhEBnaOikYgD7zKk++v1Sal JjCmCoBoKbixC9R11wMDts0= X-Received: by 2002:a05:6808:120a:b0:333:54f1:351 with SMTP id a10-20020a056808120a00b0033354f10351mr7215208oil.70.1657894753352; Fri, 15 Jul 2022 07:19:13 -0700 (PDT) Received: from localhost ([12.97.180.36]) by smtp.gmail.com with ESMTPSA id t3-20020a056870608300b00101c9597c6fsm2302385oae.28.2022.07.15.07.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 07:19:13 -0700 (PDT) Date: Fri, 15 Jul 2022 07:19:12 -0700 From: Yury Norov To: Guenter Roeck Cc: Alexander Lobakin , Arnd Bergmann , Andy Shevchenko , Mark Rutland , Matt Turner , Brian Cain , Geert Uytterhoeven , Yoshinori Sato , Rich Felker , "David S. Miller" , Kees Cook , "Peter Zijlstra (Intel)" , Marco Elver , Borislav Petkov , Tony Luck , Maciej Fijalkowski , Jesse Brandeburg , Greg Kroah-Hartman , Nathan Chancellor , Nick Desaulniers , Tom Rix , kernel test robot , linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 6/9] bitops: let optimize out non-atomic bitops on compile-time constants Message-ID: References: <20220624121313.2382500-1-alexandr.lobakin@intel.com> <20220624121313.2382500-7-alexandr.lobakin@intel.com> <20220715000402.GA512558@roeck-us.net> <20220715132633.61480-1-alexandr.lobakin@intel.com> <8c949bd4-d25a-d5f5-49be-59d52e4b6c9d@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8c949bd4-d25a-d5f5-49be-59d52e4b6c9d@roeck-us.net> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Fri, Jul 15, 2022 at 06:49:46AM -0700, Guenter Roeck wrote: > On 7/15/22 06:26, Alexander Lobakin wrote: > > From: Guenter Roeck > > Date: Thu, 14 Jul 2022 17:04:02 -0700 > > > > > On Fri, Jun 24, 2022 at 02:13:10PM +0200, Alexander Lobakin wrote: > > > > Currently, many architecture-specific non-atomic bitop > > > > implementations use inline asm or other hacks which are faster or > > > > [...] > > > > > > Cc: Mark Rutland > > > > Signed-off-by: Alexander Lobakin > > > > Reviewed-by: Marco Elver > > > > > > Building i386:allyesconfig ... failed > > > -------------- > > > Error log: > > > arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'send_ebook_state': > > > arch/x86/platform/olpc/olpc-xo1-sci.c:83:63: error: logical not is only applied to the left hand side of comparison > > > > Looks like a trigger, not a cause... Anyway, this construct: > > > > unsigned char state; > > > > [...] > > > > if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state) > > > > doesn't look legit enough. > > That redundant double-negation [of boolean value], together with > > comparing boolean to char, provokes compilers to think the author > > made logical mistakes here, although it works as expected. > > Could you please try (if it's not automated build which you can't > > modify) the following: > > > > Agreed, the existing code seems wrong. The change below looks correct > and fixes the problem. Feel free to add > > Reviewed-and-tested-by: Guenter Roeck > > to the real patch. > > Thanks, > Guenter > > > --- a/arch/x86/platform/olpc/olpc-xo1-sci.c > > +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c > > @@ -80,7 +80,7 @@ static void send_ebook_state(void) > > return; > > } > > - if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state) > > + if (test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == !!state) > > return; /* Nothing new to report. */ > > input_report_switch(ebook_switch_idev, SW_TABLET_MODE, state); > > --- > > > > We'd take it into the bitmap tree then. The series revealed > > a fistful of existing code issues already :) Would you like me to add your signed-off-by and apply, or you prefer to send it out as a patch? Thanks, Yury