Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3474162ybi; Mon, 27 May 2019 00:18:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEInAX47PfWNFdHuuNkG0bFvayR38pKDnJSrLc5lX/GUqkL2bRU2QDHGK8rG5tsxd9fEr8 X-Received: by 2002:a17:90a:22d0:: with SMTP id s74mr27875988pjc.3.1558941517341; Mon, 27 May 2019 00:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558941517; cv=none; d=google.com; s=arc-20160816; b=ffnsqq3vmi/iWbR/G3RH1a2fGd8ugrkwFJbHY1nBykcnj9QuD97tK8UYGwmPdLxDPF o5M3tzn5uglRtBcV0uQmLLhg14zqGsIZ87Pgnp3u15I5Ol8cDmYOp2C+hw+wHnAqN+H8 iDxawwLTjlo1xJyh4bh52Ei1Xww+d7JFQZWHwqn46aNOwLPJiRtC/Zc/6CLmBiemx9r2 4DMpCkiB5VkhqxJiKSr5Qd8th1EriZKW/WvT87snDjklMrwl1XSSA1fxC2bz/TE5PL2S VLeHN/shd1U/XPdWNlUiKB0pkQ7XkdOSFensI1vKM6QoNkBv4hsT3Y9iq3x8MClKiVQ5 QHBg== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=siV/cs7Mu41bLEf/07q7DOWtnDzZsZYlm4mvkl27qsM=; b=uRBw3VJHp61HjlCaxKyyUL8+9wfJDDTCwYZPGY8e+M4kdlXp4wqoa1LRC49SoJAvj2 JJyUsXCEt8tROCy5OOJL1/EfeXgO3ACO4Tes+lDNVyjOcQlD61Qns0HtBQV3yr4Z3mTM 2SEQFft92bwHFstD9AV7dYilDxlKtnqo8z0TNdnfSoYy5w5lvexM+HCH6P+6+ZSUA/J5 kZ4tC0PCspTrd78JLGuAGDz8qS2RTW2y6yRSx6OjEyGclaLLMGSx+4jw5U2lQbqCT3vj cjal82Q4q9n/PRysO7uLVjmtKsPdp7hBXwsOqD4pZsU2bKZE6zbBdTBamLQdm3/HVoKV /VwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si16091078pgm.206.2019.05.27.00.18.21; Mon, 27 May 2019 00:18:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726114AbfE0HO7 (ORCPT + 99 others); Mon, 27 May 2019 03:14:59 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:17163 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725940AbfE0HO7 (ORCPT ); Mon, 27 May 2019 03:14:59 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9B8B216F5327146B6375; Mon, 27 May 2019 15:14:56 +0800 (CST) Received: from [127.0.0.1] (10.74.221.148) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Mon, 27 May 2019 15:14:50 +0800 Subject: Re: [PATCH v3 2/2] arm64: cacheinfo: Update cache_line_size detected from DT or PPTT To: Greg KH References: <1558922768-29155-1-git-send-email-zhangshaokun@hisilicon.com> <1558922768-29155-2-git-send-email-zhangshaokun@hisilicon.com> <20190527060829.GA8106@kroah.com> CC: , , Catalin Marinas , Will Deacon , Sudeep Holla , Jeremy Linton , Zhenfa Qiu From: Zhangshaokun Message-ID: Date: Mon, 27 May 2019 15:14:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20190527060829.GA8106@kroah.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.221.148] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On 2019/5/27 14:08, Greg KH wrote: > On Mon, May 27, 2019 at 10:06:08AM +0800, Shaokun Zhang wrote: >> cache_line_size is derived from CTR_EL0.CWG field and is called mostly >> for I/O device drivers. For HiSilicon certain plantform, like the >> Kunpeng920 server SoC, cache line sizes are different between L1/2 >> cache and L3 cache while L1 cache line size is 64-byte and L3 is 128-byte, >> but CTR_EL0.CWG is misreporting using L1 cache line size. >> >> We shall correct the right value which is important for I/O performance. >> Let's update the cache line size if it is detected from DT or PPTT >> information. >> >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: Sudeep Holla >> Cc: Jeremy Linton >> Cc: Zhenfa Qiu >> Reported-by: Zhenfa Qiu >> Suggested-by: Catalin Marinas >> Signed-off-by: Shaokun Zhang >> --- >> arch/arm64/include/asm/cache.h | 6 +----- >> arch/arm64/kernel/cacheinfo.c | 11 +++++++++++ >> 2 files changed, 12 insertions(+), 5 deletions(-) >> >> diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h >> index 926434f413fa..758af6340314 100644 >> --- a/arch/arm64/include/asm/cache.h >> +++ b/arch/arm64/include/asm/cache.h >> @@ -91,11 +91,7 @@ static inline u32 cache_type_cwg(void) >> >> #define __read_mostly __attribute__((__section__(".data..read_mostly"))) >> >> -static inline int cache_line_size(void) >> -{ >> - u32 cwg = cache_type_cwg(); >> - return cwg ? 4 << cwg : ARCH_DMA_MINALIGN; >> -} >> +int cache_line_size(void); >> >> /* >> * Read the effective value of CTR_EL0. >> diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c >> index 0bf0a835122f..3d54b0024246 100644 >> --- a/arch/arm64/kernel/cacheinfo.c >> +++ b/arch/arm64/kernel/cacheinfo.c >> @@ -28,6 +28,17 @@ >> #define CLIDR_CTYPE(clidr, level) \ >> (((clidr) & CLIDR_CTYPE_MASK(level)) >> CLIDR_CTYPE_SHIFT(level)) >> >> +int cache_line_size(void) >> +{ >> + u32 cwg = cache_type_cwg(); >> + >> + if (coherency_max_size != 0) >> + return coherency_max_size; > > Ah, you use it here. > Yeah, we check it here. >> + >> + return cwg ? 4 << cwg : ARCH_DMA_MINALIGN; > > Shouldn't you set the variable if it is 0 here as well? > As discussed this with Catalin, https://www.spinics.net/lists/arm-kernel/msg723848.html I think it is unnecessary, if coherency_max_size is not detected from firmware, We will return the cpu core reporting value as the cache line size and coherency_max_size won't be used in other place. >> +} >> +EXPORT_SYMBOL(cache_line_size); > > EXPORT_SYMBOL_GPL()? > Ok. Thanks, Shaokun > thanks, > > greg k-h > > . >