Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1719074pxb; Thu, 28 Oct 2021 08:49:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxqGSZiicCe5eZhf99kuIq3Emw1pcujhY4AodDLgoCiMyfoZXlm9T/skR9Ww6TQBO3OGJU X-Received: by 2002:a63:1a0e:: with SMTP id a14mr3855829pga.195.1635436187444; Thu, 28 Oct 2021 08:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635436187; cv=none; d=google.com; s=arc-20160816; b=BAGIp3oH312l0/N9aglOiOCiauOCTACxQvK95zS0Ht+o/2PhH36rXTm33IBfEUPqx6 uoOdiFEJYcL+Og4lrBsJNlnBivOBdAGWd4lrt4z+7Dczo9eoY+7TtQQvyv3P2mW7E6ac EDMq8SI0gX1wKFeJxIK46aEllIyisoZq2VfvPnmWrNclwbC3DNgxw5dZ8eZoq4SiImEu vFE2ysIoE19/tRIEjfPTmwItBH6Cgy0FPm26QoSJoKYSdPecUcMtt8RKR7fdNyA8t8O5 4j49DQRphJNgAccr7j8lmE40EZkLumSe5DT+IcoxHpXe7bHVxt3qaAN4LXqgHc/Z/hHd 5CjQ== 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=I35xArwltgiSIDBXrA/Vf3yctOp3/8GeHcmmTTSQz2I=; b=gBCMwAONbWIspZlO6PInNV237xHzB9yK4wVbu2eAkm2iFktI1ZI1bF4dyWTcN54TUu Jhb3Vky51q58aCEVW1XTmSyUTIY3gwwE/ttk9lsYewBzw6PEej9tc9iTSfBVUJvVy7Nh sOLTcnb2Kdh7AQKvODrUHWTDDvQD++Y/PQR2SqIQlD9NP66N6/OxQOyAUMyAW+mXSCqJ vm8A6ai98wjqVUL+Bfoz+PfWLGCzKJpFpaorPn99VQ3PKoVMVIRZX6WNfbpy8BoJ/DzT Xuj/46CkOfwlBQOnosi964jbKsT0R22vvR6ndigmae0wBSQFgELcscmgpbEcQbi1m979 NmjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@usp.br header.s=usp-google header.b=XfsWYOjc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=usp.br Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l64si4201521pge.367.2021.10.28.08.49.28; Thu, 28 Oct 2021 08:49:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@usp.br header.s=usp-google header.b=XfsWYOjc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=usp.br Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230389AbhJ1Pti (ORCPT + 99 others); Thu, 28 Oct 2021 11:49:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbhJ1Ptf (ORCPT ); Thu, 28 Oct 2021 11:49:35 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7682C061745 for ; Thu, 28 Oct 2021 08:47:08 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id z20so26956707edc.13 for ; Thu, 28 Oct 2021 08:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp.br; s=usp-google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=I35xArwltgiSIDBXrA/Vf3yctOp3/8GeHcmmTTSQz2I=; b=XfsWYOjc3jrRehmYG0Ww3uMg7/yWXF7kuZrYyXaUUL7XiAeEbVX3Qyi6dkCVQfTmWI yr9KVWBc5It7BdCCSQNzzncW7tg8SHQalJMAscKcV+wBvjCg8v5KXRfSia/m/GGQT0nH Z+0C6x6X/inK4kBotlFaie/jSAT/wY/JZSxH+N6nTLRYMLuRdGjFf5Yjr9Fg8SV3Ds5X drMFUdAHXrIfV2e6A508fxgfKhZeBmVw2EFJPTPE6caqLt6vuUIBvO5BBaBvhbF4arMf B6ynfIcEisPd64XP+BwWWbQbJ3MB3mWHQr2/x4haqqbS4OlwnctRHSW5+aV9nSNSuSOo BzWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=I35xArwltgiSIDBXrA/Vf3yctOp3/8GeHcmmTTSQz2I=; b=kU092IvW1ykiUFxKoGuZKzf+J162H/t7frGXTAPBGasEBz1wR1UJa3ixq9l9z11LmA hClqPzygGyNegjBPdvFvfCsaWzWh917ovW19imvcfXbCEWQx9MR5qWkbTSyhffIgqndy v4ScTfKYAksxAf/CuDcWTrByioIzoD8MDKRLHHton/tH2I3ZBDgykYNtyYJZkX67gciX BolBdlYrCC/9Spw8fCci5pgn58GsZ4Og9GKpzljRx4w3fhUXYUDbjDN+rydMrncESgtx /mrTqZkp0ag5GZuNT/e1xXFMIH2O2x/N6sP0J6uIV1B6esTC8wp1242jHoDA7uQqoHge uDSA== X-Gm-Message-State: AOAM531FMPagKX6xj9VmON33m8FsYITB+ardTcYt921pq6OOXb3v4i6O MloLofbmyIttqX5mwhR2HxuYb2z7fSK75TJryq6Oew== X-Received: by 2002:a17:906:2a06:: with SMTP id j6mr6373148eje.401.1635436027126; Thu, 28 Oct 2021 08:47:07 -0700 (PDT) MIME-Version: 1.0 References: <20210926223322.848641-1-isabellabdoamaral@usp.br> <20210926223322.848641-2-isabellabdoamaral@usp.br> In-Reply-To: From: Isabella B do Amaral Date: Thu, 28 Oct 2021 12:46:55 -0300 Message-ID: Subject: Re: [PATCH v2 1/5] hash.h: remove unused define directive To: David Gow Cc: Geert Uytterhoeven , Enzo Ferreira , =?UTF-8?Q?Augusto_Dur=C3=A3es_Camargo?= , Brendan Higgins , Daniel Latypov , "open list:KERNEL SELFTEST FRAMEWORK" , Linux Kernel Mailing List , KUnit Development , ~lkcamp/patches@lists.sr.ht, Rodrigo Siqueira Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, David, On Sat, Oct 2, 2021 at 4:20 AM David Gow wrote: > > On Mon, Sep 27, 2021 at 6:33 AM Isabella Basso = wrote: > > > > Currently, there exist hash_32() and __hash_32() functions, which were > > introduced in a patch [1] targeting architecture specific optimizations= . > > These functions can be overridden on a per-architecture basis to achiev= e > > such optimizations. They must set their corresponding define directive > > (HAVE_ARCH_HASH_32 and HAVE_ARCH__HASH_32, respectively) so that header > > files can deal with these overrides properly. > > > > As the supported 32-bit architectures that have their own hash function > > implementation (i.e. m68k, Microblaze, H8/300, pa-risc) have only been > > making use of the (more general) __hash_32() function (which only lacks > > a right shift operation when compared to the hash_32() function), > > remove the define directive corresponding to the arch-specific hash_32(= ) > > implementation. > > > > [1] https://lore.kernel.org/lkml/20160525073311.5600.qmail@ns.scienceho= rizons.net/ > > > > Changes since v1: > > - As suggested by David Gow: > > 1. Reword commit message. > > Maybe move this changelog to below the "---", so it doesn't show up in > the final commit message? Oh, okay! Thanks for pointing that out :) I didn't quite know how I should put these. > > > > > Tested-by: David Gow > > Co-developed-by: Augusto Dur=C3=A3es Camargo > > Signed-off-by: Augusto Dur=C3=A3es Camargo > > Co-developed-by: Enzo Ferreira > > Signed-off-by: Enzo Ferreira > > Signed-off-by: Isabella Basso > > --- > > This looks sensible enough to me. Since no-one seems to be speaking up > in architecture-specific hash_32()'s defence, let's get rid of it. > > Reviewed-by: David Gow > Alright! Thanks for the review. Cheers, -- Isabella B. > > > include/linux/hash.h | 5 +---- > > lib/test_hash.c | 24 +----------------------- > > tools/include/linux/hash.h | 5 +---- > > 3 files changed, 3 insertions(+), 31 deletions(-) > > > > diff --git a/include/linux/hash.h b/include/linux/hash.h > > index ad6fa21d977b..38edaa08f862 100644 > > --- a/include/linux/hash.h > > +++ b/include/linux/hash.h > > @@ -62,10 +62,7 @@ static inline u32 __hash_32_generic(u32 val) > > return val * GOLDEN_RATIO_32; > > } > > > > -#ifndef HAVE_ARCH_HASH_32 > > -#define hash_32 hash_32_generic > > -#endif > > -static inline u32 hash_32_generic(u32 val, unsigned int bits) > > +static inline u32 hash_32(u32 val, unsigned int bits) > > { > > /* High bits are more random, so use them. */ > > return __hash_32(val) >> (32 - bits); > > diff --git a/lib/test_hash.c b/lib/test_hash.c > > index 0ee40b4a56dd..d4b0cfdb0377 100644 > > --- a/lib/test_hash.c > > +++ b/lib/test_hash.c > > @@ -94,22 +94,7 @@ test_int_hash(unsigned long long h64, u32 hash_or[2]= [33]) > > pr_err("hash_32(%#x, %d) =3D %#x > %#x", h0, k,= h1, m); > > return false; > > } > > -#ifdef HAVE_ARCH_HASH_32 > > - h2 =3D hash_32_generic(h0, k); > > -#if HAVE_ARCH_HASH_32 =3D=3D 1 > > - if (h1 !=3D h2) { > > - pr_err("hash_32(%#x, %d) =3D %#x !=3D hash_32_g= eneric() " > > - " =3D %#x", h0, k, h1, h2); > > - return false; > > - } > > -#else > > - if (h2 > m) { > > - pr_err("hash_32_generic(%#x, %d) =3D %#x > %#x"= , > > - h0, k, h1, m); > > - return false; > > - } > > -#endif > > -#endif > > + > > /* Test hash_64 */ > > hash_or[1][k] |=3D h1 =3D hash_64(h64, k); > > if (h1 > m) { > > @@ -227,13 +212,6 @@ test_hash_init(void) > > #else > > pr_info("__hash_32() has no arch implementation to test."); > > #endif > > -#ifdef HAVE_ARCH_HASH_32 > > -#if HAVE_ARCH_HASH_32 !=3D 1 > > - pr_info("hash_32() is arch-specific; not compared to generic.")= ; > > -#endif > > -#else > > - pr_info("hash_32() has no arch implementation to test."); > > -#endif > > #ifdef HAVE_ARCH_HASH_64 > > #if HAVE_ARCH_HASH_64 !=3D 1 > > pr_info("hash_64() is arch-specific; not compared to generic.")= ; > > diff --git a/tools/include/linux/hash.h b/tools/include/linux/hash.h > > index ad6fa21d977b..38edaa08f862 100644 > > --- a/tools/include/linux/hash.h > > +++ b/tools/include/linux/hash.h > > @@ -62,10 +62,7 @@ static inline u32 __hash_32_generic(u32 val) > > return val * GOLDEN_RATIO_32; > > } > > > > -#ifndef HAVE_ARCH_HASH_32 > > -#define hash_32 hash_32_generic > > -#endif > > -static inline u32 hash_32_generic(u32 val, unsigned int bits) > > +static inline u32 hash_32(u32 val, unsigned int bits) > > { > > /* High bits are more random, so use them. */ > > return __hash_32(val) >> (32 - bits); > > -- > > 2.33.0 > >