Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3518506rdb; Wed, 13 Sep 2023 14:49:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZN/veJpRv2fOJwHVYghPNCSIlocgeYuqnqmMmuv9iMQuse7gqwFBQVl6aJx1TIuJb7cr1 X-Received: by 2002:a05:6871:50d:b0:1ba:8307:9a13 with SMTP id s13-20020a056871050d00b001ba83079a13mr4007601oal.11.1694641763348; Wed, 13 Sep 2023 14:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694641763; cv=none; d=google.com; s=arc-20160816; b=ip3Sn9IuVDlkiOP52iTelKYyFidCeoFVClvfBFRJMdbDRYkt2fBDVnrMUH9YvtSSml m5Mbr4Q97E9IPRpTd3u9jGykFd2+cRjFiAxwB6HWpHjj79X7oF45N2K8SsQq9nt+C4l9 0Z+F9N4rB7j+rHn5TEp66iEekNljDanQTwigj1NC7rUV4c2ta+B7FsDbOj0rSJHHyh5s wBN1vipVqSwYGNo6OHHBfwjRkEAUKtw3xGkX5jjAwG0sb2AxRGhwovrhM/9R+cUAjrVU /9LexyQODVKkPUEKu33kP3tC+h0duPInZgefJziooCLOzvveS8bHK1f+hrs8W3HshswG Aqzw== 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=4nKL606ZivgLiGe21bcFSFFps7cdMmcc0mQdwIFyl6w=; fh=koJ4GifcEBkmtWQVVtJXnACVuEmHVVu50aCdBlDBYYc=; b=OAzdilgTTLRi4bfOr4FoRmULqOdNq+Iqnw4GqukrsHlzBIqSuNr8KztueWMOZGDs2D G5H06iiq5+vB7MtHslDZBtRTVeGjltS8iY2vRiUvMUC/5yJNwNtKjaChbYAoB8aHdENo 7tz5hxYA+Pa4h9qO6wSB4lm0iTywJxVDtl0FpK5OP+nYal2TO3+Vl2qjBBJrOUPaKkTR rY6RNBgRbRa3nVrFkFcUvc5Z8wuez2hjIfvWqO8ck8BMqZ3WN+TFKWTwT0tNN6wHQDtX yis4wowkyS+OvMJaEr6NJof0/x1+yES8zqCcYkVD/R1WDgpFT9BAeUjTqIzTl9HWuE/q LrrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=osJIR1cg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id b20-20020a6567d4000000b00573fcfd4a19si6295pgs.878.2023.09.13.14.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 14:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=osJIR1cg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4EFAC835A3B8; Wed, 13 Sep 2023 14:48:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232740AbjIMVsD (ORCPT + 99 others); Wed, 13 Sep 2023 17:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjIMVsC (ORCPT ); Wed, 13 Sep 2023 17:48:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 558601739; Wed, 13 Sep 2023 14:47:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA8D2C433C8; Wed, 13 Sep 2023 21:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694641677; bh=ulSrj+T9NqdrdSB2rEZPgPGJhO75blW4ggcLU8BdGdE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=osJIR1cgrxYhGHFRhlduP+Bo7ARo6ROashTdOMScqrYSyg4nXzBZDGjVtCRyQeyqv EFx9znGeYXOXrykfXgMNcr+NGVKvqapyeSpjV1QAU0MpYxye+57Av+zozUwyZ5LK2P SwYz9JIwKj8dhFWm/ObQVc4k/XtN8FwnBRrgLmbJ7lpi3QicUgtTO7Oec1G0XXI5vC U1PwoUeHKAW1PAKR9xO4JFd15AnqNMIIaBpGcC+mhy/A+FqeffgoCNgywaJ2Bsc4sG r2YQU15jldMHuI3FZVpUPloQ15idG6MZz95tQbsDbbAqSGcvwsQQyhqan3m7oaLFHI AkVyP/iT8+POg== Date: Wed, 13 Sep 2023 23:47:53 +0200 From: Josh Poimboeuf To: Randy Dunlap Cc: Stephen Rothwell , Linux Next Mailing List , Linux Kernel Mailing List , Peter Zijlstra Subject: Re: linux-next: Tree for Sep 13 (objtool) Message-ID: <20230913214753.3xqemkqjhxcwqaz4@treble> References: <20230913150445.49bee094@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Sep 2023 14:48:22 -0700 (PDT) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email On Wed, Sep 13, 2023 at 01:34:11PM -0700, Randy Dunlap wrote: > > > On 9/12/23 22:04, Stephen Rothwell wrote: > > Hi all, > > > > Changes since 20230912: > > > > The bpf-next tree (I think) gained a boot time warning due to a semantic > > interaction with changes in the bpf tree. > > > > The drm-misc tree gained a conflict against Linus' tree. > > > > Non-merge commits (relative to Linus' tree): 4427 > > 1907 files changed, 354449 insertions(+), 27039 deletions(-) > > > > ---------------------------------------------------------------------------- > > on x86_64: > > drivers/media/common/siano/smscoreapi.o: warning: objtool: .text.unlikely: unexpected end of section > > Full randconfig file is attached. Objtool is correct: Disassembly of section .text.unlikely: 0000000000000000 : 0: 48 83 05 00 00 00 00 01 addq $0x1,0x0(%rip) # 8 <__UNIQUE_ID___addressable_smscore_unregister_client433> 3: R_X86_64_PC32 .bss+0xa03 It's not really a functional bug, it's just gcov somehow keeping GCC from finishing an optimization. In smscore_load_firmware_from_file(), which gets inlined by smscore_set_device_mode(), GCC is smart enough to know that 'coredev->device_flags & SMS_DEVICE_FAMILY2' is always true, so it half-optimizes out the ':' condition: rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? smscore_load_firmware_family2(coredev, fw_buf, fw_buf_size) : loadfirmware_handler(coredev->context, fw_buf, fw_buf_size); Though it actually still keeps the branch. It goes to smscore_set_device_mode.cold so it can set the GCOV "branch taken" bit for the !SMS_DEVICE_FAMILY2 case. But then it just falls off the edge off .text.unlikely. Peter, any opinions how to handle this? We could just make smscore_load_firmware_from_file() noinline. Or we could hard-code the fact that smscore_load_firmware_from_file() is only called in the SMS_DEVICE_FAMILY2 case, like: diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index 7d4bc2733f2b..58d951903e93 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c @@ -1127,19 +1127,19 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev, * @param coredev pointer to a coredev object returned by * smscore_register_device * @param filename null-terminated string specifies firmware file name - * @param loadfirmware_handler device handler that loads firmware * * return: 0 on success, <0 on error. */ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, - int mode, - loadfirmware_t loadfirmware_handler) + int mode) { int rc = -ENOENT; u8 *fw_buf; u32 fw_buf_size; const struct firmware *fw; + BUG_ON(coredev->device_flags != SMS_DEVICE_FAMILY2); + char *fw_filename = smscore_get_fw_filename(coredev, mode); if (!fw_filename) { pr_err("mode %d not supported on this device\n", mode); @@ -1147,10 +1147,6 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, } pr_debug("Firmware name: %s\n", fw_filename); - if (!loadfirmware_handler && - !(coredev->device_flags & SMS_DEVICE_FAMILY2)) - return -EINVAL; - rc = request_firmware(&fw, fw_filename, coredev->device); if (rc < 0) { pr_err("failed to open firmware file '%s'\n", fw_filename); @@ -1166,10 +1162,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, memcpy(fw_buf, fw->data, fw->size); fw_buf_size = fw->size; - rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? - smscore_load_firmware_family2(coredev, fw_buf, fw_buf_size) - : loadfirmware_handler(coredev->context, fw_buf, - fw_buf_size); + rc = smscore_load_firmware_family2(coredev, fw_buf, fw_buf_size); } kfree(fw_buf); @@ -1353,8 +1346,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) } if (!(coredev->modes_supported & (1 << mode))) { - rc = smscore_load_firmware_from_file(coredev, - mode, NULL); + rc = smscore_load_firmware_from_file(coredev, mode); if (rc >= 0) pr_debug("firmware download success\n"); } else {