From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D77443858D33 for ; Tue, 7 Feb 2023 17:16:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D77443858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675790185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=Nofy4bnTSzYaOU2KErxEq+aB1CKUwoSlDQeAEFg9zVo=; b=ABI1jPNmOzvJzQY4FvuTP7XwHdbLpWBfryGRYAe6GZnSxCrCEHGot31EnI6NH9TDlKIL9H krh82Khr+7P9OuRjkkNa/cIB4JTXNdegVvkw72p3+1D1MwpQ8A//JFtk9QjM3+hEdFR858 v/GRVLDz33t798A7qrBetPwHE0l92wc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-266-WaKPo4f4MGGbeIK8pNXv8w-1; Tue, 07 Feb 2023 12:16:21 -0500 X-MC-Unique: WaKPo4f4MGGbeIK8pNXv8w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2F0C2A59568; Tue, 7 Feb 2023 17:16:20 +0000 (UTC) Received: from greed.delorie.com (unknown [10.22.8.52]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5CC240CF8EF; Tue, 7 Feb 2023 17:16:20 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.15.2/8.15.2) with ESMTP id 317HGKeJ344128; Tue, 7 Feb 2023 12:16:20 -0500 From: DJ Delorie To: Adhemerval Zanella Netto Cc: christoph.muellner@vrull.eu, libc-alpha@sourceware.org, palmer@dabbelt.com, darius@bluespec.com, andrew@sifive.com, vineetg@rivosinc.com, kito.cheng@sifive.com, jeffreyalaw@gmail.com, philipp.tomsich@vrull.eu, heiko.stuebner@vrull.eu Subject: Re: [RFC PATCH 00/19] riscv: ifunc support with optimized mem*/str*/cpu_relax routines In-Reply-To: Date: Tue, 07 Feb 2023 12:16:20 -0500 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,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: Adhemerval Zanella Netto writes: > So now we have 3 different proposal mechanism to provide implementation runtime > selection on riscv: > > 1. The sysdep mechanism to select optimized routines based on compiler/ABI > done at build time. It is the current mechanism and it is also used > on rvv routines [1]. > > 2. A ifunc one using a new riscv syscall to query the kernel the required > information. > > 3. Another ifunc one using riscv specific environment variable. I'm also going to oppose #3 on principles. We've been removing the use of environment variables for tuning, in favor of tunables. If we have a way to auto-detect the best implementation without relying on the user, that's my preference. Users are unreliable and require documentation. The compiler likely doesn't have access to the hardware[*], so must rely on the user. Thus, my preference is #2 - the kernel has access to the hardware and its device tree, and can tell the userspace what capabilities are available. I would not be opposed to a tunable that overrides the autodetection; we have something similar for x86. But the default (and should be) is "works basically correctly without user intervention". [*] you can run gcc on the "right" hardware, but typically we build-once-run-everywhere.