From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id AE5FC386F439 for ; Mon, 15 Jun 2020 22:03:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AE5FC386F439 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05FM1YKQ029202 for ; Mon, 15 Jun 2020 18:03:45 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 31mx4pkkxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 15 Jun 2020 18:03:45 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 05FM2eYQ033355 for ; Mon, 15 Jun 2020 18:03:45 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 31mx4pkkxm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Jun 2020 18:03:44 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05FLslu0025121; Mon, 15 Jun 2020 22:03:44 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma04dal.us.ibm.com with ESMTP id 31mpe92my7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Jun 2020 22:03:44 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05FM3eeR29360540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Jun 2020 22:03:40 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 748986A057; Mon, 15 Jun 2020 22:03:42 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B63EC6A04D; Mon, 15 Jun 2020 22:03:41 +0000 (GMT) Received: from oc3272150783.ibm.com (unknown [9.65.203.107]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTPS; Mon, 15 Jun 2020 22:03:41 +0000 (GMT) Date: Mon, 15 Jun 2020 17:03:39 -0500 From: "Paul A. Clarke" To: "H.J. Lu" Cc: GNU C Library , rzinsly@linux.ibm.com Subject: Re: [PATCH 1/4] strncmp: Add a testcase for page boundary [BZ #25933] Message-ID: <20200615220339.GB24739@oc3272150783.ibm.com> References: <20200612201056.228614-1-hjl.tools@gmail.com> <20200615202934.GA24739@oc3272150783.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-15_09:2020-06-15, 2020-06-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 suspectscore=2 impostorscore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 cotscore=-2147483648 spamscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006150154 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2020 22:03:47 -0000 On Mon, Jun 15, 2020 at 02:34:13PM -0700, H.J. Lu via Libc-alpha wrote: > On Mon, Jun 15, 2020 at 1:29 PM Paul A. Clarke wrote: > > > > On Fri, Jun 12, 2020 at 01:10:53PM -0700, H.J. Lu via Libc-alpha wrote: > > > Add a strncmp testcase to cover cases where one of strings ends on the > > > page boundary. > > > --- > > > string/test-strncmp.c | 25 +++++++++++++++++++++++++ > > > 1 file changed, 25 insertions(+) > > > > > > diff --git a/string/test-strncmp.c b/string/test-strncmp.c > > > index d961ac4493..d0928a2864 100644 > > > --- a/string/test-strncmp.c > > > +++ b/string/test-strncmp.c > > > @@ -403,6 +403,30 @@ check2 (void) > > > free (s2); > > > } > > > > > > +static void > > > +check3 (void) > > > +{ > > > + size_t size = 32 * 4; > > > + CHAR *s1 = (CHAR *) (buf1 + (BUF1PAGES - 1) * page_size); > > > + CHAR *s2 = (CHAR *) (buf2 + (BUF1PAGES - 1) * page_size); > > > + int exp_result; > > > + > > > + memset (s1, 'a', page_size); > > > + memset (s2, 'a', page_size); > > > + s1[(page_size / CHARBYTES) - 1] = (CHAR) 0; > > > + > > > + for (size_t s = 99; s <= size; s++) > > > + for (size_t s1a = 31; s1a < 32; s1a++) > > > + for (size_t s2a = 30; s2a < 32; s2a++) > > > + { > > > + CHAR *s1p = s1 + (page_size / CHARBYTES - s) - s1a; > > > + CHAR *s2p = s2 + (page_size / CHARBYTES - s) - s2a; > > > + exp_result = SIMPLE_STRNCMP (s1p, s2p, s); > > > + FOR_EACH_IMPL (impl, 0) > > > + check_result (impl, s1p, s2p, s, exp_result); > > > + } > > > +} > > > > There are lots of magic numbers here. > > > > Could you add some context around those number > > My commit log says > > --- > Add a strncmp testcase to cover cases where one of strings ends on the > page boundary. > --- Which says nothing about why you need to test over 90000 different cases of a string ending on a page boundary, nor what any of the magic numbers represent. > > If they are meant to reflect a cache line length, then it's > > No. My testcase is for correctness, not for performance. I made no reference to performance. > > appropriate to support different cache line sizes. > > Rafael Zinsly just did this with strncasecmp in the > > last week or so. PC