Received: by 10.223.185.116 with SMTP id b49csp3954329wrg; Mon, 19 Feb 2018 08:36:32 -0800 (PST) X-Google-Smtp-Source: AH8x225pJDvNrhZh9PEyLfo5eMEmzyOjKiNSkCuk5Ehyq+tDyPTBL9IJkCpSKNsL+hjbreLmKdOA X-Received: by 10.99.63.139 with SMTP id m133mr12636531pga.174.1519058192732; Mon, 19 Feb 2018 08:36:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519058192; cv=none; d=google.com; s=arc-20160816; b=hQvnnxSp/zy8ZKo1caOPf83qQHwpDWItJW+/+nvvbZz/Eo6CT9Havj3Sd6liRsoU1b J177kop1zY7TIZTnusX+5FA+6iWPbYK/H8U0iu62Ml3K9QtZhfmEJuDaiF2to+1VdsUF H1vls+Y/TBAl1d52UsppwEgBu0aocbKufjMy7aT0LJHyiylrXulgHHbGv+6AuPmyNRxu Ml1Z0VJN699d/QTFjhlvEwO3sHhz8Q7vfH44nwQtxL9lxb1jjsrHoBbifQ5JpbbDUQMF fCjEVcNnj0kBwBMsHhtrWF8KjMUBq+3Z2/kNZonOg8711/psJ6yieNcR51290ujryQ+5 fmlQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=Zp/BYIWyUEO6Wai8tRI0w5EJHYFrn1ndIdT9i6jYll4=; b=D/ukz3kj1n83n9zXxmkOUEVVDKT3l2u9Zm7rIKP/8ffxO5YoJhq5mT9Vu5Mq7Z51WD SwOA6lm8J1e+cF2Ary4c3SswMUuBWcCmHGBYoHTh317f0iztz49/NcpYN3pdE8ExLT6x ZLKOrg5BfPvCnBAYbg9HkEh5lObKTPO9N+RNanWQ48WpmtC9a2JDCc3c+xL2o0yJxgpo pCNw+zFyzniN30xLBTqfclhRWB2+4q4GgGa4pik8pithhWawc2dan6KcUETNpwYW3SKq RRF0+QWJEZ+LeBK/BUKWcLbyRsFwuZutHLsHGM18X+c32SG+CjO7ZGh4yp9y5C2ZFORD XP1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ksOp1AVn; dkim=pass header.i=@codeaurora.org header.s=default header.b=RWu07fCd; 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 w8si6649304pgo.616.2018.02.19.08.36.17; Mon, 19 Feb 2018 08:36:32 -0800 (PST) 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; dkim=pass header.i=@codeaurora.org header.s=default header.b=ksOp1AVn; dkim=pass header.i=@codeaurora.org header.s=default header.b=RWu07fCd; 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 S1753142AbeBSQfh (ORCPT + 99 others); Mon, 19 Feb 2018 11:35:37 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:56012 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753064AbeBSQfg (ORCPT ); Mon, 19 Feb 2018 11:35:36 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 220156032D; Mon, 19 Feb 2018 16:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519058136; bh=Vdtxi+WUaq4XHrYq89k6JmMp10M5bcf6T4PyR/CPmjk=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=ksOp1AVno/mBybiRlprHt4PJuSBTqRz5E3yTx2vUr0fsO0aXAmRMvC2QB5KxCXiuZ unoUk2P27dRhiw2YL7zR9tq3WHrS5R3TklGTa3eUIVknhsWPb+p1K7gkB9p7t1MHmL zQPR3nyWfIvnXN06jL6UoW+ulHgvVlC6DYBZymL4= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.0.2.15] (unknown [70.123.43.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: shankerd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 622316032D; Mon, 19 Feb 2018 16:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519058135; bh=Vdtxi+WUaq4XHrYq89k6JmMp10M5bcf6T4PyR/CPmjk=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=RWu07fCd6vG2o2ongsAiuG4nYtkoj2gRcVd2Icyc8+wUdthgvk/U9xh56Yv4wtub9 qJIpRzAbBG0dEVkzo+3KhjrITQRLIKY760q375174Q0CHQGsLIjNQfLV0JBX5E+bAl grlMImYj+WTF6di/vTk7tE9ykDvJdwVcqYHC+N2I= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 622316032D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=shankerd@codeaurora.org Reply-To: shankerd@codeaurora.org Subject: Re: [PATCH] arm64: Add support for new control bits CTR_EL0.IDC and CTR_EL0.IDC To: Catalin Marinas Cc: Philip Elcan , Vikram Sethi , Marc Zyngier , Will Deacon , linux-kernel , kvmarm , linux-arm-kernel References: <1518829066-3558-1-git-send-email-shankerd@codeaurora.org> <20180219143820.5oxc2kendvq4bbtt@armageddon.cambridge.arm.com> From: Shanker Donthineni Message-ID: <92836754-2ab3-d5db-f0be-7ee3e10f368f@codeaurora.org> Date: Mon, 19 Feb 2018 10:35:30 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180219143820.5oxc2kendvq4bbtt@armageddon.cambridge.arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Catalin, On 02/19/2018 08:38 AM, Catalin Marinas wrote: > On Fri, Feb 16, 2018 at 06:57:46PM -0600, Shanker Donthineni wrote: >> Two point of unification cache maintenance operations 'DC CVAU' and >> 'IC IVAU' are optional for implementors as per ARMv8 specification. >> This patch parses the updated CTR_EL0 register definition and adds >> the required changes to skip POU operations if the hardware reports >> CTR_EL0.IDC and/or CTR_EL0.IDC. >> >> CTR_EL0.DIC: Instruction cache invalidation requirements for >> instruction to data coherence. The meaning of this bit[29]. >> 0: Instruction cache invalidation to the point of unification >> is required for instruction to data coherence. >> 1: Instruction cache cleaning to the point of unification is >> not required for instruction to data coherence. >> >> CTR_EL0.IDC: Data cache clean requirements for instruction to data >> coherence. The meaning of this bit[28]. >> 0: Data cache clean to the point of unification is required for >> instruction to data coherence, unless CLIDR_EL1.LoC == 0b000 >> or (CLIDR_EL1.LoUIS == 0b000 && CLIDR_EL1.LoUU == 0b000). >> 1: Data cache clean to the point of unification is not required >> for instruction to data coherence. > > There is a difference between cache maintenance to PoU "is not required" > and the actual instructions being optional (i.e. undef when executed). > If your caches are transparent and DC CVAU/IC IVAU is not required, > these instructions should behave as NOPs. So, are you trying to improve > the performance of the cache maintenance routines in the kernel? If yes, > please show some (relative) numbers and a better description in the > commit log. > Yes, I agree with you, POU instructions are NOPs if the caches are transparent. There was no issue as per correctness point of view. But causing the unnecessary overhead in ASM routines where code goes thorough VA range incremented by cache line size. This overhead is noticeable with 64K PAGE, especially with sections mappings. I'll reword the commit text to reflect your comments in v2 patch. e.g. 512M section with 64K PAGE_SIZE kernel, assume 64Bytes cache size. flush_icache_range() consumes around 256M cpu cycles Icache loop overhead: 512Mbytes / 64Bytes * 4 instructions per loop Dcache loop overhead: 512Mbytes / 64Bytes * 4 instructions per loop With this patch it takes less than ~1K cycles. > On the patch, I'd rather have an alternative framework entry for no VAU > cache maint required and some ret instruction at the beginning of the > cache maint function rather than jumping out of the loop somewhere > inside the cache maintenance code, penalising the CPUs that do require > it. > Alternative framework might break things in case of CPU hotplug. I need one more confirmation from you on incorporating alternative framework. -- Shanker Donthineni Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.