Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1269322lqe; Mon, 8 Apr 2024 04:20:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVB0ae3OSm5vM08XQ9yOBQZ2OVp+/QubyhnfkbCz8cNZklMFhSNczr/xcRD9LPcRgCJClqpw0XFTozMYtc4I/e6ICkzYdv/63x4VPAycQ== X-Google-Smtp-Source: AGHT+IHlLm6iA2XvsaoauNNNsCBAXkcrbBrGFA/zaOQKCHHSY1eoUvAA0TDhQIfKKx3IPI1eggll X-Received: by 2002:a05:6358:7a8:b0:186:1d2a:a457 with SMTP id n40-20020a05635807a800b001861d2aa457mr3629007rwj.15.1712575207049; Mon, 08 Apr 2024 04:20:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712575207; cv=pass; d=google.com; s=arc-20160816; b=fD6bVzJC2fKEAzN1NkH0/IwUJkEJTjfg4vGF1wBRlI1qin8vTVQwmnYO4mssMNLUrT j5UfKvN503MgTPVE0n6o5c/QAye+GNKzNAk/TiLGgl6F7zzwYLud46DEe00OtLXvS2Ch LIM8ZEzqiqSbmunz68/QIyCmELWuSmUZ1YqEVjSETEPmLBhBFQFioeek8Q4F94zeqqTL Vexu8y3Bkb8V0Q7yaLqTKpdJHcuXZRR91jjUwz7nhgTiT6rXe2UP2He6ozsDJVWULptT o0FoYV0TT3ZuF0mTNCLzGg3kvMN3eHR2L3+m9GDqVoYGA7hgBgreNNlumMGh4Go0GZ6/ f3gQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=WSk7g629HcnobUYtS9ld5wkokmcC8tpl1DGu7N0oFPU=; fh=oKpDupc704moY6zVX8K6V5NKZgz/y6xNz1jT/54luL4=; b=UrsMwmhCiy9g8kc1Vo/7TzaWjQVU+AOShl3HE+uhYDxGkrEejpAdq5TWJT5hxL7wZR HiCmt26OZwUIZ15VDoILzNsLX/CP82oY8q4ulA1rc6fENLUwUnRMcGO7jjp1tuzRlUrS 9m9mCeN9LUlUkf0kq+KQfsSo/ftxoPbdR+/yU9w3eA3A7O7rGbJ1WD30c/u0qe8/SnaA ZcvdEOuC6/+tSOW5lhp/GCuep//tuxgWlwSdQ9ES9dSm+hy66UiFPhEW+zZRvTlgfC5G /1XyPjUeFP8fnSoQtrKekk0Jqox77CyI/CfMvNBqNg791mFQlD3FjxR2msQqR323QO1X yUmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=j8zrpaIf; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-135258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135258-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e8-20020a63d948000000b005d8e2f778c7si6001610pgj.294.2024.04.08.04.20.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 04:20:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=j8zrpaIf; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-135258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135258-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A9F382822CA for ; Mon, 8 Apr 2024 11:20:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 652A869E07; Mon, 8 Apr 2024 11:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="j8zrpaIf" Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F85E657AF for ; Mon, 8 Apr 2024 11:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712575185; cv=none; b=LDUxYp730xLoogb9M/C/UvH6wJ86zbpFYG9g6NOUQSLf+J3Tl6e3hMG6jJ0kSLcXxLZvk4jZ6/9RYbK4lo5smO4JI700tzPxldeaYAYIDmKGnpYlcC6e70/Bf7q9lYrYHK2KXvNC9S6V4jXCuGLPOY73RoREEcAnqqM6iH1ihG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712575185; c=relaxed/simple; bh=43OKLW6FinsPWAmKzjoljUIVwv0vdGeQy+WbPiLUGCw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mAePH/SzFKWdoMbic0J13iwqhJtlseINc5DNm827I9cYPXUv3j7tx3kKPSYNDDEuKmzj7gGAjvFpCpvBbBVQEF1FPKNQyYjp+4FFphyPLaBfkNgTZ7zPgPSsvy2JuAgDhjdVQ7ZDVpTmuXhcP2i+/7HVW3amNFhjQFxfHR9/Yqg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=j8zrpaIf; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-34560201517so320098f8f.1 for ; Mon, 08 Apr 2024 04:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712575181; x=1713179981; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=WSk7g629HcnobUYtS9ld5wkokmcC8tpl1DGu7N0oFPU=; b=j8zrpaIfIve+C9k81yyhYpmocDiY095DUVPRcM+yNHwMLcHMqxx3tH6mnN9Ku5dDnc Y2HMgo2eWi45Jh9wVjpm0daA35Pq9OmbQql+Sciq2GvheLG6Khz/exHMQkCYpB88cj8B sDLJFCPHz+RoHNagFS9AdNN6KKmz3y49EYo4L8J6TwHDyx5fcl4zm4inXhT5SuT51+i9 4zSpl0BnSTX5m4rX6VKbugQ+4QhthBzoqH1hApclgWg+5bWJeXHRd2YluE0VURfddd8L mFdtDb7tW+9gO/PJGiAh6JRFSiv2/DGEd89orAKSkgmu0/wG1juC02GEp6Cm0LAo3AcS 52dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712575181; x=1713179981; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WSk7g629HcnobUYtS9ld5wkokmcC8tpl1DGu7N0oFPU=; b=wL9iCf6nYsUOjZsSEB/wC6WS6EzDUXNE50STEW0kQCXTo9K3PZuc2MDQaByaXXMEtR SuN5yPcp4n6aBr0IL14V5bVrz1bkd18+1IYHWHpQpv0ll3M+noSAR46Ud3RFdxVkC2T8 ijSX6jUNeTJGBjnF6tDPLU3iwEFOMyzW4OMZMpmuDBhMPHypfNsPP7YU8WZIRA0gniTv ffJ3pO2LPbcJWr91xfSsp6e836IiUSwB6bvn30h7qBMMDhADjssy50odvTswwdyeKhF/ /8mOZy1tNfvx5MuHpBcSf1tM4oBbeZ+xKapQe66gcPkj50XkQIF0m3BR8Ut9+VoMAxmx 2w9w== X-Forwarded-Encrypted: i=1; AJvYcCWdr6Tl+CSh6Ji6UrPWPsN4Nxsfkn/d7wbWySdSqIo56rYVTlhsiuWnR8VM2ulmbuQXyVI2zS/16BXBUmgpwYTRRSZvs8fflCjdprT2 X-Gm-Message-State: AOJu0YwBWz5kaa2ir9Ex6x1ZI0OGhA2nkovR4p+7OiwxVfS6RU5Rl9Na 8JSI1Yw/oVgtE0drE1lXGKHYJLHZeezn4/4MP0TqGMRhCTX9nC7GWff7u9vYc/U= X-Received: by 2002:a05:600c:4fd4:b0:416:5c22:1200 with SMTP id o20-20020a05600c4fd400b004165c221200mr2651159wmq.4.1712575181415; Mon, 08 Apr 2024 04:19:41 -0700 (PDT) Received: from ?IPV6:2a01:e0a:999:a3a0:6327:edd6:6580:3ead? ([2a01:e0a:999:a3a0:6327:edd6:6580:3ead]) by smtp.gmail.com with ESMTPSA id dr20-20020a5d5f94000000b0033ea499c645sm8885921wrb.4.2024.04.08.04.19.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Apr 2024 04:19:40 -0700 (PDT) Message-ID: <89d4a24c-db24-487b-8c5c-bdc1fa2d42b4@rivosinc.com> Date: Mon, 8 Apr 2024 13:19:39 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/5] Add parsing for Zimop ISA extension To: Andrew Jones Cc: Deepak Gupta , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org References: <20240404103254.1752834-1-cleger@rivosinc.com> <20240405-091c6c174f023d74b434059d@orel> <20240408-6c93f3f50b55234f3825ca33@orel> Content-Language: en-US From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= In-Reply-To: <20240408-6c93f3f50b55234f3825ca33@orel> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 08/04/2024 13:03, Andrew Jones wrote: > On Mon, Apr 08, 2024 at 10:01:12AM +0200, Clément Léger wrote: >> >> >> On 05/04/2024 19:33, Deepak Gupta wrote: >>> On Fri, Apr 5, 2024 at 8:26 AM Andrew Jones wrote: >>>> >>>> On Thu, Apr 04, 2024 at 12:32:46PM +0200, Clément Léger wrote: >>>>> The Zimop ISA extension was ratified recently. This series adds support >>>>> for parsing it from riscv,isa, hwprobe export and kvm support for >>>>> Guest/VM. >>>> >>>> I'm not sure we need this. Zimop by itself isn't useful, so I don't know >>>> if we need to advertise it at all. When an extension comes along that >>>> redefines some MOPs, then we'll advertise that extension, but the fact >>>> Zimop is used for that extension is really just an implementation detail. >>> >>> Only situation I see this can be useful is this:-- >>> >>> An implementer, implemented Zimops in CPU solely for the purpose that they can >>> run mainline distro & packages on their hardware and don't want to leverage any >>> feature which are built on top of Zimop. >> >> Yes, the rationale was that some binaries using extensions that overload >> MOPs could still be run. With Zimop exposed, the loader could determine >> if the binary can be executed without potentially crashing. We could >> also let the program run anyway but the execution could potentially >> crash unexpectedly, which IMHO is not really good for the user >> experience nor for debugging. I already think that the segfaults which >> happens when executing binaries that need some missing extension are not >> so easy to debug, so better add more guards. > > OK. It's only one more extension out of dozens, so I won't complain more, No worries, your point *is* valid since I'm not sure yet that the loader will actually do that one day. BTW, are you aware of any effort to make the elf dynamic loader "smarter" and actually check for needed extensions to be present rather than blindly running the elf and potentially catching SIGILL ? Thanks, Clément > but I was thinking that binaries that use particular extensions would > check for those particular extensions (step 2), rather than Zimop. > > Thanks, > drew > >> >>> >>> As an example zicfilp and zicfiss are dependent on zimops. glibc can >>> do following >>> >>> 1) check elf header if binary was compiled with zicfiss and zicfilp, >>> if yes goto step 2, else goto step 6. >>> 2) check if zicfiss/zicfilp is available in hw via hwprobe, if yes >>> goto step 5. else goto step 3 >>> 3) check if zimop is available via hwprobe, if yes goto step 6, else goto step 4 >> >> I think you meant step 5 rather than step 6. >> >> Clément >> >>> 4) This binary won't be able to run successfully on this platform, >>> issue exit syscall. <-- termination >>> 5) issue prctl to enable shadow stack and landing pad for current task >>> <-- enable feature >>> 6) let the binary run <-- let the binary run because no harm can be done