Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp52780lqg; Wed, 10 Apr 2024 15:14:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlfTEbSFIuRFXkxcU3esUJtvTMtHLxQ6U/RCSMLb86Pofm67JIbQh1W+ve6YOa3N0Cy3Tr8rwndVtlzA5Yg3c4YLAKL4gZg7mXmu9EYg== X-Google-Smtp-Source: AGHT+IGn3Hme+Lt9YhM6fJ+VWANdTEylbk61/SzGWoliYhVnEV29U45kvNXfKw8qswfI2W59TvDO X-Received: by 2002:a05:6a00:23d2:b0:6ec:f566:6eb0 with SMTP id g18-20020a056a0023d200b006ecf5666eb0mr4327563pfc.17.1712787295648; Wed, 10 Apr 2024 15:14:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712787295; cv=pass; d=google.com; s=arc-20160816; b=gS206hrMSVCE/DJQ6fhgbs2pYTb9RKRFOLK/PEdY+iVH3PvJdZGZ7pQB/vOXhoYNy0 3dekO6ILP4IDbcpteKj+pRwkQM7bSZ1ofHVi/1sFz1QAD/K5mXQE5qQYCIdFUVEwW4/P 2uOhJU4d/Tzaw8Uivpa2iBvsiHwGt5TjdrQnKIP/e1f/8Lcs8tGflDzxZH7oFSfVBOka JwoobjSVNipTRdkwdw3CRDBVUkxu9GTduPJKR1WsWEm0GFRK5/MkJNMr2GIWDGhkaeAG lUnchhx4NIdopwtSyPZED0HnIyQ3Q2JuyZCu7u4/q03crJsQNnurDPKqrG7lo5CsS/17 qGHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/QiNgJqGWJlDyyUI6HRBW5pQDmQPsVVStIMWqIN9niY=; fh=tpRV5TK9cUMIGvtLl2Kg/1fhLfg+IrR6Ptuhh+mzdtk=; b=O68H4d/KjJzDpZ3bCaU68P4NU7moPL5e80givvlKFYjCJKAc/BYfbbK6RHC/zU7YWr zn3lW0k+NleqfSP5LAaPwlkQMkdDyOqqRHHM9Q3/lCDtAC5N/sCahSW0wAZX6z0FSGTY P410MA4Q1VgJcAJvX9oq8TZ/yIvU8sQ2v69O0LL6ZeLDqgPzOTFNP3KCTg5cXfXSehzO gi1RXWSJO0+UpaOwZFeh7u7BtDpQoyUj6wlkfc7461Cs9GIdN+cXeALcuOtBqkveCEK7 POQLyPyX2nH/wyVd51ZZVFszFcr1AxG5IXfi1qxS2C2PJOPR98IrB3MopcyHSAvUzKuO DLEQ==; 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=15EqhKpJ; 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-139410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139410-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lo22-20020a056a003d1600b006ecfc53c4ffsi202197pfb.122.2024.04.10.15.14.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 15:14:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=15EqhKpJ; 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-139410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139410-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E4C9FB23CDA for ; Wed, 10 Apr 2024 22:12:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 843BB194C86; Wed, 10 Apr 2024 22:11:38 +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="15EqhKpJ" Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 0776C194C71 for ; Wed, 10 Apr 2024 22:11:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712787097; cv=none; b=DNZ9qLEBIJdMTyK9AHrJ8QcGvCeN9x8bI0Q2vKZdqcHvwHvHtJBNpeFiSnT57wcI+bJXQVokR0c37LpVB7dCIX/7TbEttcEppcRlS0u+4nnV1wCn9GEua9wCR53kmcmSt2AStU05eU1M/fl3dIcqpvWVc9VIgBK7FPNK51+S0kE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712787097; c=relaxed/simple; bh=/QiNgJqGWJlDyyUI6HRBW5pQDmQPsVVStIMWqIN9niY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y715NkZPOp9lS/Zzcy/+cNP5a+VUvlX/bvQo5pYDzKFaGuh58ijvpR8Jn63PSouTfFO+X7qlYOf0Df6N2YHDM3NUKc6GuUMBdn1XhsKGGBs+Lp4cTeY7I1wtcb/fawWKh8X0Ixxb/9D5OSgxsoPHkK81r7XLB//VFwK7u5dYI+M= 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=15EqhKpJ; arc=none smtp.client-ip=209.85.210.173 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-pf1-f173.google.com with SMTP id d2e1a72fcca58-6ed2dbf3c92so3087572b3a.2 for ; Wed, 10 Apr 2024 15:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712787095; x=1713391895; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=/QiNgJqGWJlDyyUI6HRBW5pQDmQPsVVStIMWqIN9niY=; b=15EqhKpJUs2EQqzFDolPxbPFLpOFHCw2IGHMkolxs26hAVjMwfG2yK7fPuOuIxQB7l KYpPhr6I2w4X30ClQYh4788bdsnjfWjCWq1poJGbvBsVIAH4vQAJZw58ve6AZ+E4FSHr jKQKDJjkr9x53UQHvTrFlVNDB011iqY8MUraseNwxWUtCzY1zyFxlL8zVbZ2/Sj5sjlf 8oKZPF//xnny2agQvroFS6mPj+rNjIiJLECtB5b7Un5UjutH54vGiOLoCKWyN5AdUPtG DIwOSg4DssqmFylj6qKJriwFnQvuSXT2w69ZJRXRIp/nX7iSE5zj7iwi492fhWw5nWtu GmaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712787095; x=1713391895; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/QiNgJqGWJlDyyUI6HRBW5pQDmQPsVVStIMWqIN9niY=; b=RQACfCizCF1uCsrxb1GbjgDnHo6ofyyrOgN/egIZ7YKBKBwMLly1zBPqv8OYkSDqs3 qKQ/PATVJ5LiA+krTTAYOFTCLuBWoLUWGa94CO8Xy3OE4nUkYKage8mK/N7Aq9sRtn2z /ZMTQFCyhmwV36uanIp/wAzslwMlAowPwU/ZdlIpEPVnxajtw6svezUQnM8TE03hI903 D4KEuPI7dn2VVNzN3LfR8+2Zidr6Dsohpl2v/k1nIcLOZL9tROafN0PnT4Q7nBUHE5Mk MPIoUU+U2jaH+TJOf/RjJ/9+lHipPjdmItN2++2QPdvXx7a11rB9PieU4vvXzK7FvdAZ dA+Q== X-Forwarded-Encrypted: i=1; AJvYcCXpSd25iv3yEmcLE36eB3lvOZ7iA5x/ok62M0H/s6RuORTbIGIYejqEkkat03Kt1n6TRLWbxUddRW1DQJarDu3p1Umft9WDkR9iqAIL X-Gm-Message-State: AOJu0YxDVGaA91kh6us1RS+nwerCPwwZY/9BbxTR8MLKRMkUO+wB75iW UvqEMZc2nuB/GUSi9HQvZ+POgZv5oYKwI973RreZPR0RH/lTvJfvAMmZozx7AAQ= X-Received: by 2002:a05:6a21:2786:b0:1a9:7e6a:12a1 with SMTP id rn6-20020a056a21278600b001a97e6a12a1mr245273pzb.57.1712787095176; Wed, 10 Apr 2024 15:11:35 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id w18-20020a639352000000b005f3c84e12c9sm35672pgm.48.2024.04.10.15.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 15:11:34 -0700 (PDT) Date: Wed, 10 Apr 2024 15:11:32 -0700 From: Deepak Gupta To: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= Cc: Andrew Jones , 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 Subject: Re: [PATCH 0/5] Add parsing for Zimop ISA extension Message-ID: References: <20240404103254.1752834-1-cleger@rivosinc.com> <20240405-091c6c174f023d74b434059d@orel> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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. > >> >> 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. No I did mean step 6 which is let the binary run. Step 5 is "issue the prctl" to light up the feature, this should have been reached via step 2 if feature was available. Going to step 6 from step 3 basically means that underlying hardware only supports zimops and thus this binary is safe to run on this hardware. But no need to issue any prctl to kernel to enable this feature. > >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