Received: by 10.223.185.111 with SMTP id b44csp1644786wrg; Sat, 10 Mar 2018 10:28:22 -0800 (PST) X-Google-Smtp-Source: AG47ELuLARk9zvY4TAYZn/P0MK/xYfI/PzxGreVldteSlhUX3bUP9D+7sVJTGazpnKdzbaUUD0wN X-Received: by 2002:a17:902:d81:: with SMTP id 1-v6mr2705659plv.324.1520706502434; Sat, 10 Mar 2018 10:28:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520706502; cv=none; d=google.com; s=arc-20160816; b=hhvF0ZkPTdTijFutiS8729y2kHa2BPKdQOuaE47vvGQhsGS2aMNE+u1We/IsaIzj7O zDFztguv8cx6mrgcVo3ISxA7WUUdwoehf6i+rDkrNPcIAYp3G1Tgh/BbbAKkr4L8HcZq ZmUIIhL9tmAieew/m5eopT7FIi70fCNT02S7lySlyY1mW4de79Y2WBJOhqAOyMj02+rh yMKZZw3Rf2iocn6AJcIlSJipi0BAyC6a4GiN5vUhlcu2TnwggkehbamFZhnPiPv4HGZ9 0UtRyiL7s63BW4eqOOInV7xouvu5LWnTxAkQy3gapWfaKkRwU83L9333zGomnTjvKBp+ pP+Q== 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=PI60i6LMtEaGab0T+3YXrhzreBxzzB8kZfJse1Aiu0E=; b=DUwfX9mc9EkhFZp7X7f36gcC4VJnGamnFMLxwfhc90pNQ+nK3KlvMDopplf+uW3jtG c1GwVC3WFL+xyWKlgj/zZV0QNObaOSLgXdVLqIgomcAyYWIuRhjmLKVf3hltN54ukKei B6BO1nQAbRQffG5NSBS2gdrt4hd42RVgynMFP4HU2uY3Pu0LvMir1f0TdIIoSxuDch8f IKUK4WlIbdvcXRr53gyx17mDT8WXqSSzGyeGj1KCnlIrpPdg77dWmOvbUmUExDnLpEsj Z1Pt2bUgTNkyy+hJlSEfAu6VAhp4gwNVaVF5Nz2zGHhJAMSf5x1m26Z7xqV+8cTlE6xW uCeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Y3/8PJhU; dkim=pass header.i=@codeaurora.org header.s=default header.b=YJvz/3DU; 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 k1-v6si3086125pld.75.2018.03.10.10.28.08; Sat, 10 Mar 2018 10:28:22 -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=Y3/8PJhU; dkim=pass header.i=@codeaurora.org header.s=default header.b=YJvz/3DU; 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 S1751512AbeCJSZt (ORCPT + 99 others); Sat, 10 Mar 2018 13:25:49 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:59798 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751441AbeCJSZr (ORCPT ); Sat, 10 Mar 2018 13:25:47 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 983BC60592; Sat, 10 Mar 2018 18:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520706346; bh=m77HVOgKvErH5L9AdIRdzIzM31LnqIOc6Bw1T8d6+xI=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Y3/8PJhUj/Hn7uDrsvPpwbsYaGTLAgqMDqNQjgrn3BydWvHa0YPiSYq+W3aWhZ7OA qQNYg7IpS6aZ6YRyfRCxMtHLn6yih109pIqY4wfZWqkeHF/HGcT9Aanc0YhcUK2slm Ug819qZWrzuS3IGhTA3fXbpD8DbEas9S7U/JxnBo= 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 A924660592; Sat, 10 Mar 2018 18:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520706345; bh=m77HVOgKvErH5L9AdIRdzIzM31LnqIOc6Bw1T8d6+xI=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=YJvz/3DUOq8kyZVSQC1jDwlb5FQ+XhsJxHvfWq8HC0s//+2oOgrsnYygS1lO9CbhX gsIfJm9VidWom77v1Wyr3bI0uyE5eerfLWRnH9Bg8HdkrwpR5mKSw07gJsFMVK6F70 xCVcjBYrtmKw68R6F7Hft5MAohmNy2nGbBnFtCpQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A924660592 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: KVM: Use SMCCC_ARCH_WORKAROUND_1 for Falkor BP hardening To: Will Deacon Cc: Thomas Speier , Vikram Sethi , Sean Campbell , Marc Zyngier , Catalin Marinas , linux-kernel , Christoffer Dall , kvmarm , linux-arm-kernel References: <1520027418-10646-1-git-send-email-shankerd@codeaurora.org> <20180305155614.GG6618@arm.com> <05c25982-4939-593f-ad30-bf496e879885@codeaurora.org> <20180305171529.GA12869@arm.com> <770bb422-7a53-06b9-a136-4e38a0a4bed2@codeaurora.org> <20180306152540.GC18477@arm.com> From: Shanker Donthineni Message-ID: Date: Sat, 10 Mar 2018 12:25:43 -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: <20180306152540.GC18477@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 Will, On 03/06/2018 09:25 AM, Will Deacon wrote: > On Mon, Mar 05, 2018 at 12:03:33PM -0600, Shanker Donthineni wrote: >> On 03/05/2018 11:15 AM, Will Deacon wrote: >>> On Mon, Mar 05, 2018 at 10:57:58AM -0600, Shanker Donthineni wrote: >>>> On 03/05/2018 09:56 AM, Will Deacon wrote: >>>>> On Fri, Mar 02, 2018 at 03:50:18PM -0600, Shanker Donthineni wrote: >>>>>> @@ -199,33 +208,15 @@ static int enable_smccc_arch_workaround_1(void *data) >>>>>> return 0; >>>>>> } >>>>>> >>>>>> + if (((midr & MIDR_CPU_MODEL_MASK) == MIDR_QCOM_FALKOR) || >>>>>> + ((midr & MIDR_CPU_MODEL_MASK) == MIDR_QCOM_FALKOR_V1)) >>>>>> + cb = qcom_link_stack_sanitization; >>>>> >>>>> Is this just a performance thing? Do you actually see an advantage over >>>>> always making the firmware call? We've seen minimal impact in our testing. >>>>> >>>> >>>> Yes, we've couple of advantages using the standard SMCCC_ARCH_WOKAROUND_1 framework. >>>> - Improves the code readability. >>>> - Avoid the unnecessary MIDR checks on each vCPU exit. >>>> - Validates ID_AA64PFR0_CVS2 feature for Falkor chips. >>>> - Avoids the 2nd link stack sanitization workaround in firmware. >>> >>> What I mean is, can we drop qcom_link_stack_sanitization altogether and >>> use the SMCCC interface for everything? >>> >> >> No, We would like to keep it qcom_link_stack_sanitization for host kernel >> since it takes a few CPU cycles instead of heavyweight SMCCC call. > > Is that something that you can actually measure in the workloads and > benchmarks that you care about? If so, fine, but that doesn't seem to be the > case for the Cortex cores we've looked at internally and it would be nice to > avoid having different workarounds in the kernel just because the SMCCC > interface wasn't baked in time, rather than because there's a meaningful > performance difference. > We've seen noticeable performance improvement with the microbench workloads, ans also some of our customers have observed improvements on heavy workloads. Unfortunately I can't share those specific results here. SMCCC call overhead is much higher as compared to link stack workaround on Falkor, ~99X. Host kernel workaround takes less than ~20 CPU cycles, whereas SMCCC_ARCH_WOKAROUND_1 consumes thousands of CPU cycles to sanitize the branch prediction on Falkor. Especially workloads inside virtual machines provides much better results because no KVM involvement is required whenever guest calls qcom_link_stack_sanitization(). > Will > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > -- 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.