Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2945882rdh; Wed, 27 Sep 2023 19:18:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFq6fgm7ivOMcGwTaDUbcsx+E9YBjIUidYM9bgyQWQo+GcTHwpsg8GXkFUgmFhDuqaaoNg6 X-Received: by 2002:a17:90a:e293:b0:274:9823:b481 with SMTP id d19-20020a17090ae29300b002749823b481mr3614766pjz.9.1695867510433; Wed, 27 Sep 2023 19:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695867510; cv=none; d=google.com; s=arc-20160816; b=WgObZiy4Z83Z0xaO8tVwRqQ0qpGAvdoiS5Rwp4AXxKl4OhgmshtrRLfOyee8uMSW1g ZXhZWzJbtYaGCiRKnAweuXrKwa5JNaCIyDwSXkY7LmNlMchxnfWRcmfpJ3in8yneqn8+ H0JmPEellHzWM4sUdZFOr4KhZE/2JVBIqRt6hEGLuoUnvuc3YGj2vl7ZwJfAT+AqVZg+ zWTzr+hs33ztG8zwgH/heY7xXuRHu4iKz08cqYDVEi7qVFLef7q8CLBpwW4CrlygPsXZ ssOgjf7vzremRVNyeXW3l2a89u831mtURDXGTepFGeJWJYqO5e8sZaO3joGM66cF+qwT nYeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=y7VhIC7MPBFXpVR7FFEbYlo6XAUw3yl/JVeppNvmRog=; fh=KmIWz9Cw0hz+i4SdiN9nKf3TQcGpBBs/wTFkdjo+D5w=; b=HxzABhPKSYFxf9yj2b1UOAk2VI8wwD1cAJmjhZaS4zbTUBR9VZdRQ1fdIwm3mzEDP9 Mu71885WKk+OBRLERs2VZHRDKMQz5w7PFElBdZHFgTKiPaD8LmxDo+TS8i0x5ScxBHNN Mu6vsCKdf+HOstbThIbrmHfMy1kTwXDgXK6UZeVVKhuFgNvD36bDENlzYXr4hIN+NBc9 lorl6LjDCD0XaA6CK7kkn6nYF2mpwUwVGxJiOXsA+Q1ncBMt9w7zm+iFNgoxSrRkzmu6 LRV5LU16ZjKQOcEH8dFNkUUI/sUEzf5EgSyfAj7Wev5cFEHSHi+9NESMzRJsPlOws95Q 2A0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=sJzRlbel; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id v189-20020a6389c6000000b0056a1a149034si17335305pgd.650.2023.09.27.19.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 19:18:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=sJzRlbel; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E719E8095DBE; Tue, 26 Sep 2023 16:54:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232619AbjIZXyM (ORCPT + 99 others); Tue, 26 Sep 2023 19:54:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234006AbjIZXwL (ORCPT ); Tue, 26 Sep 2023 19:52:11 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F84619E9E for ; Tue, 26 Sep 2023 14:44:27 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5041335fb9cso15700098e87.0 for ; Tue, 26 Sep 2023 14:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1695764665; x=1696369465; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=y7VhIC7MPBFXpVR7FFEbYlo6XAUw3yl/JVeppNvmRog=; b=sJzRlbelvLtcKFZwts95KO1oBqJLlAIbLmH6YMMWapWbJejaKa73Lx70QTXv7oed3X h7PjUj9uwgaL6tsxo2gjuitXJSWDLoltaTY/btaq+PE/zfDr1lz49tk89kjikAk3dN3d OoLwqNh4V1Hw4jxGuxZqDX4NVKcxPNmEh4ZoNAB/s6FU+h2HECnyhDIBKBUB5SgKDwg/ QgbLJMn/WQVwHCq6kVY+y88cCLFZuN5JcUKduVY4sXVfXtmcOua6yOdkDCvSDAB7hF3I qvJI/ItXyVQDv5RnEl/YtL/ygdNodJERwF4VS/MTXLBWqYzOunjSJxiPNuo8gviHoIZE aCow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695764665; x=1696369465; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y7VhIC7MPBFXpVR7FFEbYlo6XAUw3yl/JVeppNvmRog=; b=rJdBmNpwclAG8ESb2rzcNljfuFgonUxPcYg7NoQF7UpaBg9Kzs7lKr7GqhkSlgzSgZ 71zJll1aVzV/NakLNpBfljIGeOTsh+PwvhjDXgM1pEMyxzHZB6Zs1DH5o3Hz2lG7sYtD 2bn65azhTDXd8ai3UAH4kYdrKlduxp03MdK0SAsfhr24+jiHshf/+TGe80hWOQyXxjpQ g+JY4Kfv1G3WmXXEXsvadodfAOzu38YbOiaPA1eNr+1xiJqt7bSVePp6yLYlYyYeYNBA gbZH2+zDGS5qXs9fnGjKu22anhW5tntYs3jMUeprKlhSF2u1eNC6S/ipzEyZITfopusR nB0g== X-Gm-Message-State: AOJu0YytMBtFpFg9TPl+AnUZV1vw8Cnhzt4ZFqtboo0JuCw/K06tvy8L 3hoE/9VxrMpiiVqkRxAbWDgxWdqKOyEEM6F2Yy2nlyyM5z8h2mD6 X-Received: by 2002:a19:5e55:0:b0:4ff:9efd:8a9e with SMTP id z21-20020a195e55000000b004ff9efd8a9emr45660lfi.7.1695764665489; Tue, 26 Sep 2023 14:44:25 -0700 (PDT) MIME-Version: 1.0 References: <20230926150316.1129648-1-cleger@rivosinc.com> In-Reply-To: <20230926150316.1129648-1-cleger@rivosinc.com> From: Evan Green Date: Tue, 26 Sep 2023 14:43:49 -0700 Message-ID: Subject: Re: [PATCH 0/7] Add support to handle misaligned accesses in S-mode To: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Atish Patra , Andrew Jones , =?UTF-8?B?QmrDtnJuIFRvcGVs?= , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Ron Minnich , Daniel Maslowski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 26 Sep 2023 16:54:19 -0700 (PDT) On Tue, Sep 26, 2023 at 8:03=E2=80=AFAM Cl=C3=A9ment L=C3=A9ger wrote: > > Since commit 61cadb9 ("Provide new description of misaligned load/store > behavior compatible with privileged architecture.") in the RISC-V ISA > manual, it is stated that misaligned load/store might not be supported. > However, the RISC-V kernel uABI describes that misaligned accesses are > supported. In order to support that, this series adds support for S-mode > handling of misaligned accesses as well support for prctl(PR_UNALIGN). > > Handling misaligned access in kernel allows for a finer grain control > of the misaligned accesses behavior, and thanks to the prctl call, can > allow disabling misaligned access emulation to generate SIGBUS. User > space can then optimize its software by removing such access based on > SIGBUS generation. > > Currently, this series is useful for people that uses a SBI that does > not handled misaligned traps. In a near future, this series will make > use a SBI extension [1] allowing to request delegation of the > misaligned load/store traps to the S-mode software. This extension has > been submitted for review to the riscv tech-prs group. An OpenSBI > implementation for this spec is available at [2]. For my own education, how does the new SBI call behave with respect to multiple harts? Does a call to change a feature perform that change across all harts, or just the hart the SBI call was made on? If the answer is "all harts", what if not all harts are exactly the same, and some can enable the feature switch while others cannot? Also if the answer is "all harts", does it also apply to hotplugged cpus, which may not have even existed at boot time? What happens if a hart goes through a context loss event, like suspend/resume? Is the setting expected to be sticky, or is the kernel expected to replay these calls? -Evan