Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4233955rdb; Mon, 11 Dec 2023 12:48:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpHctMpmlXLGg38OZZXc6nc7pXGpyuUsvPZaOn5C01cLHY5t3YqiT7r8PokaI99w4WrMRq X-Received: by 2002:a05:6359:6302:b0:16b:a9f5:cde0 with SMTP id sf2-20020a056359630200b0016ba9f5cde0mr4604807rwb.29.1702327693891; Mon, 11 Dec 2023 12:48:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702327693; cv=none; d=google.com; s=arc-20160816; b=j3krJETXWikxgDCr2mjZA3WeF1eiRFfVNp6Zzzdu/J3AESAuP3DjzJlFSCqZcEPQP3 BjKamxnwqXS0k8QNdjGzgQ6d4+i6aCDRZhc7RAJO4QVRs4oFli2TFQUDkAdcEPWIJBDv bvDdHqA52I3accXS9zdmzkQCu7uHuEvlH1epHZTJ3J68QeVTB+rl8odumZstMXm/ge5+ rJMc2/DZByx9hFAbpxMJFJybJ6XDGFfaVgExaZadm0jlMXyuAZ11r96n0bfuKV+Im/zr mByq96cWK8V5jKkbGYAEVZQhoSD/txqtDswmZ5GXk6SD089EYo+RFl0xubaz6sHy+MLG 6LPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FNFFKTdQ4QRGU3jiDsgZw6qRsjpUS+kZ+xjPJ/qMrTI=; fh=zqSmMFVgC+INx5iagDKvCQSPioGIfVB2/0bEftXy+nY=; b=Fc47z+jL1Ee8hf0CL97yS0G+60XOD7FB3Snjfctg+ZT9QttLu5R5vPrXTx25irUx/l YTX0vgzRKxCU9Nc1LSptNyZTcaeq93zB+jh8SmT1BkAvqv5EZqEMiuZkw+otR+n0leF5 3E/LkkeC4N3SBPi4JqMx/n67TJWX4RQxSM5mULFCO2cBSN1QuCauWF2Bz9VIglYD6gzI ZceLeZjYw82p4kX0S8Oz1e/BqVYhOJYIVO8YvxTzFjSjt6j+Sjd+Smpkr4X24duQEc1j EWbZrk/Nv7wjQIyFoB7zuAWEKep3N06uf1tx5lXg05tY5jSLbWyRVz40x6Njgci6dRBi T3Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EnBLlceT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id h16-20020a656390000000b005c677224c9csi6550128pgv.621.2023.12.11.12.48.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 12:48:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EnBLlceT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 25C9D8073292; Mon, 11 Dec 2023 12:48:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344816AbjLKUrv (ORCPT + 99 others); Mon, 11 Dec 2023 15:47:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344409AbjLKUru (ORCPT ); Mon, 11 Dec 2023 15:47:50 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9731DB5 for ; Mon, 11 Dec 2023 12:47:56 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3332e351670so4524339f8f.0 for ; Mon, 11 Dec 2023 12:47:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702327675; x=1702932475; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FNFFKTdQ4QRGU3jiDsgZw6qRsjpUS+kZ+xjPJ/qMrTI=; b=EnBLlceTcSSyp37RP4ztHPHpitRX0yRJR5QhD3ot4GsLp+g+f/8eNOOeswU1ZSKGDZ piCx9vSg4FtLvebqSTp/N9SczyhTK69RfXM+8ksmJaGy/cvm7rEEN8YG/37/3B3Y+XSU TUl/QBtllRecfzYUi1AVR5KfmMedrdn1TEha/0pSa6ucKPvl42jxqF/nOWRa9RwawmTf gfPSxJJQ8l1X6VbuzYuN2C9FbEC7NX1f7+I5QdzDsnQQrfC6vBv4le3SbnKovWfupGqh jt6/UqNifdK/wgP/OG4efIotAD88WxVJbLvmA8ysXUbVe7ZCw0rCZTg4/3uhl0gYOA6+ 7AMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702327675; x=1702932475; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FNFFKTdQ4QRGU3jiDsgZw6qRsjpUS+kZ+xjPJ/qMrTI=; b=dedNdDwwycEedILgCAwMkOQETvGDGqyLQQ6y95V1IrQ0TesAKwuy/AQD3pQQoSxGww ohtTbkKSr/FY+wGpEEE8Tq+z4QoNOnALjV45FdQ3gtGABU5wV8fMKhPaovOQucVqpOeA wDbo5VmoCjqK+kCE4mp6H+Js7Ef+sNZlMc8JCKAaCGaGlrDV6RSfteyH+kl2ZZb2pz97 2xnIMSZYi3kkYwPPlDDGOBFb/QTqXafqafwM62hBMAqkkVsfK2PXqdWhovDVvGb5Fh5R 0pObBYAZzwxSxvawIDHGsGLs9SGCyPorPx6UMaDNSmjcUfOh5EpX3tENMPBbDYwyf2ec iskQ== X-Gm-Message-State: AOJu0YwCx9M4bF0GZYHMGyhBMUWyI7jBW/7Bz/Qaw6Wt2mEHw3J0cciY kxounPfZiEqqe1I4D07UpCOSs23TBKxm5BTjbmyu1w== X-Received: by 2002:a5d:604d:0:b0:333:2fd2:7692 with SMTP id j13-20020a5d604d000000b003332fd27692mr435092wrt.131.1702327674923; Mon, 11 Dec 2023 12:47:54 -0800 (PST) MIME-Version: 1.0 References: <20231205-libstringheader-v1-1-7f9c573053a7@gmail.com> <20231205130449.8e330a26ecbed1f7b5ad5d7a@linux-foundation.org> <20231205132452.418722bea8f6878dca88142a@linux-foundation.org> <20231205214359.GF1674809@ZenIV> In-Reply-To: <20231205214359.GF1674809@ZenIV> From: Nick Desaulniers Date: Mon, 11 Dec 2023 12:47:39 -0800 Message-ID: Subject: Re: [PATCH] lib/string: shrink lib/string.i via IWYU To: Al Viro , Greg KH Cc: Andrew Morton , tanzirh@google.com, Kees Cook , Andy Shevchenko , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Mon, 11 Dec 2023 12:48:11 -0800 (PST) On Tue, Dec 5, 2023 at 1:44=E2=80=AFPM Al Viro wr= ote: > > On Tue, Dec 05, 2023 at 01:39:47PM -0800, Nick Desaulniers wrote: > > > The tooling Tanzir is working on does wrap IWYU, and does support such > > mapping (of 'low level' to 'high level' headers; more so, if it > > recommends X you can override to suggest Y instead). > > > > arch/nios/ also doesn't provide a bug.h, which this patch is > > suggesting we include directly. I guess the same goes for > > asm/rwonce.h. > > See include/asm-generic/Kbuild: > mandatory-y +=3D bug.h > ... > mandatory-y +=3D rwonce.h > > IOW, sh will have asm/bug.h and as/rwonce.h copied from asm-generic. > > Still, includes of asm/*.h had been a massive headache historically > and breeding more of those shouldn't be overdone. > > More painful problem is arch- and config-dependent stuff, though... Ah, it looks like include/uapi/asm-generic/Kbuild also makes use of this pattern using mandatory-y. So I think we can handle this as a two step translation. We can tell the tooling to 'nevermind recommending X, always replace recommendations for X with Y ', so: 1. any recommendation to use asm-generic/foo.h should be replaced with asm/foo.h (always, based on those 2 Kbuild files, could autogenerate) 2. some recommendations to use asm/foo.h should be replaced with linux/foo.h (not necessarily codified anywhere; depends on if there is a linux/foo.h, will manually curate this list for now) Orthogonal but some places in tree can be cleaned up to include linux/foo.h rather than asm/foo.h. Does this sound like an improvement to my mental model of the conventions used for kernel header inclusion within the linux kernel? Tanzir nearly has the above done (for 1, 2 we will probably need to iterate on more). We've also beefed up our local testing to test more architectures. I expect Tanzir to send a v2 of this patch (as a series, with the fix for ARCH=3Dsh) later this week, if the above seems correct. --=20 Thanks, ~Nick Desaulniers