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=-4.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 E820FC48BD1 for ; Fri, 11 Jun 2021 08:21:11 +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 A889B613AE for ; Fri, 11 Jun 2021 08:21:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A889B613AE 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+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.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lZ5BabE9YimVU5SAZI9v4lEm8ghg+Ph8S0P3tYgWc3g=; b=RLLQb9AUW2hf2B 0m9ORE7ngvPMMakUBIS7nWRkAIJWYJPEilOYgUSfl+hRxET4DdRtFwWik7maXc7aqSOMKiYfEKDqD 2JuL2nnfMNmqAx6HbtBNMyfbKVHGnmmFHbUiaDoSbR07b0mSEBpxvUAJ0QYGkBN7Qg6QelDCY0QBe Mqe2IKpEQnggGLpMvUDGe3TUCCb/eDsMssLt7DTdQpClhbKpAXvTjUIM316oh/uh1G6jNJZvTB3TJ T1WIsZNO/4S0HLe+TTZlKMQI6B+yddAFblMHVJJ7dj3tWUA4Up92p1d4oj4Q0IVTqdGUm+nx6Idw7 75ArpvY5IAlpemQoFOYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrcO1-004JOn-VA; Fri, 11 Jun 2021 08:19:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrcNy-004JO5-B2 for linux-arm-kernel@lists.infradead.org; Fri, 11 Jun 2021 08:19:27 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5288613AE; Fri, 11 Jun 2021 08:19:25 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lrcNv-006vFk-FL; Fri, 11 Jun 2021 09:19:23 +0100 Date: Fri, 11 Jun 2021 09:19:22 +0100 Message-ID: <87eed8reyd.wl-maz@kernel.org> From: Marc Zyngier To: Lorenzo Pieralisi Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , Catalin Marinas , Mark Rutland , Valentin Schneider , Alexandru Elisei , Russell King , kernel-team@android.com Subject: Re: [PATCH 0/3] arm64: Fix cpuidle with pseudo-NMI enabled In-Reply-To: <20210610162823.GA20025@lpieralisi> References: <20210608172715.2396787-1-maz@kernel.org> <20210610162823.GA20025@lpieralisi> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: lorenzo.pieralisi@arm.com, linux-arm-kernel@lists.infradead.org, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, valentin.schneider@arm.com, alexandru.elisei@arm.com, linux@armlinux.org.uk, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210611_011926_433824_AD7DC9EF X-CRM114-Status: GOOD ( 32.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Lorenzo, On Thu, 10 Jun 2021 17:28:23 +0100, Lorenzo Pieralisi wrote: > > On Tue, Jun 08, 2021 at 06:27:12PM +0100, Marc Zyngier wrote: > > It appears that although cpu_do_idle() is correctly dealing with the > > PMR/DAIF duality, the PSCI cpu-suspend code has been left unaware of > > it. > > > > On a system that uses PSCI for idle (such as the Ampere Altra I have > > access to), the kernel dies as soon as it enters idle (interrupts are > > off at the GIC CPU interface level). Boo. > > After investigating a bit I realised that this should depend on > ICC_CTLR_EL3.PMHE - if that's clear the PMR should not affect the > GICR->CPU IRQ forwarding (or WakeRequest signal generation when the > GICR_WAKER.ProcessorSleep==1). You lost me here. I don't see what PMHE has to do here. It is solely used for 1:N distribution, and is the only way PMR does affect the propagation of interrupts to the CPU interface. Fortunately, nobody uses 1:N. > IIUC if PMHE == 0, the PMR plays no role in wfi completion (and > WakeSignal generation for a CPU/GICR in quiescent state). Of course it does. PMR gates interrupts *before* they are signalled to the CPU, meaning that if you keep interrupt masked at the PMR level, you will never wake up from WFI. Or am I missing your point entirely? > > I assume on Ampere Altra PMHE == 1. No, it is 0, as indicated by: [ 0.000000] GICv3: Pseudo-NMIs enabled using relaxed ICC_PMR_EL1 synchronisation > This changes almost nothing to the need for this patchset but > at least we clarify this behaviour. > > Also, we should not be writing ICC_PMR_EL1 when > GICR_WAKER.ProcessorSleep == 1 (which may be set in > gic_cpu_pm_notifier()), this can hang the system. Why? PMR defines what interrupts will be presented to the CPU interface and trigger an exception. It doesn't affect putting the CPU to sleep nor the wake-up. > I wonder whether this arm_cpuidle_{save,restore}_context() should > be moved into the gic_cpu_pm_notifier() itself - which would > solve also the PSCI suspend issue Sudeep raised - it would be Moving from PMR to DAIF masking is something we only do on particular spots (exception entry/exit, guest entry/exit) as it affects the behaviour of simple things such as local_irq_*(). Moving it to a higher level feels super dangerous. > a bit ugly though (CPU PM notifiers are run in S2R and CPUidle > automatically and this would work for any S2R/CPUidle backend > other than PSCI even though that does not/will never exist on > arm64 ;-)) > > https://lore.kernel.org/linux-arm-kernel/20210608182044.ayqa6fbab4jyz7kp@bogus > > I still believe this series is right - just raised these points > for discussion. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel