From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ADD7347BA5 for ; Mon, 13 Apr 2026 20:17:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776111479; cv=none; b=IK+qmaWm9hs1kPAxnRJ7KGuuPZViOrSDgPODWrblsuh8meFITjOteWAdeILJkEdc9RkFE81zUg6nyum7tvwnTZFHq2+ur34ZPlmPsKDU4kL6ABnDC7WiJu/0kpPPJfnfTdkp4AUcq05AWdCQI6W7fIYIn8bcOBuQ8KXQvMBbSRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776111479; c=relaxed/simple; bh=wP4z9P4uZmwRAO8DvMsuP8Hd8F9gBkWn4g+KT+IeUYw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tGVnKmilACpNCQJGzcF45cO7jULAEfDQoOVur0UlbSmLVkOQ0B5P10ebXSeaxK6TNX5Mw2l/6A23CjN0u6PSfR7kz/X/RRuQc9iJzFrFu4lftD3Dw7UvGB5h/V2KQ2ZxVXsUK5evAAgOr0MHWvpgJ+/kdNa8dzXK0Yijb9tfDf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BnNw0rJH; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BnNw0rJH" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-43d7e23defbso425736f8f.0 for ; Mon, 13 Apr 2026 13:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776111477; x=1776716277; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=QonialaOeRsx+GeBfarh1r5oZZLkjbGCk56wYsSk4i0=; b=BnNw0rJHyH1nXpdLAksOZh8WeTp2auztEjpCKbVtoDuykg/spoRq4kumcsRe0XvT+0 Pi/+bzN2c18d1SilLu4FTsSZt1RGBaCdeT27CuvjWxMPMeNg3pRO6Dw4QT4B1SzpD4KR ngJ7MUdG+HIjHXY0oro6TyF+2rNQKIYPD6FHO9LSoiSH4CPdRILYMT3BB4c2lZyWp+Bf lFbxvZ9llCVMxWB22RzJ8C3jZTwQFZjM+gB8qzNjyhQ0ijJ5ZETpTBcE2K2e+hrHyAP7 uLBfueG39rdRbMuAtn0tLHAlhZAiUUqNkeWJxTSV2NvGmRQAl6aIIWgphc56yp/8TYtd M3GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776111477; x=1776716277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QonialaOeRsx+GeBfarh1r5oZZLkjbGCk56wYsSk4i0=; b=SnhKVotFWdg1BtrCV4CtSG6922K+4le52CfPwFTjIibZewnp+ExyEjBDsbJZQHFhGv b0V/79DhLa4KjRxMPl9qd7iot9RWCct3ZCH69CutbS63vCcoM9ZxEkiFF9/cF+NHSR6g yzDcONO2EjaY988+IxWkbVwzaKRJ8sKlHK+eglMU0bw8NM0IufbajyIHDm3zC22k4x4E TIkJBc9XDbewgWdzBPseHZVJeF+RP1d+Nbk3sdpWnMb02kAyyZJYl5zgoCl0me6d21QE U8iHLnINk1Q4rKxUisl1chZYhknFsh0KJCPj5WKXXU4ST1DaViqeUAmw93OpdP2H4ZmW XEWg== X-Forwarded-Encrypted: i=1; AFNElJ8SdFHg/aX54SjjCEYHw7ihhfGnPxpt9ApKp6mAUz5lOvYPQiTo1iLPz07372raN8q6oLgQrMJ3IxWOO3o=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3gWEFP3+BDYkeY09UytbAC+DwEQP+oNOLSduvDBNvtSU0xsNx lkpP74heUATcLs1otcBij4JOMZxDtipy8qM33vkwunTiaTBLYTPuYIlA X-Gm-Gg: AeBDieusR7BdiHUXCio6sW16vGuuRl6AsGEc3n9ptU0zUSWQTO3qMNEV0oeONasefFB 98G8+bhkwUTcgsh9Gn5fcnOIS1LJGEeaTdCXuA0ZMed6QSM1zIBbQ1ugcFdgDiFEnl9ZCdEC6Cz 1tpxCnLPEeKEi7eCvcEsfCxQJ4CvrmhXrjciDKxbv4WWJKIyxUCXfYSrUD+U+IRF2msUNEySeGy /rBwFdLNOvzWdSFh8Ymjdb+btvMfD5F7CDnER+67r+4Z1CKegr8IwMTfvlShF+iVthc28O4uKkE w5rUjKeE/8JWqDezySfRIz83ZcGXTlNNoCiYyT2Vji5ah65Mu2XOjhprwJaq25R/c19wfbFo9KZ yocoNZNblRThtqtwdHvFMPDa+g8KHWMxE/lzBSCsl3Lyu9WR2f1zkLs4/5pdQXBgwb+ZmTqaLSR x+Q+AQjRyidkmA3WHN04rTBlo+7z7/jRPAa0sFyJau5Q0QC3NiVRMZsVnS7u0uprp/CDQLF3yrn oM= X-Received: by 2002:a05:6000:c4f:b0:43d:68b2:a0ec with SMTP id ffacd0b85a97d-43d68b2a2b5mr12724663f8f.1.1776111476618; Mon, 13 Apr 2026 13:17:56 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63dec295sm34973689f8f.14.2026.04.13.13.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2026 13:17:56 -0700 (PDT) Date: Mon, 13 Apr 2026 21:17:54 +0100 From: David Laight To: "Bird, Tim" Cc: kernel test robot , "pmladek@suse.com" , "rostedt@goodmis.org" , "john.ogness@linutronix.de" , "senozhatsky@chromium.org" , "oe-kbuild-all@lists.linux.dev" , "francesco@valla.it" , "geert@linux-m68k.org" , "tglx@kernel.org" , "shashankbalaji02@gmail.com" , "linux-embedded@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v4 1/1] printk: fix zero-valued printk timestamps in early boot Message-ID: <20260413211754.643f6113@pumpkin> In-Reply-To: References: <20260410203741.997410-2-tim.bird@sony.com> <202604121822.OvOLcTnO-lkp@intel.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 13 Apr 2026 17:58:34 +0000 "Bird, Tim" wrote: > Hmmm, > > This is a false positive warning from the compiler (see below). > > I apologize for not catching it. I did test with CONFIG_EARLY_CYCLES=0 > and I'm not sure why I didn't see the warning. > > I'll see if I can silence this warning. > > > -----Original Message----- > > From: kernel test robot > > Sent: Sunday, April 12, 2026 4:11 AM > > Hi Tim, > > > > kernel test robot noticed the following build warnings: > > > > [auto build test WARNING on linus/master] > > [also build test WARNING on v7.0-rc7 next-20260410] > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > And when submitting patch, we suggest to use '--base' as documented in > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > > > url: https://github.com/intel-lab-lkp/linux/commits/Tim-Bird/printk-fix-zero-valued-printk-timestamps-in-early-boot/20260412-134726 > > base: linus/master > > patch link: https://lore.kernel.org/r/20260410203741.997410-2-tim.bird%40sony.com > > patch subject: [PATCH v4 1/1] printk: fix zero-valued printk timestamps in early boot > > config: arm64-allnoconfig (https://download.01.org/0day-ci/archive/20260412/202604121822.OvOLcTnO-lkp@intel.com/config) > > compiler: aarch64-linux-gcc (GCC) 15.2.0 > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260412/202604121822.OvOLcTnO-lkp@intel.com/reproduce) > > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > > the same patch/commit), kindly add following tags > > | Reported-by: kernel test robot > > | Closes: https://lore.kernel.org/oe-kbuild-all/202604121822.OvOLcTnO-lkp@intel.com/ > > > > All warnings (new ones prefixed by >>): > > > > In file included from kernel/printk/printk.c:49: > > include/linux/early_times.h: In function 'early_times_ns': > > >> include/linux/early_times.h:45:61: warning: division by zero [-Wdiv-by-zero] > > 45 | return (early_unsafe_cycles() * NS_PER_KHZ) / CONFIG_EARLY_CYCLES_KHZ; > > | ^ > > > > > > vim +45 include/linux/early_times.h > > > > 34 > > 35 /* returns a nanosecond value based on early cycles */ > > 36 static inline u64 early_times_ns(void) > > 37 { > > 38 if (CONFIG_EARLY_CYCLES_KHZ) > > 39 /* > > 40 * Note: the multiply must precede the division to avoid > > 41 * truncation and loss of resolution > > 42 * Don't use fancier MULT/SHIFT math here. Since this is > > 43 * static, the compiler can optimize the math operations. > > 44 */ > > > 45 return (early_unsafe_cycles() * NS_PER_KHZ) / CONFIG_EARLY_CYCLES_KHZ; > Based on this conditional, it's not possible for CONFIG_EARLY_CYCLES_KHZ to be zero > on this line of code. Does GCC not catch this? > if (0) > x = /0; > > So this is a false positive. I suspect the warning is being generated before the optimiser throws the code away as unreachable. You might have to do: return (early_unsafe_cycles() * NS_PER_KHZ) / (CONFIG_EARLY_CYCLES_KHZ ?: 1); David > > > 46 return 0; > > 47 } > > 48 #else > > 49 static inline u64 early_times_ns(void) > > 50 { > > 51 return 0; > > 52 } > > 53 #endif > > 54 > > > > -- > > 0-DAY CI Kernel Test Service > > https://github.com/intel/lkp-tests/wiki