Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp764829pxk; Sun, 30 Aug 2020 23:26:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyH325QMxWinYyPlDyizBy8L8ze1kPKnufhjzJq3GrxCV286qGS6cVLSfQkJJcAdCvtYvz X-Received: by 2002:a17:907:37b:: with SMTP id rs27mr11437357ejb.0.1598855177818; Sun, 30 Aug 2020 23:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598855177; cv=none; d=google.com; s=arc-20160816; b=bTTMtTgpaVYJgaq6jOfterIPgK8KXQmFF4JH1H8mj4pGUR2zGhgTFzJGNa2jR04x5C 8/WAxzpKjhE3OrJyaYYJbPd870mkbnU672gknXn9mi22RMLAePG6d8wXI89jz0jWj07B nVM+eDjDWD5FZDtMnXgGBsgVx1evd4tGTMuJ2GOPUYdY7JkPbNWvkqK1jAID5YOgAdo1 rez15EWzg4X+gxCQMdmml4buHTYrOLZF4nfrM020OeWbYymRBjabNsotQfVp3zv51lKe HjyYFM8TL85r2kzafj0uFlYf8vxBAg0FBUgs2m8INTQZIiqgcj3aNtrIRhAzupn4uPHX RJ/A== 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=FbJ5Hs8Go54qaX9o9nvt0zalvbQlaohZX3ktFtQIhJM=; b=uYIVoq1mWD3+rXmq44MvdAJ3+O3sdyeAY+1XjEIXtF9oDMZix2F/ffZ6EftRxoZYVP LHb0qoSyAA8iWQTyuJtD7W3UG4NNkPH6PQyjK64ya5BiOjgdjEVVadmEwVND6CWnfRWy CPAC9yEMIXL0aI52nAc94LcndD1cTm/IA6OWL0//YVQZAWxbE0OtOPu0m2ahoxOB+D8G FCd3cMBvwa5ZlxDNGByIz3/M7OfmoRXLGaZmevuKkCvJsYny4qztHx0AElaUJy+uVKNl sTHLyhuxJiz9a9mvrnn2taowREyO9/jzVFhWH0NsH8G5rjJ+qd8+fqNUIt3ek8b/z5ET i+OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bW3Lj8rP; 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 n10si4279388edo.516.2020.08.30.23.25.54; Sun, 30 Aug 2020 23:26:17 -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=bW3Lj8rP; 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 S1726695AbgHaGXQ (ORCPT + 99 others); Mon, 31 Aug 2020 02:23:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725835AbgHaGXP (ORCPT ); Mon, 31 Aug 2020 02:23:15 -0400 Received: from mail-oo1-xc42.google.com (mail-oo1-xc42.google.com [IPv6:2607:f8b0:4864:20::c42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FC46C061573 for ; Sun, 30 Aug 2020 23:23:14 -0700 (PDT) Received: by mail-oo1-xc42.google.com with SMTP id y30so1208449ooj.3 for ; Sun, 30 Aug 2020 23:23:14 -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=FbJ5Hs8Go54qaX9o9nvt0zalvbQlaohZX3ktFtQIhJM=; b=bW3Lj8rPY+hgDSKzDnkZKzb2rzVSHvKAzvm/CUdjCUU1alxrKCmRILRRcMXNrKeQ4d q5KfMa2DaXOaUWi8IbZfJvVdi/fPxTGsL6DTFGxkhXkQWL02MVDQeQOfpnt/optrVk8A D0trqwu6j4z/Dg6VpPTMSV4lM3INHDGgfB3TKyN72M51PbRFchxXomFItvMaXI00RpgF fHm0eIBJWbJuWQu3JrRUWpL6+gRwZe1WbglizSDOll4XHwVHREUyAEDjQvQUpKuIy+8d 2O5AKxB7eqQ2yiFVE3B3kuROaPRz+FOPHStlb75fOkANWQI/6MFCir8/caG2tUtk/bex 1MAw== 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=FbJ5Hs8Go54qaX9o9nvt0zalvbQlaohZX3ktFtQIhJM=; b=J+miGoJHKe3d+vQfAvJ3NwXKcWLD17kbkS9BhsL9CaKy6RET5PEm+jlSrG6B0mr6yN B8AeStX83cxCjQzMSILjfHKxVdl6FJ5ovSGSlj/4y6X9Roz1Rus9L0Xv1r63Jw3zE1U6 FhQg60YXGha/+6fc7dDhz9ftj+j0bRgNVlN/PtRBILNR9yE/l0Ww328/piw9A65pBp2R hdQCYhWJ/GdWlBkSF3zVhzzWj3DQwS8xy5FaLV4sB++Ni+7yiWnQ0rrzIMPXkX3fPFM5 6Nu87cTlvfVM+h3hvvn52llwfVeRXf/N2neZq+2Ie+8cIF0f7gOnnSyXcCnitfx1LYyh iiQA== X-Gm-Message-State: AOAM530XLvPbmfC2S1tD0WT67N/4ONQ+UFm9wuoH67ZKPY6wznHjwfpm iIinO9/pNCGwjXh8luPV0M0EjXuvA8PjKZcPovPkgA== X-Received: by 2002:a4a:dc03:: with SMTP id p3mr6991429oov.63.1598854993144; Sun, 30 Aug 2020 23:23:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Zong Li Date: Mon, 31 Aug 2020 14:23:02 +0800 Message-ID: Subject: Re: [PATCH v3 3/3] riscv: Add cache information in AUX vector To: Pekka Enberg Cc: Palmer Dabbelt , Paul Walmsley , David Abdurachmanov , linux-riscv , LKML , Palmer Dabbelt 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 Sun, Aug 30, 2020 at 4:01 PM Pekka Enberg wrote: > > On Fri, Aug 28, 2020 at 10:09 AM Zong Li wrote: > > +uintptr_t get_cache_geometry(u32 level, enum cache_type type) > > +{ > > + struct cacheinfo *this_leaf = get_cacheinfo(level, type); > > + uintptr_t ret = (this_leaf->ways_of_associativity << 16 | > > + this_leaf->coherency_line_size); > > You are dereferencing "this_leaf" without checking if it's NULL here. > oh yeah, it should check the pointer first here. Fix it in the next version, thanks. > > + > > + return this_leaf ? ret : 0; > > +} > > - Pekka