Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp875632ybx; Tue, 5 Nov 2019 06:57:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwgz4qnnJstfgFOk1lSkMthkid+qvbRUhinR0KkiI5SUPIJ8cZoOAiSaxXPBE3+Y+XDQwpd X-Received: by 2002:a50:e606:: with SMTP id y6mr36453762edm.261.1572965859758; Tue, 05 Nov 2019 06:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572965859; cv=none; d=google.com; s=arc-20160816; b=jgKrz4cGXvZRJMhxnLZL0r3UzDs8osp+RdGXRxuKBtZ6Z8YajYc3v14V3yKT6sAJB0 6q2GUlIuCE2mg5dEwrpH6jhzVdMp57PUoB9zFCN/eFuB6TIGSwuYBTumiwGXbZ5jptdk WsOh8IVW+GdohOy18Ozfoib4uXlBxlEzEYm5zLbWWbY5nPkVgnl5VnzUCSeJoeycVcY2 EXgUstYnm9TRFwDUsv6ajSjCeRmUKCn37y5EfP/H0JsXkQ2AyFv/0ySazfR7nu+jZsk/ 8KS2e/wpvXuu+fM1+ymkgNB65hdxhVcUKdnArJzygcZn9r/DaEsLdqS8BPVI4D/T6g3W R2sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:cc:from:date:content-transfer-encoding:mime-version :subject:to; bh=fC2Y5Lw8RnOCe3ThhSeAvDYClOuhoHfkZl05FIJCspk=; b=u/77xxuDSqidBNiPVn5I7KOPP0ttaN//pzYQsm/c/ZjQiYkxEUfsk1f6+Llk+q6xua jRFkb7UFdpZkzMnuUc5DCa0vcVE6LTPifH1Y/YS+Ccp75qEgfE9lG+t9Oiuzn1wBkzTA P3HJ9jDe/VEeqXJ6MaR4gvn8qbt402Wp3eGEFQvbie136HNI6tdPiJH9XZYQ9pnSIpgl JEQ5mg9BpHaEG8Tg7WCS2s94ijf8wRmkbAZaaBJh4vKE3n8lNI2H3sCcRxAvbtoS78FY lU7xTPJnUse+fAYAPvogmISj20Av+EhngOVj74IOielSLqkaoi/zeqfbwYRXhF+B+2EH izxg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v29si10796553edc.436.2019.11.05.06.57.14; Tue, 05 Nov 2019 06:57:39 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389323AbfKEO4B (ORCPT + 99 others); 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...