From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by sourceware.org (Postfix) with ESMTPS id E81473858D37; Wed, 5 Oct 2022 17:11:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E81473858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=aurel32.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Content-Transfer-Encoding:From:Reply-To: Subject:Content-ID:Content-Description:X-Debbugs-Cc; bh=AIP1bFlMJzOVMO3g35hS5Gyb0t72rgTycFeQ8rb1QVY=; b=BcSB0QWBRJeFrcfvZwQX5xmBy/ 6jMskd0V2GtgtkXEahcHa8AV/06qOMK5XI8lGd2vEwh6N0f7FXDtRucM/9gfJY8SgeKFxKz38mcuw 4lpC90scjGbIz05zOsaXAxy1vCcjkBRuGao1JCXGx8/IEP7Fjy02hqG495buYxmeVhCi62pzgk8Jm yAmJV/zdHk7PaclhVnc6nizgQsxTPw3YoJmmJoFnNqzdzLoERoeav01V0OYfO3W5phUWjMlUAxxiD NB0xwDHFGMUbtBXog9mgTYjjcL9AWrxwhPJDwUvCbp8lMInhxdMtno6D1Gt/U2tLxjHAolCzalqqo Eg+i4whQ==; Received: from [2a01:e34:ec5d:a741:8a4c:7c4e:dc4c:1787] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1og7vx-00024L-5u; Wed, 05 Oct 2022 19:11:49 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.96) (envelope-from ) id 1og7vw-00BFAC-2E; Wed, 05 Oct 2022 19:11:48 +0200 Date: Wed, 5 Oct 2022 19:11:48 +0200 From: Aurelien Jarno To: Sunil Pandey Cc: Noah Goldstein , Libc-stable Mailing List , Hongjiu Lu , GNU C Library Subject: Re: [PATCH v5 2/2] x86: Optimize strlen-avx2.S Message-ID: Mail-Followup-To: Sunil Pandey , Noah Goldstein , Libc-stable Mailing List , Hongjiu Lu , GNU C Library References: <20210419233607.916848-1-goldstein.w.n@gmail.com> <20210419233607.916848-2-goldstein.w.n@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.7 (2022-08-07) X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-10-04 18:10, Sunil Pandey via Libc-alpha wrote: > On Tue, Oct 4, 2022 at 2:20 PM Aurelien Jarno wrote: > > > > On 2022-09-28 06:54, Sunil Pandey via Libc-stable wrote: > > > Attached patch fixes BZ# 29611. > > > > > > I would like to backport it to 2.32,2.31,2.30,2.29 and 2.29. Let me know > > > if there is any objection. > > > > Sorry to be late on this. I have a few comments about that patch: > > > > > From 86e1d88e1a3c126597ef39165275ada7564cfce9 Mon Sep 17 00:00:00 2001 > > > From: "H.J. Lu" > > > Date: Mon, 19 Apr 2021 10:45:07 -0700 > > > Subject: [PATCH] x86-64: Require BMI2 for strchr-avx2.S > > > > > > Since strchr-avx2.S updated by > > > > > > commit 1f745ecc2109890886b161d4791e1406fdfc29b8 > > > Author: noah > > > Date: Wed Feb 3 00:38:59 2021 -0500 > > > > > > x86-64: Refactor and improve performance of strchr-avx2.S > > > > > > uses sarx: > > > > > > c4 e2 72 f7 c0 sarx %ecx,%eax,%eax > > > > > > for strchr-avx2 family functions, require BMI2 in ifunc-impl-list.c and > > > ifunc-avx2.h. > > > > > > (cherry picked from commit 83c5b368226c34a2f0a5287df40fc290b2b34359) > > > --- > > > sysdeps/x86_64/multiarch/ifunc-avx2.h | 4 ++-- > > > sysdeps/x86_64/multiarch/ifunc-impl-list.c | 12 +++++++++--- > > > 2 files changed, 11 insertions(+), 5 deletions(-) > > > > First of all 1f745ecc2109890886b161d4791e1406fdfc29b8 never got > > backported to 2.32 and older branches, and strchr-avx2.S in those > > branches do not use BMI2 instructions. So it doesn't make sense to > > backport it. > > > > That said the change in ifunc-avx2.h fixes: > > > > - memchr and rawmemchr, broken by the backport of acfd088a1963 ("x86: > > Optimize memchr-avx2.S") > > - strlen and strnlen, broken by the backport of aaa23c350715 ("x86: > > Optimize strlen-avx2.S") > > > > So the issues are fixed, but mostly by chance. > > How do you know it is a "by chance" fix, do you have any evidence to back > your claim? My point is that the commit that has been backported is fixing a bug that doesn't exist in 2.32 branches. strchr-avx2.S does not the sarx instruction as the commit claims, and does not use other BMI2 instructions either. However following the backport of commit acfd088a1963 and aaa23c350715 in these branches, memchr-avx2.S and strlen-avx2.S use BMI2 instructions, and as they use ifunc-avx2.h, this actually fixes the bug. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net