From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.4 required=3.0 tests=BUG6152_INVALID_DATE_TZ_ABSURD,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INVALID_DATE_TZ_ABSURD,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C8EAC17498 for ; Tue, 5 Nov 2019 14:56:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 638DE217F5 for ; Tue, 5 Nov 2019 14:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572965762; bh=5hcg8ghxSHxPjlGqTjjIe+i79uK3s5zbWA5ceL1DZRI=; h=To:Subject:Date:From:Cc:In-Reply-To:References:List-ID:From; b=IVEkAFrGfvCmhCzrUOU73XfSmHNVyxEnh04Dm4JAoeDhCy+PbVIPu8rPYnwwillc2 T5iAqcM8XPva84eNrgTmJjH1+tw2jgQkiUpejZtxOUsYytnMAG3KAxD3fD8ykyNeyn ZxibXHXTmqCw4WRO2aA4YIO1gpk55megmVAJhwVY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389464AbfKEO4B (ORCPT ); Tue, 5 Nov 2019 09:56:01 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:42262 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389138AbfKEO4A (ORCPT ); Tue, 5 Nov 2019 09:56:00 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1iS0Ew-0000Z9-LF; Tue, 05 Nov 2019 15:55:26 +0100 To: Sami Tolvanen Subject: Re: [PATCH v4 13/17] arm64: preserve x18 when CPU is suspended X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 05 Nov 2019 16:04:47 +0109 From: Marc Zyngier Cc: Nick Desaulniers , Will Deacon , Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Ard Biesheuvel , Dave Martin , Kees Cook , Laura Abbott , Mark Rutland , Jann Horn , Miguel Ojeda , Masahiro Yamada , clang-built-linux , Kernel Hardening , linux-arm-kernel , LKML In-Reply-To: References: <20191018161033.261971-1-samitolvanen@google.com> <20191101221150.116536-1-samitolvanen@google.com> <20191101221150.116536-14-samitolvanen@google.com> <02c56a5273f94e9d832182f1b3cb5097@www.loen.fr> Message-ID: <5486328a221c9eaef8956983f70380f1@www.loen.fr> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: samitolvanen@google.com, ndesaulniers@google.com, will@kernel.org, catalin.marinas@arm.com, rostedt@goodmis.org, mhiramat@kernel.org, ard.biesheuvel@linaro.org, dave.martin@arm.com, keescook@chromium.org, labbott@redhat.com, mark.rutland@arm.com, jannh@google.com, miguel.ojeda.sandonis@gmail.com, yamada.masahiro@socionext.com, clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-11-05 01:11, Sami Tolvanen wrote: > On Mon, Nov 4, 2019 at 1:59 PM Nick Desaulniers > wrote: >> >> On Mon, Nov 4, 2019 at 1:38 PM Sami Tolvanen >> wrote: >> > >> > On Mon, Nov 4, 2019 at 5:20 AM Marc Zyngier >> wrote: >> > > > ENTRY(cpu_do_suspend) >> > > > mrs x2, tpidr_el0 >> > > > @@ -73,6 +75,9 @@ alternative_endif >> > > > stp x8, x9, [x0, #48] >> > > > stp x10, x11, [x0, #64] >> > > > stp x12, x13, [x0, #80] >> > > > +#ifdef CONFIG_SHADOW_CALL_STACK >> > > > + str x18, [x0, #96] >> > > > +#endif >> > > >> > > Do we need the #ifdefery here? We didn't add that to the KVM >> path, >> > > and I'd feel better having a single behaviour, specially when >> > > NR_CTX_REGS is unconditionally sized to hold 13 regs. >> > >> > I'm fine with dropping the ifdefs here in v5 unless someone >> objects to this. >> >> Oh, yeah I guess it would be good to be consistent. Rather than >> drop >> the ifdefs, would you (Marc) be ok with conditionally setting >> NR_CTX_REGS based on CONFIG_SHADOW_CALL_STACK, and doing so in KVM? >> (So 3 ifdefs, rather than 0)? >> >> Without any conditionals or comments, it's not clear why x18 is >> being >> saved and restored (unless git blame survives, or a comment is added >> in place of the ifdefs in v6). > > True. Clearing the sleep state buffer in cpu_do_resume is also > pointless without CONFIG_SHADOW_CALL_STACK, so if the ifdefs are > removed, some kind of an explanation is needed there. I can't imagine the overhead being noticeable, and I certainly value minimizing the testing space. Sticking a comment there should be enough for people hacking on this to understand that this isn't entirely dead code. Thanks, M. -- Jazz is not dead. It just smells funny... From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=3.0 tests=BUG6152_INVALID_DATE_TZ_ABSURD,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID, INVALID_DATE_TZ_ABSURD,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C13B0C17460 for ; Tue, 5 Nov 2019 14:56:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97008217F5 for ; Tue, 5 Nov 2019 14:56:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="teiEjIkO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97008217F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:From:Date: MIME-Version:Subject:To:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qHPKDGt7ygCxqEunLZy2mhVf68lD8WUDpAjdK5vNcF4=; b=teiEjIkOc6n+X6EUULpuJLuxH raa7HrxkQr/AJN5VxC2qLS9x+VWll7IAQl+A/kbMfY0R42TVJbsr+nE5V7NScOHhV+wqRZ0TtM22G yRvkmg7KTfN4fN9nf/yu+2F3c4Ssc9uZXOvhqxbg6kPF7zN8IFG7roNOCJtVoGVJOIqh0eJjYcgL3 ugC8tieAxRuIKh37rVBsPiAsdvWYqgjxUr6/mgRuC1P1GlvzQ/4ZO5Miuy1kW/RyWFNZi5kmDOzQp VpNDVU+t62NdX3yPx2yiz3Mqi9IfOMOGf1C7iXxwh6ubhfB/f1u0ilbm/hO9JnCQ3rvYlh7iJ7jjb QUhYJW9ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iS0FV-0003yc-ME; Tue, 05 Nov 2019 14:56:01 +0000 Received: from inca-roads.misterjones.org ([213.251.177.50]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iS0FS-0003xb-1H for linux-arm-kernel@lists.infradead.org; Tue, 05 Nov 2019 14:55:59 +0000 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1iS0Ew-0000Z9-LF; Tue, 05 Nov 2019 15:55:26 +0100 To: Sami Tolvanen Subject: Re: [PATCH v4 13/17] arm64: preserve x18 when CPU is suspended X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Date: Tue, 05 Nov 2019 16:04:47 +0109 From: Marc Zyngier In-Reply-To: References: <20191018161033.261971-1-samitolvanen@google.com> <20191101221150.116536-1-samitolvanen@google.com> <20191101221150.116536-14-samitolvanen@google.com> <02c56a5273f94e9d832182f1b3cb5097@www.loen.fr> Message-ID: <5486328a221c9eaef8956983f70380f1@www.loen.fr> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: samitolvanen@google.com, ndesaulniers@google.com, will@kernel.org, catalin.marinas@arm.com, rostedt@goodmis.org, mhiramat@kernel.org, ard.biesheuvel@linaro.org, dave.martin@arm.com, keescook@chromium.org, labbott@redhat.com, mark.rutland@arm.com, jannh@google.com, miguel.ojeda.sandonis@gmail.com, yamada.masahiro@socionext.com, clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191105_065558_225588_6679688C X-CRM114-Status: GOOD ( 14.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kees Cook , Ard Biesheuvel , Masahiro Yamada , Catalin Marinas , Jann Horn , Nick Desaulniers , LKML , Steven Rostedt , Miguel Ojeda , Masami Hiramatsu , clang-built-linux , Kernel Hardening , Laura Abbott , Will Deacon , Dave Martin , linux-arm-kernel Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2019-11-05 01:11, Sami Tolvanen wrote: > On Mon, Nov 4, 2019 at 1:59 PM Nick Desaulniers > wrote: >> >> On Mon, Nov 4, 2019 at 1:38 PM Sami Tolvanen >> wrote: >> > >> > On Mon, Nov 4, 2019 at 5:20 AM Marc Zyngier >> wrote: >> > > > ENTRY(cpu_do_suspend) >> > > > mrs x2, tpidr_el0 >> > > > @@ -73,6 +75,9 @@ alternative_endif >> > > > stp x8, x9, [x0, #48] >> > > > stp x10, x11, [x0, #64] >> > > > stp x12, x13, [x0, #80] >> > > > +#ifdef CONFIG_SHADOW_CALL_STACK >> > > > + str x18, [x0, #96] >> > > > +#endif >> > > >> > > Do we need the #ifdefery here? We didn't add that to the KVM >> path, >> > > and I'd feel better having a single behaviour, specially when >> > > NR_CTX_REGS is unconditionally sized to hold 13 regs. >> > >> > I'm fine with dropping the ifdefs here in v5 unless someone >> objects to this. >> >> Oh, yeah I guess it would be good to be consistent. Rather than >> drop >> the ifdefs, would you (Marc) be ok with conditionally setting >> NR_CTX_REGS based on CONFIG_SHADOW_CALL_STACK, and doing so in KVM? >> (So 3 ifdefs, rather than 0)? >> >> Without any conditionals or comments, it's not clear why x18 is >> being >> saved and restored (unless git blame survives, or a comment is added >> in place of the ifdefs in v6). > > True. Clearing the sleep state buffer in cpu_do_resume is also > pointless without CONFIG_SHADOW_CALL_STACK, so if the ifdefs are > removed, some kind of an explanation is needed there. I can't imagine the overhead being noticeable, and I certainly value minimizing the testing space. Sticking a comment there should be enough for people hacking on this to understand that this isn't entirely dead code. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel