From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 BADBA38A9B0 for ; Wed, 14 Jan 2026 10:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768385442; cv=none; b=YJEJgT7APN54eRPKxxYELYbLeAhP5qTZWdZOTTWPcmXW8N5GOHBU/0AqMBXnW3nB5torD95nBGOWdvZLxHqdP83HSnnJXPENbc6V49QBcz6cJXkQ7JMu55zkqTFHRQ5VyUYTCNRX2KyujwQ4BiDQHMpQ8Fuyz24C/nZjJc6SzLc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768385442; c=relaxed/simple; bh=37u8gz2/tHxNUHRPxYBUO17B44+GEZ+fwxYbHUNfsKs=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qpuLZZf1YvOrhbVzfQGPqlocRRSajoDqYevUQLjlW21AEPrn3PoR9WBHVzTxBSYY/Zsz3ukIOipx6YUpm2Zu+dgUQVL/at8e00e+mHO3UgVPFTPTNGhGv1MafBYkn9O3Or7gO6yD8J2JgB826CkFz72haMO9zl8jXqVePkJShxE= 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=h8SDWhGJ; arc=none smtp.client-ip=209.85.128.49 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="h8SDWhGJ" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-477619f8ae5so63212085e9.3 for ; Wed, 14 Jan 2026 02:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768385436; x=1768990236; 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=iTsZYQGV8ojRPa+c6PpWwRS4BhgS2Cix60DMHYVltjQ=; b=h8SDWhGJlJKZHr75rEAxI14sQt1A+PkfRMww8rQzFBpOhG34kVC8hR+QMvkMOn24I+ R2alifFRUjNRui2BKA/CGX2pKAVPrp/t0C6Z140OrMbtqTg+I9HbBi6ErCZpfpaw9Lzv e/b6KHHyXVt1HYY9RnQYB474SZC5B30Lw06zPlsz1GEwXWW89m7YwxYiGsLmznggVOg0 G5/yAcZlUqXGurVarm/lwn+TcGSfsdKF5A96e108iFNhgSFKktC2F60O/uVShGgQxLXH kDymM8GM0NBbuBgYkwLDsL/U2SAKpTNIZZ6XPvsBDi8QKyymv5SCYJz7ppIOVcINOMai eKIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768385436; x=1768990236; 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=iTsZYQGV8ojRPa+c6PpWwRS4BhgS2Cix60DMHYVltjQ=; b=YtAD4cAr6afp3zQP+iEqoNDHfeLFJ4PcbiDwqL8VM4FDMZx500lBp+QTYCf3IZ4M8r hrTPqhjKy/gk+D5eWFgweZDX1vhiKrJE9xE+CD0XTEWzUE6opkZqwMKWFN0Htp7eOJef iURBws2QLqEjvt+fvn3rpJMVBDadadaTFzhoC9c+aH19jLb1LAyfNIUJuQqUPWBYK7jE BK/Nie+ymvfUYu1gwrOQG/9KKdLSzlTabSyzaz0obtgtslGXwPGGGO+Qm0YH962nPtiB VUcDHwcbS9cyi+KvUWXc0mCpj3KNcs/6QPaZoRJqNS0SIl56fw2UMJEc7ZI4KyCylQJS +OmQ== X-Forwarded-Encrypted: i=1; AJvYcCU7XwtRLNiuLjsEAiPSsVo8zW/e4/HnMAldd9aJcoGu8SZqTquuGfE1VuAqWplr5Kqbbx4+r2myCOJ1t2o=@vger.kernel.org X-Gm-Message-State: AOJu0YynbqGmNynsxGbHwgKH3lEFe+hUsG8VlGwEjSPlF6qj2IDdeks2 DUj8nHvcGvZJdYT5kU7rjmJuaxX5kSg1wW83BDV6bDZeGdAP6r5zC5d8 X-Gm-Gg: AY/fxX6I2Vn/wRHB2Em7RSPOiCFCkeOGMIGiWcUCwYNfsJqR78HDGUjlCiRK5QPb9yN PYbRLF6/ORPZ+ZQe0EO8jYgrBVk5X0sWKYAWPpts0NaTscaqA209jZrbaiTiKC2VTkmyAU2kCLh Y9o/+0k+a/SpNHNIyafYNB0aAcOP6A7pFFE8XKEb24UVv3m8JSpskPgRQ60ALUHKYjVEOECNQSo YoTnEZ+7CNkA+WAR5Qm8RrGszx4JxPZIjTypBOU4d2m+hyiO8LD6VoDJoDL8H3ZotPj8ni6KGE3 TJZ20i7qyYGq2XcvyHFyKkpWm96kKc8bInO3sFRLL3jurrUNS3sb+yJPndWEQuJmtR0aqwNJd3C tAqto27QlvAe85IvsQyN4By+0/xC2hZbn3Ed/7kFkUpq91cVpl0FZU6vRAqVWwHuYaXWbqPJPdE lbxdL858/ESW6PjiMBb6RytkI6P7I+EVcgD5NPyp7iWuFQsPg5pNA0 X-Received: by 2002:a05:600c:1395:b0:47d:4fbe:e6d2 with SMTP id 5b1f17b1804b1-47ee334407fmr21631815e9.12.1768385435670; Wed, 14 Jan 2026 02:10:35 -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-47ee57fe917sm20267895e9.10.2026.01.14.02.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 02:10:35 -0800 (PST) Date: Wed, 14 Jan 2026 10:10:34 +0000 From: David Laight To: Eric Biggers Cc: Feng Jiang , pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, kees@kernel.org, andy@kernel.org, akpm@linux-foundation.org, martin.petersen@oracle.com, ardb@kernel.org, ajones@ventanamicro.com, conor.dooley@microchip.com, samuel.holland@sifive.com, linus.walleij@linaro.org, nathan@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2 01/14] lib/string: extract generic strlen() into __generic_strlen() Message-ID: <20260114101034.7961852a@pumpkin> In-Reply-To: <20260114000151.GB2178@quark> References: <20260113082748.250916-1-jiangfeng@kylinos.cn> <20260113082748.250916-2-jiangfeng@kylinos.cn> <20260114000151.GB2178@quark> 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 Tue, 13 Jan 2026 16:01:51 -0800 Eric Biggers wrote: .. > A similar problem exists with the architecture-optimized CRC and crypto > functions. Historically, these subsystems exported both generic and > architecture-optimized functions. > > We've actually been moving away from that design to simplify things. > For example, for CRC-32C there's now just the crc32c() function which > delegates to the "best" CRC-32C implementation, with no direct access to > the generic implementation of CRC-32C. > > crc_kunit then just tests and benchmarks crc32c(). To check how the > performance of crc32c() changes when its implementation changes (whether > the change is the addition of an arch-optimized implementation or a > change in an existing arch-optimized implementation), the developer just > needs to run crc_kunit with two kernels, before and after. For the mul_div tests I arranged that the test code could #include the source for the generic implementation so it could run that as well as the version compiled into the main kernel. This involved wrapping the function in: #if !defined(function) || defined(test_function) type function(args) ... } #if !defined(function) EXPORT_SYMBOL(function) #endif #endif So the test code can use: #define function generic_function #define test_function #include "function.c" to get a private copy of the generic code. David