Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2704763rwb; Fri, 9 Dec 2022 05:31:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf7NcKfsXlTCubI5x9TtCmRljyWown5aHb/4cgw0EHOIlFYqnFlC9xxGS5IX0yDDyScO/zgV X-Received: by 2002:a05:6402:10c3:b0:462:9baa:e3b6 with SMTP id p3-20020a05640210c300b004629baae3b6mr5281713edu.29.1670592665298; Fri, 09 Dec 2022 05:31:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670592665; cv=none; d=google.com; s=arc-20160816; b=jgHbuht4TqjhYsfVoyW2/YBQ0/ZzRWrfvKFCDJ7q8M98DZq/IwKhkX7PmRYjgfrBZH Wq3mDbwjm9aLyvUQ5kATpV6GgY7UHZJhisTuANvnVR4dGQwtvd08VHuv0ka6SEGWP2BU eXSM4EieW9A4L7lM4OjQh/jCu/83q+pnMEscM57HjLTauKXFz51xVhV4ynh6I+k99a7y GKp9ODdT+tWcasS2X668Qd+JxFOKkLj+STDSdxgYcOaTYW6qqbzcGAX3i0Xd3bD806ii m5rtDqNazq1Dpe6EgHI+QAhwKFk+dOl/y2Bnfuq8C0tyrBHmvkL+kqgd9fNNwqYV6Ui9 ELig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=igBuNDpaHFuZEiBvHZ2c4/iSakohbRrwsz40HKIGNEA=; b=foZaYkfosmkqDxI7d4eo92bQpGPAYdilivUZVjtvMc2OktItNETi3dhBmN4GuQtCvz NSjSdczi1aKpwS7KeB7uJcZi78gNBfS4G9TEqnq+/+Y484NHERz4UD8h8/zzKMWmO9Gi iQKgYq5j2JHHq45IOFipLAwN6He5gfPuBkEPzM7V/RVDPHKC4z/CvTW+/LLcohSrhwPh WeX5H191u207qwlKtCdm1hlnPa5KeUWgb5//zuR9J8OXlv0AiJrcH7XycKTPkFynE/Mr lRTBHUimbNJVs61WoYaw90ONpFQ9GnbPZ8IDUrktqLnNBFdKMz8vh5C1Q99GlEZKivnD 7s0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bluespec-com.20210112.gappssmtp.com header.s=20210112 header.b=yZZBXbZx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r5-20020a170906a20500b007919f213511si896059ejy.951.2022.12.09.05.30.46; Fri, 09 Dec 2022 05:31:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bluespec-com.20210112.gappssmtp.com header.s=20210112 header.b=yZZBXbZx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbiLIMm7 (ORCPT + 75 others); Fri, 9 Dec 2022 07:42:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbiLIMm5 (ORCPT ); Fri, 9 Dec 2022 07:42:57 -0500 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20D251AF0E for ; Fri, 9 Dec 2022 04:42:56 -0800 (PST) Received: by mail-qt1-x82b.google.com with SMTP id j16so3438607qtv.4 for ; Fri, 09 Dec 2022 04:42:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bluespec-com.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=igBuNDpaHFuZEiBvHZ2c4/iSakohbRrwsz40HKIGNEA=; b=yZZBXbZxeZz5QZrL1Dt+BF4rJDeHdP6+MsHJiU+Jq7Kgdyhns9NGtYv82PhDfAB5b7 o1L1h5aCpY6Kl6QWL5vQUcDCBzfj9Wv7dpj+GqW3+EM4r13+uqoo5EhpmjM41VVfTWho pQs/OiHYUdfi6exiEnxhQ1ME/h85omQJeRUbPtJQPcPPNOJRnbLd3XCd0/2j4scAEaPN 8VMihd4/sNJpfFNVvZAEawyEKh/iTRPJqXqZhI7vpH6TK6dNctKCYl1nwcTNgN4fQ+Rt bvAgeXk2H5aIRUyOLZogd6PkidHEshj2c6Hzk7glLWx2Q9lBUZIJCnyPGnlwef5IgeOW xshg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=igBuNDpaHFuZEiBvHZ2c4/iSakohbRrwsz40HKIGNEA=; b=LVj9iNfVXAIFG7Ar6ZKA//GZAxJ3Yz0MuaYYAVmCHdNvMlxvWVG3TgeqUInSeooA+u SOy/XP6yNCKrB7Kyf5jUki9urfu9oB+MciYboA8OJUzF9uWksfh+e3MrxBo5Jq9DUJ4X 5R0K8pZgBt9AA5ugqimTIl2K+NLFz4Dd4WUfRULw/Mmv0LINnHsRcaeOM8u9b3DgGHcD UGja3Sxa1/4NiRZUEVqPMKAlMZXESSLWY72exxTljERqyeTExcb0uPJ6+s5Sqc+yXzCg ln1ySZT1w9asGNLDZcKFDrI1liFQVVk2Y0Q+/BOhap9vUUIoYTeHr4apiP/KSDfeI0Pi LK+A== X-Gm-Message-State: ANoB5pm47E/myEi7wOGpC5b4n49/fzjS2GsfQfhN6oZIApbCfhRh4t2n Yda28t143sUOXm3MMrw6VEIY X-Received: by 2002:ac8:745:0:b0:3a8:325:47e with SMTP id k5-20020ac80745000000b003a80325047emr3161524qth.54.1670589775249; Fri, 09 Dec 2022 04:42:55 -0800 (PST) Received: from bruce.bluespec.com ([38.70.11.69]) by smtp.gmail.com with ESMTPSA id bp13-20020a05620a458d00b006fa16fe93bbsm1051872qkb.15.2022.12.09.04.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 04:42:54 -0800 (PST) Date: Fri, 9 Dec 2022 07:42:52 -0500 From: Darius Rad To: Florian Weimer Cc: Andrew Waterman , Palmer Dabbelt , Vineet Gupta , stillson@rivosinc.com, Paul Walmsley , anup@brainfault.org, atishp@atishpatra.org, guoren@kernel.org, Conor Dooley , greentime.hu@sifive.com, vincent.chen@sifive.com, andy.chiu@sifive.com, arnd@kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, bjorn@kernel.org, libc-alpha@sourceware.org, christoph.muellner@vrull.eu, Aaron Durbin , linux@rivosinc.com Subject: Re: RISCV Vector unit disabled by default for new task (was Re: [PATCH v12 17/17] riscv: prctl to enable vector commands) Message-ID: Mail-Followup-To: Florian Weimer , Andrew Waterman , Palmer Dabbelt , Vineet Gupta , stillson@rivosinc.com, Paul Walmsley , anup@brainfault.org, atishp@atishpatra.org, guoren@kernel.org, Conor Dooley , greentime.hu@sifive.com, vincent.chen@sifive.com, andy.chiu@sifive.com, arnd@kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, bjorn@kernel.org, libc-alpha@sourceware.org, christoph.muellner@vrull.eu, Aaron Durbin , linux@rivosinc.com References: <877cz0nbce.fsf@oldenburg.str.redhat.com> <874ju4lpum.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <874ju4lpum.fsf@oldenburg.str.redhat.com> X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 09, 2022 at 01:32:33PM +0100, Florian Weimer via Libc-alpha wrote: > * Darius Rad: > > > On Fri, Dec 09, 2022 at 11:02:57AM +0100, Florian Weimer wrote: > >> * Andrew Waterman: > >> > >> > This suggests that ld.so, early-stage libc, or possibly both will need > >> > to make this prctl() call, perhaps by parsing the ELF headers of the > >> > binary and each library to determine if the V extension is used. > >> > >> If the string functions use the V extension, it will be enabled > >> unconditionally. So I don't see why it's okay for libc to trigger this > >> alleged UAPI change, when the kernel can't do it by default. > >> > > > > Because the call to enable can fail and userspace needs to deal with that. > > Failure is usually indicated by an AT_HWCAP or AT_HWCAP2 bit remaining > zero, or perhaps a special CPU register (although that is more unusual). That would indicate that the extension is not present, which is one of, but not the only way it can fail. The vector extension relies on dynamically allocated memory in the kernel, which can fail. It also provides the opportunity for the kernel to deny access to the vector extension, perhaps due to administrative policy or other future mechanism. // darius