Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6381892ybl; Mon, 23 Dec 2019 05:05:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwhsNLd/KuY5txRsTYOiOiD53/ZIXajS8Bte0aRkaCuK3US/oY9ZBBmOyp0RCdZoYLbz6nw X-Received: by 2002:aca:f0b:: with SMTP id 11mr5962633oip.34.1577106327087; Mon, 23 Dec 2019 05:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577106327; cv=none; d=google.com; s=arc-20160816; b=oqmWTTCtIfu3FgkoKiVBb0MHmthvM/6EuYmPnyRIN354cGQU3wizvY8CsWpjArEYo8 nanaDc0F3IJ5GmomQvdjLxZmyycnCVjjP+iRJo4bv91weQwv6zWUiF4mKzCtCqIJ4p9c ZN1zfq5bOH5AeE38aSCjM27UusC9O1giLWFuc1wYt6bBJZ7DP1efKjgaEL/d3MsYFO1x VkUs9868TCKOsCdgVrnKuxJ1jxfv2TQ/pj6mFJR6dXVJ/xcnogaYGL1FMWtdfQwhiXeF UmICAGBcJaxw27uBINf+uDwAPycsmuuh/xcD7lr++ATU4lJMCnsUJE4wFF2s8AIgn9Vi LAUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=/YMggVbc7M6CjZVE5kCb7Ofg44zujSw7jl0Io5iU98k=; b=MiC1Lmj82gyuSEAzA9EQ8iz9ulOifVgZcxP959bfI5DKSQfv0yAsDmUtsLXlT4YKl6 z1eJvvgxXJsANdY2L0U0SBLw3KqBE8ulzGJmZMBwRu9WUVvMa1KKtYJjBxSkhMqlhdzo 7yBjAQDv7udNzStv8BbKjzmjufij85pvdm09zBhpUzj4XTd6TzKhYSreKdQYqHG2ZGzW 9GGaKyukbZmzc/A7ggkQLHfPlQQ/RTbvmL0fNjzQWI8GRr+vzayCbTlecmtSL8lw7GWF VeD3Zy/CB9Dm5FBGtniELcJ5PqDbB0MLMl7yAXLQpEerSs7fw8aPK3AljWcfWIc51O5/ NUKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=olLbObS2; 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 h14si5039408oie.98.2019.12.23.05.05.15; Mon, 23 Dec 2019 05:05:27 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=olLbObS2; 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 S1726959AbfLWNCq (ORCPT + 99 others); Mon, 23 Dec 2019 08:02:46 -0500 Received: from mail26.static.mailgun.info ([104.130.122.26]:40734 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726934AbfLWNCq (ORCPT ); Mon, 23 Dec 2019 08:02:46 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1577106166; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=/YMggVbc7M6CjZVE5kCb7Ofg44zujSw7jl0Io5iU98k=; b=olLbObS2Q+kQQkjq79FRixkMP7L6yYXDlHkOo4T+RoHn8WrshCzCAFCI5Iv5UQj2ZPlDzhnU HYEu3XzGBBEjLgKP/vVLSlAA2z0J/HuxVSZp0kvUL7Kyt1y1Y420FbhpDrAcNu8zQAHqacgX VabEtoVJkpLC9duBGQhufnMfjmI= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e00baf0.7f77e91640a0-smtp-out-n02; Mon, 23 Dec 2019 13:02:40 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6541BC3D694; Mon, 23 Dec 2019 13:02:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from sramana-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sramana) by smtp.codeaurora.org (Postfix) with ESMTPSA id 548BDC3D68C; Mon, 23 Dec 2019 13:02:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 548BDC3D68C Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=sramana@codeaurora.org From: Srinivas Ramana To: will@kernel.org, catalin.marinas@arm.com, maz@kernel.org, will.deacon@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Ramana Subject: [PATCH] arm64: Set SSBS for user threads while creation Date: Mon, 23 Dec 2019 18:32:26 +0530 Message-Id: <1577106146-8999-1-git-send-email-sramana@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current SSBS implementation takes care of setting the SSBS bit in start_thread() for user threads. While this works for tasks launched with fork/clone followed by execve, for cases where userspace would just call fork (eg, Java applications) this leaves the SSBS bit unset. This results in performance regression for such tasks. It is understood that commit cbdf8a189a66 ("arm64: Force SSBS on context switch") masks this issue, but that was done for a different reason where heterogeneous CPUs(both SSBS supported and unsupported) are present. It is appropriate to take care of the SSBS bit for all threads while creation itself. Fixes: 8f04e8e6e29c ("arm64: ssbd: Add support for PSTATE.SSBS rather than trapping to EL3") Signed-off-by: Srinivas Ramana --- arch/arm64/kernel/process.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 71f788cd2b18..a8f05cc39261 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -399,6 +399,13 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, */ if (clone_flags & CLONE_SETTLS) p->thread.uw.tp_value = childregs->regs[3]; + + if (arm64_get_ssbd_state() != ARM64_SSBD_FORCE_ENABLE) { + if (is_compat_thread(task_thread_info(p))) + set_compat_ssbs_bit(childregs); + else + set_ssbs_bit(childregs); + } } else { memset(childregs, 0, sizeof(struct pt_regs)); childregs->pstate = PSR_MODE_EL1h; -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.