From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 81E533858D1E for ; Thu, 3 Aug 2023 17:50:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 81E533858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6877eb31261so899177b3a.1 for ; Thu, 03 Aug 2023 10:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691085037; x=1691689837; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Ivc7PoMydMGwP5qyohwKoN6sAqnRdycREBi4K531Vow=; b=O7aUH2vO/GvelVFsF9cBCfc81iOMBHjCUXUgtiXkFtJUObQ6F4KJscjaLGdKdmI/U4 psRH4VjOFFLzSJY1Rv2NkersD253W9oj0LGXRJMPYW+3wKlfJdMhhEamnciA9A7Kff0M jnlvstBtvD6O3i7JIBJz16217wt8gAZ85dfH7hCm+YqNOMjM66seUI78ku7lR8tmx0iL cjMpLWIflFCcVsmg1hBgJihX3sDT+0ZNvowRYRCjT8gCoqFJkQRCO/I/Sbtua+0qg+BS 4MwVCdjfFVolM9OOsTiQxh38fKgDNKSlcnFf6ZfUFCQU/vfclJFsewlW59Hf7uw1IJ6/ U8LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691085037; x=1691689837; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ivc7PoMydMGwP5qyohwKoN6sAqnRdycREBi4K531Vow=; b=PpitLGtHGKNrRzkigvIPZhTTXjZBw5LtlGILNNrkM7GyqPVNwnxbSE8H9AJQHDgOBk AYL3Oye1t2D5HHoh/oNvYg+9B3/V5nua+muwYFR7KB5EeOStFCGcq06n7SHTXWCcGGZz ufJJKttlj3whngK92DchgPdWtLKAh3Du++4m3kxVHvs1h/4rcQ7il5lZYxP6cfONoSlF GUhhVayAeBXkRkGQxqeUW2L+DSd3yIa+bjmB1IRxki0WdcQHIjIPYPImR2qtIo/xQ9Nk rlMFeT3HKZ4N6I+HfdzgD6lP7O/715LkK4z5VypQaRh70txOSWNPjWg4gWW0slKr+pb7 W8JA== X-Gm-Message-State: ABy/qLYdlUnSZidX7cmJjYpxk1jaDEBJZo/zf4oNqVCm2dO+OjB0LDX6 MgTvopaRWWudiC38rnmPlFTg6Q== X-Google-Smtp-Source: APBJJlG4wqggCQwC6y6xQpYlQwYn2qZq+/4YdCdHX+BR8cyyL5S/WJ2CT3ZHiyRZAlhJgUb09eEOYg== X-Received: by 2002:a05:6a20:3cb:b0:13b:9a09:674b with SMTP id 11-20020a056a2003cb00b0013b9a09674bmr16186564pzu.36.1691085037432; Thu, 03 Aug 2023 10:50:37 -0700 (PDT) Received: from [192.168.0.4] ([71.212.144.105]) by smtp.gmail.com with ESMTPSA id h5-20020aa786c5000000b00682ed27f99dsm142370pfo.46.2023.08.03.10.50.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Aug 2023 10:50:37 -0700 (PDT) Message-ID: <6f0911c6-b24b-444c-4b4b-a62e49a51734@linaro.org> Date: Thu, 3 Aug 2023 10:50:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v6 5/5] riscv: Add and use alignment-ignorant memcpy Content-Language: en-US To: Florian Weimer , Evan Green Cc: libc-alpha@sourceware.org, slewis@rivosinc.com, palmer@rivosinc.com, vineetg@rivosinc.com References: <20230802155903.2552780-1-evan@rivosinc.com> <20230802155903.2552780-6-evan@rivosinc.com> <87il9w37vi.fsf@oldenburg.str.redhat.com> From: Richard Henderson In-Reply-To: <87il9w37vi.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 8/3/23 00:25, Florian Weimer via Libc-alpha wrote: > * Evan Green: > >> +static inline __typeof (__redirect_memcpy) * >> +select_memcpy_ifunc (uint64_t dl_hwcap, __riscv_hwprobe_t hwprobe_func) >> +{ >> + INIT_ARCH (); >> + >> + struct riscv_hwprobe pair; >> + >> + pair.key = RISCV_HWPROBE_KEY_CPUPERF_0; >> + if (!hwprobe_func || hwprobe_func(&pair, 1, 0, NULL, 0) != 0) >> + return __memcpy_generic; >> + >> + if ((pair.key > 0) && >> + (pair.value & RISCV_HWPROBE_MISALIGNED_MASK) == >> + RISCV_HWPROBE_MISALIGNED_FAST) >> + return __memcpy_noalignment; >> + >> + return __memcpy_generic; >> +} > > In libc, you could call __riscv_hwprobe directly, so the additional > argument isn't needed after all. Outside libc something is required. An extra parameter to ifunc is surprising though, and clearly not ideal per the extra hoops above. I would hope for something with hidden visibility in libc_nonshared.a that could always be called directly. r~