From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 5233E385843A for ; Wed, 6 Mar 2024 05:29:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5233E385843A 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 5233E385843A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709702943; cv=none; b=qukl0/fT1xqJwmddzuOhpQ3odDY0xi6xUlYCCNjX0DwCDkZP51NppKH1UzmKR+apXfn5bC6fNgVYDpGkPFLVQlr/1iWO+/w/Err2YEHp83l/wAAWtuJrOOgFBIDGPnP6cXKsM9twXynty7WWQb3tJ0ARGl6lapD5Kir4zLLb240= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709702943; c=relaxed/simple; bh=GtsCPvvtXuwu52vAakooqPxiaLF7uAC8kPfumKCWn94=; h=DKIM-Signature:Date:Subject:From:To:Message-ID:Mime-Version; b=oXpqvzfTmKKypcPonMMpK7oFliBUXfAuOCMGiJRv3Mc70nqehprUvF60WRxG3sVMJ+G5vIDDhzIqaUk/WqHV+wHdZIdjx0AFMZ7YAubTLmXI8+L4aR8BZCMscNARbDqhq543fjRgZxDVCfgCyXUzGLqr46ozw/pN6V1dRblDXC0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6e5dddd3b95so366885b3a.1 for ; Tue, 05 Mar 2024 21:29:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1709702940; x=1710307740; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=IxrkPkB7E/pCijRVg8gtRdZuZ6KPK9YWc5ooDAdLg2A=; b=pJZvpSQwt2PmniR0izxK7AIj6h+cylX7Xk1oi4fXMF66Jr1vNlP7SMJkiSNbfs87Th mCShZSwolA1JPY/G6/2e/P9lhisM7IKVwSxyTS4N/hyFZAq/ht0TbnZKxDbadhtuKmwV Jw4YOO6tCac+jh2yfaQvRN12OJN2EC6RWoWg/VBwsZ8yxy3ZUx2ZZmg/Xi5xr1hVDYMv iUt4i65twQZXeRMaeT2x04rEYG26lGuti7B1m3D0M2+XcQ7FAY9IAUpQq0y0bIkgDFXT zEIidgmtcm/3g332yIEkF0N4reCJ1q1gN16SyX3WJvvBwDphMs6/4DZ6OQDCv1dhHgi3 M0HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709702940; x=1710307740; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IxrkPkB7E/pCijRVg8gtRdZuZ6KPK9YWc5ooDAdLg2A=; b=Sn7UKHDMEjLXozT/dmiy9g1jGnuOb7rBZjaRRAVMtSpWAOtgfmTbCxN7uWe+2RkV4t oSrzi6+xNtMbCedVQmiApM1BDb0/9mn+G9kY2msSOAJYybNMsD8yVjtOm5CcAej/q6LY MVFmKFm7oeocqxY6gVhmRf0ZHRTrKKGgG2rG7OB1AU9RYuYGVZamibFkzZXSTqT0nkV0 JBEqqjOWDcrbPfOTsXZ13BDrCXZuWSnOW6QVWXnuWT0W9HkLBBWFoYShi+D1CtFhgdwv uEQM7xWmREHglkDLqAPP3GM05HTfaLYHWAJozaNYiLzgBx3OPuGHRS0uCfqt3XDvpptd BzPg== X-Forwarded-Encrypted: i=1; AJvYcCVttSMXW0suMmg8pBueRHiPQF9RmX/DEgD/Cw1l+Q1xFIn1ARWqhZMHSVnm2pq/Lea7Vk+vNoeIpP96F6zBJ8kash7o+p3Iz4eU X-Gm-Message-State: AOJu0Yxf9eNcTztnufefwhwGPBo9JWWR4x+PbTgBNRQb5DsgJ9hco5K3 2fNbYwotGRPcbHGm6Ug27N4izZLlQJayXdxPQtarbXZwycr4QIc+3tQTxscBzGd03ncE3BZdZju Q X-Google-Smtp-Source: AGHT+IEUtMT1Wc52b531zX31athV1PVYPD6KOqGA6JbSfdCQ0oVuVoHEWE10UAGdSPBpKqd6IaggXQ== X-Received: by 2002:a05:6a21:32a9:b0:19e:cbe9:63b with SMTP id yt41-20020a056a2132a900b0019ecbe9063bmr5670361pzb.3.1709702939942; Tue, 05 Mar 2024 21:28:59 -0800 (PST) Received: from localhost ([192.184.165.199]) by smtp.gmail.com with ESMTPSA id ka40-20020a056a0093a800b006e642effb1dsm1681473pfb.216.2024.03.05.21.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 21:28:59 -0800 (PST) Date: Tue, 05 Mar 2024 21:28:59 -0800 (PST) X-Google-Original-Date: Tue, 05 Mar 2024 21:28:57 PST (-0800) Subject: Re: [PATCH v2] riscv: Fix alignment-ignorant memcpy implementation In-Reply-To: CC: adhemerval.zanella@linaro.org, libc-alpha@sourceware.org, Vineet Gupta , slewis@rivosinc.com, schwab@linux-m68k.org From: Palmer Dabbelt To: Evan Green Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 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 Tue, 05 Mar 2024 11:30:18 PST (-0800), Evan Green wrote: > On Tue, Mar 5, 2024 at 9:03 AM Adhemerval Zanella > wrote: >> >> The memcpy optimization (commit 587a1290a1af7bee6db) has a series >> of mistakes: >> >> - The implementation is wrong: the chunk size calculation is wrong >> leading to invalid memory access. >> >> - It adds ifunc supports as default, so --disable-multi-arch does >> not work as expected for riscv. >> >> - It mixes Linux files (memcpy ifunc selection which requires the >> vDSO/syscall mechanism) with generic support (the memcpy >> optimization itself). >> >> - There is no __libc_ifunc_impl_list, which makes testing only >> check the selected implementation instead of all supported >> by the system. >> >> This patch also simplifies the required bits to enable ifunc: there >> is no need to memcopy.h; nor to add Linux-specific files. >> >> The __memcpy_noalignment tail handling now uses a branchless strategy >> similar to aarch64 (overlap 32-bits copies for sizes 4..7 and byte >> copies for size 1..3). >> >> Checked on riscv64 and riscv32 by explicitly enabling the function >> on __libc_ifunc_impl_list on qemu-system. >> >> Changes from v1: >> * Implement the memcpy in assembly to correctly handle RISCV >> strict-alignment. >> >> --- > > Thanks again for the quick fixup. Ya, and sorry we broke it. I'll make sure to run "make check" next time. > Reviewed-by: Evan Green > Acked-by: Palmer Dabbelt