From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 7C3923A63E2 for ; Thu, 22 Jan 2026 21:53:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769118816; cv=none; b=RrMoFkMmZcktyxefJ9OksVaVB8oWsxd883S9maNBxnfCSBDS5A46uVhBDcXFYPU0B/ORCEHzmeE8BCNepOy3P1frwdv70/Tf1YDTX6Se+JQY+DHDRvAOKoh9gHGu2BI8Upq3voZI/jALpg5LmB0bs6cOpHNnrUk3rBGja0xpyQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769118816; c=relaxed/simple; bh=h8BIrhqP8PrnWBOOHldJrVM51Gi+ox30172uyTExrUE=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nG+MtwziUHPHdjzrU3suciiR9gMPkSlerobwfvXYf+AxEQROcRN/whV/Q4+T+hb+W8b28w9Ynmbd2LBg6GCBHLZ5hKpYD6fahFRjyLe2hnYTp2eYHFLivt1XArt8SMqyEucteOAnqR1BeVViW8zFTMRCXrmVWSmrQrSn8X85zWE= 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=akhFq3zf; arc=none smtp.client-ip=209.85.208.47 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="akhFq3zf" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-64c893f3a94so4310072a12.0 for ; Thu, 22 Jan 2026 13:53:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769118809; x=1769723609; 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=+Sju0/uBNJAFaT2N2jcYw51V21Jpb0sazE7YFwzTXAw=; b=akhFq3zfyidRdOwiIgm1z2O2HgFjOxq2nMaVLY1jdQ54eo7wg4WKmYt/ZLSI17cxYF wDHTKWhWjpjLQObZEIpvILFjN6JOd+tQ5mp+5VVREqz6WUhop8qzA4n6XxRTTSU/XfjJ 8uRaRgr6J5cgCmbrt1ZoIB9WvEXCwDo2nv+Exayhlpbl1PJrnu6OpvuNz4XLFY8bObRd B7dz4lnvl+fUsP8SOMGkCNyfQZz+q2QO3JKl177PTZYMLpa6q8ovGXJgj3/QqiCAUaTU rlGy6SQpXQ1tbtiG+SCm51aROndGFInlukCrKhe1GZXaoazY6ZGj6fsS6FoYzjDcBeSu U88g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769118809; x=1769723609; 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=+Sju0/uBNJAFaT2N2jcYw51V21Jpb0sazE7YFwzTXAw=; b=vx6Z2WE7HRbAfyUV7K7ukKS8qG5TbCEvkzdGR3/WQkcODlOdOWmMNaO3It1ESa20Ko EtIvFyV4SGOBipCbq25hsde+0bWKHKbj4P7CSM16drK0Q/ABdVaNqCS8SnJaEgcPxsZ4 62oPFpsssWIlv4cFo3+CbBJCEvXXqjTr4GmfDRd8r1UOhMV+OXRu2rNlrMsNG9hyoIN6 Lfbjrh9hIHJlf/SQ8Il3hJGYsuHzygC5J41rL7IfPQZGk8r0hyhkIgHLtGgzoTULgsPL Jdqx+XE1n7I9dguWpL8VdrnItv0MP1NGmaxJ89Mupv7DGrH8Em9pyKclvGNIetCNobJ/ 2yLw== X-Forwarded-Encrypted: i=1; AJvYcCVKSVdaqOBSxMpsU+nsLRNtT+j0lgwME+7PhhwuF/AB0xnGL+OQ1XOKllKMRNa1tKf+bPAmhQI9AmkdrgU=@vger.kernel.org X-Gm-Message-State: AOJu0YzTzfmWZv98lErIVnNtRXsfYSiVZIht+AzN21BqyzRUYacmhrbe KrYsulz0UbeeLAJ537JPw1pSJ9bZx74p7RnVzQEy8i4xJKjGc7qCRRtPul3LCQ== X-Gm-Gg: AZuq6aIX+oqOUkYmsdVnHmI5KSs64lvOxT5NgxVqOlc5Qnsw6UFf6ZFCvB+eVVTlTCo pSt666T5Bh+5ozJ3zR87asZJ/A0eUgKmu9Z04Vo/SzFJGwqx9ii1EHqMLRjRfAysXlHpIuxsWt3 10LAM1ocviaUhYEmb9Or1HOcZukDBHbiqrDoNMU0k34e7IfAIlhM1uM3Lql8S3gXB7+kJKna9G/ qB/MUGHqlJNc7lXGONOhh6xUPigfaU2X4XaKpKsJHuMRPuLEtXnPLldyvUNaRwSht4p5zWMKaON NuS8Lm/rl5H+sgIPquMjWNmDGW/kQdWnkWzGq2ZAhev3e3G9Bkple5HY5/xFYcjKeWUQbsq+tBW dvHz3hkm4ntn2879R60NSWAtg1etl5/qDFVkw3k+da7mZQ4yOjDozZEhP02XEHvAad/yiAlVsBo qiep7bqT/OdamSfYf24OEs/mU2ERDT2tfCDnkCFp14bSnfN6m4yZjP X-Received: by 2002:a05:600c:1914:b0:479:13e9:3d64 with SMTP id 5b1f17b1804b1-4804d2f6b5amr9565905e9.15.1769112622797; Thu, 22 Jan 2026 12:10:22 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804dbb6315sm676845e9.4.2026.01.22.12.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 12:10:22 -0800 (PST) Date: Thu, 22 Jan 2026 20:10:20 +0000 From: David Laight To: kernel test robot Cc: Nathan Chancellor , Greg Kroah-Hartman , Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Mathieu Desnoyers , Arnd Bergmann , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Yury Norov , Jani Nikula , Vincent Mailhol , Andy Shevchenko , Kees Cook , Andrew Morton , oe-kbuild-all@lists.linux.dev, Linux Memory Management List Subject: Re: [PATCH next 11/14] bit: Strengthen compile-time tests in GENMASK() and BIT() Message-ID: <20260122201020.2479d180@pumpkin> In-Reply-To: <20260122102554.1cc7a2a3@pumpkin> References: <20260121145731.3623-12-david.laight.linux@gmail.com> <202601220829.MgTMeqqN-lkp@intel.com> <20260122102554.1cc7a2a3@pumpkin> 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 Thu, 22 Jan 2026 10:25:54 +0000 David Laight wrote: > On Thu, 22 Jan 2026 09:11:53 +0800 > kernel test robot wrote: > > > Hi, > > > > kernel test robot noticed the following build errors: > > > > [auto build test ERROR on next-20260120] > > > > url: https://github.com/intel-lab-lkp/linux/commits/david-laight-linux-gmail-com/overflow-Reduce-expansion-of-__type_max/20260122-013456 > > base: next-20260120 > > patch link: https://lore.kernel.org/r/20260121145731.3623-12-david.laight.linux%40gmail.com > > patch subject: [PATCH next 11/14] bit: Strengthen compile-time tests in GENMASK() and BIT() > > config: s390-randconfig-001-20260122 (https://download.01.org/0day-ci/archive/20260122/202601220829.MgTMeqqN-lkp@intel.com/config) > > compiler: s390-linux-gcc (GCC) 8.5.0 > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260122/202601220829.MgTMeqqN-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/202601220829.MgTMeqqN-lkp@intel.com/ > > > > All errors (new ones prefixed by >>): > > > > In file included from arch/s390/include/asm/bug.h:60, > > from include/linux/bug.h:5, > > from include/linux/mmdebug.h:5, > > from arch/s390/include/asm/cmpxchg.h:11, > > from arch/s390/include/asm/atomic.h:16, > > from include/linux/atomic.h:7, > > from include/asm-generic/bitops/atomic.h:5, > > from arch/s390/include/asm/bitops.h:75, > > from include/linux/bitops.h:67, > > from include/linux/kernel.h:23, > > from net/core/page_pool.c:10: > > In function 'netmem_clear_pp_magic', > > inlined from 'page_pool_clear_pp_info' at net/core/page_pool.c:721:2: > > >> include/linux/bits.h:35:4: error: call to 'GENMASK_INPUT_CHECK_FAIL' declared with attribute error: Invalid bit numbers > ... > > include/linux/mm.h:4641:27: note: in expansion of macro 'GENMASK' > > #define PP_DMA_INDEX_MASK GENMASK(PP_DMA_INDEX_BITS + PP_DMA_INDEX_SHIFT - 1, \ > > This might be a real bug. > > The bit of mm.h is: > > #define PP_DMA_INDEX_SHIFT (1 + __fls(PP_SIGNATURE - POISON_POINTER_DELTA)) > #if POISON_POINTER_DELTA > 0 > /* PP_SIGNATURE includes POISON_POINTER_DELTA, so limit the size of the DMA > * index to not overlap with that if set > */ > #define PP_DMA_INDEX_BITS MIN(32, __ffs(POISON_POINTER_DELTA) - PP_DMA_INDEX_SHIFT) > #else > /* Use the lowest bit of PAGE_OFFSET if there's at least 8 bits available; see above */ > #define PP_DMA_INDEX_MIN_OFFSET (1 << (PP_DMA_INDEX_SHIFT + 8)) > #define PP_DMA_INDEX_BITS ((__builtin_constant_p(PAGE_OFFSET) && \ > PAGE_OFFSET >= PP_DMA_INDEX_MIN_OFFSET && \ > !(PAGE_OFFSET & (PP_DMA_INDEX_MIN_OFFSET - 1))) ? \ > MIN(32, __ffs(PAGE_OFFSET) - PP_DMA_INDEX_SHIFT) : 0) > > #endif > > #define PP_DMA_INDEX_MASK GENMASK(PP_DMA_INDEX_BITS + PP_DMA_INDEX_SHIFT - 1, \ > PP_DMA_INDEX_SHIFT) I've managed to do an s390 cross build. It is all quite obvious really. For s390 PAGE_OFFSET is usually zero (I think kernel and user mappings are separate?). This make PP_DMA_INDEX_BITS 0. PP_SIGNATURE is 64 - so PP_DMA_INDEX_SHIFT is 7. So it is doing GENMASK(6, 7) and, I think, expecting to get zero. But that is taken a mistyped GENMASK(7, 6) and treated as an error. If I rewrite __fls() and __ffs() to return 'integer constant expressions' when the input is one I think it would always have failed. A comment a few lines higher suggests that the code expects the mask to be zero in this case - and handles it properly. David > > I've no idea what the values are, but the 'hi' bit number must exceed that > of 'long'. > The __ffs() probably stop it being an 'integer constant expression' > making it just a 'compile time constant' - which I added a test for. > > David > >