Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp265163pxa; Thu, 27 Aug 2020 01:24:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzajdirTWS6KOoXXwk2Ffbnt1+sZSMAuCQcGjnFK6KP52DoQmqYa0YAg9fXJF3KajTbctzN X-Received: by 2002:a17:906:1993:: with SMTP id g19mr11936312ejd.431.1598516667587; Thu, 27 Aug 2020 01:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598516667; cv=none; d=google.com; s=arc-20160816; b=sMO1CJsKZJ8Ij4D83v018ibrpqqs4u53QvPsSJBLVgF937FlsdCEKPssaDzhqLotba 7pdIuODSXj8WOiiJJkDtKEiki6BzYCoFPisdg9emAoxvpKH19V5F9O65hq21lei5J5MD +Cun33yxqbwQNsRLrSLrA/XoGTi8Rb2yEritIMU7Zhva21qBJ7Yg/QN+5uRkhzwSopPW e2lKP5RisAg+bVTbnUxQ3QlPN0tbLMFBrKrBaERm3rTUc2zLN1F9a3och9sn0XxaT9tF uNH+YH5bjf4JMaUzmrHKNplKa2bbzfwjsEoSSIcariPvSVJNxrf0moF9tK7MQvNllECL 85iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VGJWcpN1ntTu98dcskn67ut+Ep3J0JtQnookryJIizM=; b=FrhaGMq3rlTwzAp3B0CGKHJD6KA4MnBgEjE50ogXRHY4vhCwP0wWrgWhCCCFWdyzXo 73OnwYDLw57juueAJlBH2OP8p31Cyle2OsaNTmP1VQXHQZF2t9WvP77OvFBg3ewPR2lN z23ZEPU8N1RWoBhGbAcR12bc0xyHSe6uNnAjjFYeg5+ueoSQqsczqb7glmlhhhPTeDzl edZN9wjhJt63cA82MzWtAQy/LWJeE8OCHKNLkpZH+Yq37Q3++3TLR/qKkwrQgrkyV/RI iNM5/eMsuDf7EJEwZe+NhutSCyq1GXt7bx0M5pO3g8WzEm9VM2tSOFODY1LsOGWtSKsn rV6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=amAWIrNt; 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 p5si770860ejg.477.2020.08.27.01.24.05; Thu, 27 Aug 2020 01:24:27 -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=@sifive.com header.s=google header.b=amAWIrNt; 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 S1728141AbgH0IW4 (ORCPT + 99 others); Thu, 27 Aug 2020 04:22:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728033AbgH0IWz (ORCPT ); Thu, 27 Aug 2020 04:22:55 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49486C061264 for ; Thu, 27 Aug 2020 01:22:55 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id x24so3747319otp.3 for ; Thu, 27 Aug 2020 01:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VGJWcpN1ntTu98dcskn67ut+Ep3J0JtQnookryJIizM=; b=amAWIrNt1eTgYWi1kEAYhttdOwvSYssVqMFE49HSWbPuMy643K+dkGD3bna/Us80Zq Uk017raHDRDEhceG/BxRvXmSVqLrXXLuZTZcUCDzpHCR6T96a/ubnk/BFHjzqQyTz2ou Ca0WTwo+dhAHPqnzH9mTLuwG53ZOg+BNpfT81/1/iyL1y3/XJThWHOSP9Y3L2siWfs/r lTXxXnJAaB9ejlUcF+Yll0eDOfDTeXtH2/L4hJgIRxb5l89JnCZDlMMj5hTgs4HiwJ4k KSpQf7CjjVAWAdMQ7YMp/kvh4D4iXBqO9441k7a78o7z+X8vyPE90UJE8Xp7faNsgUjh nFug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VGJWcpN1ntTu98dcskn67ut+Ep3J0JtQnookryJIizM=; b=DMZDg0u0cYU4Vpb9ONQFaV80IotR3Qnlj7iuPrgrNVPYcdnsEt4vtCECRLexAf2gRg FyoFUXHwgsdHeMEHo44w/4DmTBjbWZfuyhO5dNf0QZZ6QhLJQsLZdhC4aNsqWhXY7yH7 lV6e31wn7YuZ/CqvwTZBGQtUpNqyP/0zQqkUJ6wM5c72sgZ6BU/HF0QrYcJlf1Feuwxz uUZr6Pfk9fULocRfIUMWkhm4sMZD699knAIaeYEUncM7qQhL5XV8xl9niJmVU47KhNRL COQfxDGYlJZVysrUXZkdYsNAusag3/xHWgFV+b56KbHMp8hCjyCGN4x1r+pLO/NDdfne ttRw== X-Gm-Message-State: AOAM531KmgCBkjml52uvqe3JFXxd2AZak1SRNz23ZI5OWiBJY8TWbT0e DyhSzVvGFcLv4GNKoK4+eZgHlmJHgE3rjwrwuikQkg== X-Received: by 2002:a9d:58c9:: with SMTP id s9mr13183617oth.127.1598516574712; Thu, 27 Aug 2020 01:22:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Zong Li Date: Thu, 27 Aug 2020 16:22:43 +0800 Message-ID: Subject: Re: [PATCH 0/3] Get cache information from userland To: Palmer Dabbelt Cc: Paul Walmsley , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 4:45 AM Palmer Dabbelt wrote: > > 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. Sorry for being late here, I have sent the second version patches to fix it, thanks for your reviewing.