From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 9F0283858D28 for ; Mon, 4 Mar 2024 19:36:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F0283858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9F0283858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709580970; cv=none; b=GEP/R8ucwkelvD0O+6HM4bjaaQSO/FtUhEYAVt86VKBHuwGFH3F6rQdwyAYXTeiwWK6dC0swhBeibPojAtRyP+zg/ilHBanlobOD8fUo8OO5OpZIb41itT0rfcJRtCGmH2iD6utWRc7Z0P8AV5sdyCOO5rhsRjKGdO42VhwJ5D8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709580970; c=relaxed/simple; bh=3qp3hDaMmE7QKjLaCPzA1N3q4IU+S1g47pWBB6jVgik=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=MuRcPsJa1E5uUdYsFArIFt7oBWGuLex39IPoT5nyKNd+iSb3nHYjZXp8sPpERlZE2tTE09JNZe8MBQnh5mf9BMCeJi8TqgFbiliTLz+pNQ1a8RIZERFiAnzTEQBKk07V1/dP5Aym05ck1tkXnEfBPgIScfIeABMY+Jb580NID3E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-513173e8191so5951102e87.1 for ; Mon, 04 Mar 2024 11:36:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1709580966; x=1710185766; darn=sourceware.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=0MWjDlBE02g+1jrCXHR7gs/KROCJoJMweCjJmqSZb7A=; b=Q3v9nxX1y03UxqHxVxMfRlQMdzR2tB2vrmjSdQ2HHK14NsmLNk7TFVLCE6FMMqTb3+ JFGj2umXwc/ag8jn6VPnuH+oXt4wCrGzDoaW9rvZFWzdgBJEGTkTHhDpt0qRslhp2Oxh d/4Sg1sCVEbgn8SpTmgvjHD2dqsVBCVzNVssVrxeXezPtjetSx+ttIBA/54RY5Izx7sr UCdZDFVFx1qH6RhMAS0LGLomx00xX7ZohkRAgVy8rpb/KLFRUf8Jl8tuRgT7jne0tOWN 5vamz6gETVjaWljoDYBD5ojzgaHFtoW3BDGiH+jyM9W6d5FgL3tIpwgF68Uog49YsHOA TPOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709580966; x=1710185766; 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=0MWjDlBE02g+1jrCXHR7gs/KROCJoJMweCjJmqSZb7A=; b=WA/03ypDGF9WAZqwo8xTTN387b17NTMxqZdR9MxJKj2t3iWcPGV3nHiK7P5wYL6c8W nLSZVeVMmqrUi3DcggfVBG7swVe3PU2BpouWvM85mHNM4QY9y7+mMq88lgc3BBlWri+w UmcTVuerny2CWcoNcJxc/Lf9mZWyeoDaiQ9S45qG6i0HcWA7XUIoFfqK11ug54zL7Ilq FwN4zj9LuzOxXOuj0ZIH4aBXuLX7s4hTB9uLRP/gMocr5PC3Gy1sch2L9YoC+Ak+Xbwj cdcqb/7DV0gB/FszGpHEDA1zCzoyg69eKy4aBAMQdACtxuecK5u/PFsx2KZ6c7yoCG8n wYcA== X-Gm-Message-State: AOJu0Yxtk+Kr4CFzhwzS6Xa4qmYvhswvN7XraECrcu0JT6L7v+ZTRJ0v ENuTbwkoy6scILOv0tKjQS5T3+BuE1qG1oupU1LVYJHw49pj5YdIVKxGGHO5nqTFrYoKN2zMyJn x3o46GLonqu1+MND5YCWU9CToAl7OmtKL6Tf2Tnjrua7J3uT9 X-Google-Smtp-Source: AGHT+IE072pWvVtJLsw5z3y9Sq8n/z4HFKnhgniBYmRLjL55xchdEDhbeO4+Onm6o5VQDhmjC5q22LNqyQYsUoUNbfA= X-Received: by 2002:a05:6512:539:b0:512:f59f:15d3 with SMTP id o25-20020a056512053900b00512f59f15d3mr6765012lfc.20.1709580965797; Mon, 04 Mar 2024 11:36:05 -0800 (PST) MIME-Version: 1.0 References: <20240227225644.724901-1-evan@rivosinc.com> <20240227225644.724901-8-evan@rivosinc.com> <87v864c49s.fsf@linux-m68k.org> In-Reply-To: From: Evan Green Date: Mon, 4 Mar 2024 11:35:29 -0800 Message-ID: Subject: Re: [PATCH v13 7/7] riscv: Add and use alignment-ignorant memcpy To: Adhemerval Zanella Netto Cc: libc-alpha@sourceware.org, vineetg@rivosinc.com, slewis@rivosinc.com, Florian Weimer , palmer@rivosinc.com, Andreas Schwab Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 Mon, Mar 4, 2024 at 10:30=E2=80=AFAM Adhemerval Zanella Netto wrote: > > > > On 02/03/24 07:33, Andreas Schwab wrote: > > On Feb 27 2024, Evan Green wrote: > > > >> For CPU implementations that can perform unaligned accesses with littl= e > >> or no performance penalty, create a memcpy implementation that does no= t > >> bother aligning buffers. It will use a block of integer registers, a > >> single integer register, and fall back to bytewise copy for the > >> remainder. > > > > How has that been tested? It causes memory corruption. > > > > The memcpy optimization has multiple issues: > > 1. The implementation is wrong: the chunk size calculation is wrong > leading to invalid memory access. > > 2. It adds ifunc supports as default, so --disable-multi-arch does > not work as expected for riscv. > > 3. It mixes Linux files (memcpy ifunc selection which requires the > vDSO/syscall mechanism) with generic support (the memcpy > optimization itself). > > 4. There is no __libc_ifunc_impl_list, which makes testing only > check the selected implementation instead of all supported > by the system. > > The 2., 3., and 4. are not really a problem since they came most likely > from code base inexperience. However, the 1. is *really* a red > flag since it means that you did not run a 'make check' to certify > no regressions were found. This is my bad. My testing for this series involved boot testing, plus some tests I had written specifically for this, as well as build-many-glibcs. Make check was not on my radar, and clearly should have been. Thanks for coming in with a quick fix. I'll take a look at what you've done and holler if I see any issues. -Evan