From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FA1DC48BD1 for ; Fri, 11 Jun 2021 18:05:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF08C613D9 for ; Fri, 11 Jun 2021 18:05:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF08C613D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hxuwnODo24SmAgUADwboI4C6Pk3idYnbxRMKFuiFCYs=; b=WiWbBCMBDljtO0rdXE9pLnKPJ0 FSLEX7ysFHvRbgQp0SZNkipwdV3p6KfYk96kK4OMD3b5JvFyRfcifTUA8CpeGTjwno35E2tMNMgiU 58mPcwu9hr9Rl9K+bBY2vikRy8EogzGzUbkI300yt5+akZpyhdfMvmotSP5X/jzrtC5TIV99V0ziL gZ8GvQFW9GbB30q/OUNZ8YI0tZnyK6crn3309WQCxrMTqSWpVr0SYf5GyiK3tuvWa6OZcPwe2f+oq iTf4m5xs/d7maJAlz8uYL2w/AR2b41M4vgNsIZYzF4+iHfIIOy2A9ZhhECqf62O87JUH2QeK4dIun aYt0sijw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrlVI-006P35-11; Fri, 11 Jun 2021 18:03:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrlVD-006P0i-J2 for linux-arm-kernel@lists.infradead.org; Fri, 11 Jun 2021 18:03:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9713E1FB; Fri, 11 Jun 2021 11:03:28 -0700 (PDT) Received: from [192.168.0.14] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1CB943F719; Fri, 11 Jun 2021 11:03:26 -0700 (PDT) Subject: Re: [RFC] Adding A64FX hardware prefetch sysfs interface To: "tarumizu.kohei@fujitsu.com" , linux-arm-kernel@lists.infradead.org Cc: "'hpa@zytor.com'" , "'tglx@linutronix.de'" , "'mingo@redhat.com'" , "'x86@kernel.org'" , "'linux-kernel@vger.kernel.org'" , "Will@kernel.org" , Catalin Marinas , Borislav Petkov References: From: James Morse Message-ID: Date: Fri, 11 Jun 2021 19:03:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210611_110331_718079_0B38C52D X-CRM114-Status: GOOD ( 15.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello! (CC: +Catalin and Will) On 07/06/2021 09:11, Borislav Petkov wrote: > (not trimming the mail so that ARM folks can see the whole thing) > > On Mon, Jun 07, 2021 at 01:39:21AM +0000, tarumizu.kohei@fujitsu.com wrote: >> Hello >> >> I'm Kohei Tarumizu from Fujitsu Limited. >> >> Fujitsu A64FX processor implements a vendor specific function, the HPC extensions[1]. >> A64FX has some registers for HPC extensions. >> We would like to use the register IMP_PF_STREAM_DETECT_CTRL_EL0 for tuning the hardware prefetch, but it's not accessible from userspace. >> We are considering to implement a kernel common interface via sysfs as a way to control IMP_PF_STREAM_DETECT_CTRL_EL0 from userspace. >> FYI, A64FX also has registers (e.g. IMP_PF_INJECTION_*) to control the behavior of the hardware prefetch from the software using "HPC tag address override", but this time we don't considered. >> >> [1]https://github.com/fujitsu/A64FX/tree/master/doc/ >> A64FX_Specification_HPC_Extension_v1_EN.pdf While this is initially about sysfs, don't you need the 'HPC tag address override' to be enabled for this to be useful? I don't think that feature can be managed by a driver: 'HPC tag address override' changes the top byte of all user-space pointers from being ignored (as they have been since day-1 on arm64) to having implications for the hardware. If I've read the document correctly this affects the prefetch mode and where in the L1/L2 such accesses will be allocated. This would impact user-space that is using the top-byte for their own purposes. For example hwasan uses this field as a tag it allocates itself: https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Enabling 'HPC tag address override' for all user-space is going to have weird performance effects. To make this work, I think you'd need a per-process opt-in, and __switch_to() would need to toggle your IMP_FJ_TAG_ADDRESS_CTRL_EL1.TBOx bits. Because its an implementation-defined feature, but the controls can't be confined to a driver, I don't think enabling 'HPC tag address override' is viable. Is the sysfs information useful without it? Thanks, James _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel