Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp531884imw; Fri, 15 Jul 2022 08:03:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uKEFjHl7bGJbwQqBEWYkdkavE3pknWrNuS3IF5LjfPSJc5bO1uSDpmSsg4WKoqrgeBJSoW X-Received: by 2002:a05:6402:304d:b0:43a:9d08:9613 with SMTP id bs13-20020a056402304d00b0043a9d089613mr18960786edb.289.1657897396372; Fri, 15 Jul 2022 08:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657897396; cv=none; d=google.com; s=arc-20160816; b=QMEaOCPv0vR28qc+br/ieMmYbmeOHQBnLhMIcEtQoQziUYQTjdatv3bpSdoTUnUYN/ bh5u/pWjmcb6CZN/kqIbNYC6D+mZD6mMpZRq89GfjtYDzXVUzKwG+Bbn1+AwxQPaqLJz RbOL7OaY1I2kQYe4u+17xYoDKMehNblFJgcSF0LgfR3mN+v79b6k32kDajw7ma4lRQpd gmp6XVyzl1jqEBmo/uFO/DWKTBSfnzPZd9Vl9LktlqJvI9Jm3FYkXA1JsftgbMBTS34v ZZiNOqej3FqHKwYK3QZiu6HZXXc3AymwSB6PxPdA9N1xMaAG1vreCnKUJPZm9Y6BM98b IC1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZCpAUkSHbzW7SU78gr946ipty57XyfrTGDz+mTd8s9g=; b=V/KHVFPcV+ckiKlGtNgTFjvtQJmtyph6dwpdb0MoSXjQZrgqAPmjuRTTDUeFWc+z85 iU9wWIR5bXhFX4cJmFCJV7+Pszy46eaJxQhqMI8Q57flamZwrTYnifRDSjw9EtKdr1fa BYcAn8F4BEiQlq9/sW4f/YotiFwTo7bCIEE3C0MBsGLCYqQvpY8MFJRjvaN8lKUCpgwC D5kh2rlo89T4B9mkSa8t52yHS0m+y5KyIzDQvAyzcl8DxKN15C18WxaLD3MJuslaHNsF 8Pje1NVKKxZL8lJed9Z+UcJey+TSWsRfjEZD+gamTATcruFjJIWTsi3VqIZyLD+rIe3N Bx+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZrSgvAFG; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a170906549700b0072b3a923e6csi5082852ejo.974.2022.07.15.08.02.50; Fri, 15 Jul 2022 08:03:16 -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=@intel.com header.s=Intel header.b=ZrSgvAFG; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbiGOOwF (ORCPT + 99 others); Fri, 15 Jul 2022 10:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbiGOOwC (ORCPT ); Fri, 15 Jul 2022 10:52:02 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BCA2785A9; Fri, 15 Jul 2022 07:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657896718; x=1689432718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZzyuoiCwqpLweGYOkG0+rKJpPglqwnxzM5a+WQyzOag=; b=ZrSgvAFG8gkVc/meiW3eflT0A5FGXO0eK3uBAZmg8TH076LXjl2TQNiS lllq6urSMj0UZ0OJMlEJMPMlb2gMktPYm1j4BC5DFr08ixZm0AtZB6QX0 Bpa0SoXsvHZniez3JpR+zTgC1UAvWOR8jKnpuRw2U/mSoTmi9NigfGbtO NPrjU2VMqOLN9U8rxnoEYA0ldxQj9rXXGgPVJ15UIgaj2mo/ElvtyXrhG NUp518FinAFbrB+hVQiXlxrRwoXY4yr4CcSuoYg4zfqh6giiySv79dUTm 6hb4DJj+eyVpaZQ6je7SVTghzSnJQgk358+Qyz8fduGMTwquYc4Ds+De+ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10408"; a="265600278" X-IronPort-AV: E=Sophos;i="5.92,274,1650956400"; d="scan'208";a="265600278" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 07:51:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,274,1650956400"; d="scan'208";a="654357301" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by fmsmga008.fm.intel.com with ESMTP; 15 Jul 2022 07:51:52 -0700 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 26FEpnoA007626; Fri, 15 Jul 2022 15:51:49 +0100 From: Alexander Lobakin To: Yury Norov Cc: Alexander Lobakin , Guenter Roeck , 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 Date: Fri, 15 Jul 2022 16:50:53 +0200 Message-Id: <20220715145053.64569-1-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE 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 From: Yury Norov Date: Fri, 15 Jul 2022 07:19:12 -0700 > 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? I'm sending it in a couple minutes :) > > Thanks, > Yury Thanks, Olek