Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1636819pxa; Thu, 20 Aug 2020 16:58:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4adOnFCRrol0BQK55MJmJM+XmBcZgJJBxeDWReeibWTrHG0wxEQk6iuq4UKhKCN3w+UJC X-Received: by 2002:a17:906:35ce:: with SMTP id p14mr389626ejb.276.1597967895196; Thu, 20 Aug 2020 16:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597967895; cv=none; d=google.com; s=arc-20160816; b=yJLLazvZfbuj/Y5VtaC+K1h55f9KKo9uQh7rHCrKwyOYvt3WSWmgeNgsw+jqem/GOG myqy3riWrwr0czOXcbapSk46ZNl+hCm7S24ZkDcDLAf9yMt/phD8QedyjXZDM1OxufOm O3Fc8wy+TW9wDTPDFoeXsGjTkEQOvaNU2KAqoCc2q5it0autgpyED5B2hegEge/99yXj GjdshfIxFjJ/2qVN8NZpkEQQk/QGkO9wG/aQyB2AvYGmUk6LXBL4f7gL6J/pHlon3U3n Oy1jl3H3awPoC6+Me0dmjDM/5v/1tQawciUyD6rmyC5w6gga76y7PgzirqUy5F9f+7hp JqRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=Dj6dnw1SSGK0z0yl6jJ2uTtBS6LOewFQlnOBWDc3SWg=; b=d6XA4aH/FNk4fKfyNhEwipFKYxgCICUigPWypAjcvW77Ge3BSUU1jSK7tEtLT5xQxC KwV2f2UuQRc0+uCfKCfkf/YM3dfOsNnWZpCbhkMyazOFv6VVuCJTNucPfRfrRsn/bMHN eAZ11tePou5yycG+lVU4GizsrgMqVoNiqsz4BSTtQU4FzBF+Zd3kluX8S8Fo1VmjacEk OSNPSMSRB8efX66/xEvIP6EKowHaCmtf7eW1K7XqL0bcWIF0h1FviAyvZUHbJ0Y0vJZp QUJGGYc6YBBr76TWX1speweHZ5RB2cWoFb+1vxWjSVJzpzbrAjGv1+bvMLYP20NsOMNB 35aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=kpie1bvb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si54733edx.608.2020.08.20.16.57.51; Thu, 20 Aug 2020 16:58:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=kpie1bvb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728488AbgHTUpI (ORCPT + 99 others); Thu, 20 Aug 2020 16:45:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728468AbgHTUpC (ORCPT ); Thu, 20 Aug 2020 16:45:02 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35840C061387 for ; Thu, 20 Aug 2020 13:45:02 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id y206so1613387pfb.10 for ; Thu, 20 Aug 2020 13:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=Dj6dnw1SSGK0z0yl6jJ2uTtBS6LOewFQlnOBWDc3SWg=; b=kpie1bvbURjnyGG5tFbzrQs43n0HWVHiEYDQrm96KF6px5dqNEbRvhU3+tGczCdBEN nH9nuWE/dOw1Fgm1b8XE++szjDp0mBzlS073HLhBZlzJRTxzBxHat4pKrJ+PAUUpdnkm 6TqGwZcpetdpfq+xwK7v6+z4qTQ2Sx1kOiVB+dnlANwEjP87QrY+E1wazm4JJMh1Dtte tNTb00w8s9tvECp5T1ElK7APHequbv1ziFmjXXxOKTD0T16K6rLqPQ34Epqyx4dc0gth om4nel1RoFf6E8Eb6r55DxKFBm7aDXCQkDwlRiAeo/LUpJQgJ0amSKOIviXzQItZZOur iqoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=Dj6dnw1SSGK0z0yl6jJ2uTtBS6LOewFQlnOBWDc3SWg=; b=ojW1V6cGC8uAfkWwZyUH8VtikBBU0glvcG6zMw4URBhUhyU2hEA0BHU35O/ShoijfQ 2bH5FoXK5Q5rjkWvvwayimRsJEk8GL5SjvrXlvVNS7KyrwtjVz00UwALcI/VO26o8U9z LJGdAVs2/oVicC+ol++IzPLoOoNV2Dr0o6kDasYfN+23UPTN+jPqVFujkCJDdceaSeaT rgIj8WmAg3BloWzIAwxVweg4EjizP+FIFi1rnp9D+OFYi5YCvRclBCM+nSZVIG7cT6rS qa6zFlVaKqkUCaziMFZZsGvH6joAW84ZqA3wkkW/EK4LW5xcB68hQtaN0X5aYmXzEyNk RJNw== X-Gm-Message-State: AOAM530AQ2YsphHfjzFSDVW3FMLnplYJmmfH99DtVsTr1NRUfp04BSGS iIvazUOqYfE7xEQeN420w/+ejlQlFYfOZw== X-Received: by 2002:aa7:8751:: with SMTP id g17mr384012pfo.109.1597956301621; Thu, 20 Aug 2020 13:45:01 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id r21sm2855133pjo.39.2020.08.20.13.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 13:45:00 -0700 (PDT) Date: Thu, 20 Aug 2020 13:45:00 -0700 (PDT) X-Google-Original-Date: Thu, 20 Aug 2020 13:44:52 PDT (-0700) Subject: Re: [PATCH 0/3] Get cache information from userland In-Reply-To: CC: Paul Walmsley , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, zong.li@sifive.com From: Palmer Dabbelt To: zong.li@sifive.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 03 Jul 2020 01:57:52 PDT (-0700), zong.li@sifive.com wrote: > There are no standard CSR registers to provide cache information, the > way for RISC-V is to get this information from DT. Currently, AT_L1I_X, > AT_L1D_X and AT_L2_X are present in glibc header, and sysconf syscall > could use them to get information of cache through AUX vector. We > exploit 'struct cacheinfo' to obtain the information of cache, then we > don't need additional variable or data structure to record it. > > We also need some works in glibc, but we have to support the function in > kernel first by rule of glibc, then post the patch to glibc site. > > The result of 'getconf -a' as follows: > > LEVEL1_ICACHE_SIZE 32768 > LEVEL1_ICACHE_ASSOC 8 > LEVEL1_ICACHE_LINESIZE 64 > LEVEL1_DCACHE_SIZE 32768 > LEVEL1_DCACHE_ASSOC 8 > LEVEL1_DCACHE_LINESIZE 64 > LEVEL2_CACHE_SIZE 2097152 > LEVEL2_CACHE_ASSOC 32 > LEVEL2_CACHE_LINESIZE 64 > > Zong Li (3): > riscv: Set more data to cacheinfo > riscv: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO > riscv: Add cache information in AUX vector > > arch/riscv/include/asm/cacheinfo.h | 14 +++++ > arch/riscv/include/asm/elf.h | 13 ++++ > arch/riscv/include/uapi/asm/auxvec.h | 24 ++++++++ > arch/riscv/kernel/cacheinfo.c | 92 +++++++++++++++++++++++----- > 4 files changed, 127 insertions(+), 16 deletions(-) > create mode 100644 arch/riscv/include/asm/cacheinfo.h Sorry, I lost track of these. There's a little issue in #1, LMK if you want to send another version or if you want me to just fix it.