Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8516063imu; Tue, 4 Dec 2018 09:32:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/VnA/UbUZEh79w26oAdwxHxavIY2D0APgSKXNqPZdq4AuwXs05yj1y+7u7U8Vy1WyTDv6GW X-Received: by 2002:a17:902:5ac7:: with SMTP id g7mr21118824plm.212.1543944720682; Tue, 04 Dec 2018 09:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543944720; cv=none; d=google.com; s=arc-20160816; b=TL0hYNAdzyq5z5GBdYRuo5I8Yde97VRZXDh/sxcZZByicigr089e6rsshoQ8HVIUNI 3bHtvLny/Pyn+Qmq69Q56Chk/R1WPbr4rQbOdhKqG3i+ja7Q9LwS5rNN15VJ3RywFknX Qq3c8FXgwVAtsZCw65CmO6PdhEw7TFD93A+JdR9c76SguUWsPqIfO9EJhXH+siH9/pEH axL7zoJx/CsJLrxCimKI3t3QPLRX5h6wVIqtZgcqL/ILBCAeLGSV+u044bpZtnIVg0KN iMXiMEeZROb42kl7eu5iug2QDtbsaiu4RHMWS3+mGu2PxyebqRpNaqXWfmMOnhXf1+bh E3ZA== 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; bh=lF9twhMynyeNCPO7RycT1MsaGWEMrNwupDvW6cfgCD0=; b=t+CJseWhsUqWNKSJYzAnZjyNQmD76jIV8FnejtQEsMXOyRb63xCWASuUTuMLgBEsWx 1R0D6HRSCXBgqlDALH3D5gWnEDGzWXwKesvWG3onGahTwSQgJ89ZBT00sokQxIz1InTl D5uAMBF+CRjU+YeRkH7Zypg+idKEX7ro0u3DBmTtD+0uhoF0Og9GkmBjtsXLVVG/7fBd XNJ5wx+GZhmkeJAzQJ0vhOLuKiCYiA74o05G99URFX5Tr1eE3Dqgsqgfq8b9BexrlyVR gyPndnhdlnaNMJZBf9q04MojOL621fQrtyJRW96KnkXpWoVCPVuETkUZsnPHS31Xcvap 8SmQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d32si18255434pla.136.2018.12.04.09.31.44; Tue, 04 Dec 2018 09:32:00 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726941AbeLDRa6 (ORCPT + 99 others); Tue, 4 Dec 2018 12:30:58 -0500 Received: from foss.arm.com ([217.140.101.70]:37766 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726226AbeLDRa5 (ORCPT ); Tue, 4 Dec 2018 12:30:57 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4F19CA78; Tue, 4 Dec 2018 09:30:57 -0800 (PST) Received: from [10.1.197.36] (e112298-lin.cambridge.arm.com [10.1.197.36]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7FF833F59C; Tue, 4 Dec 2018 09:30:55 -0800 (PST) Subject: Re: [PATCH v6 07/24] arm64: Make PMR part of task context To: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, daniel.thompson@linaro.org, marc.zyngier@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, christoffer.dall@arm.com, james.morse@arm.com, joel@joelfernandes.org, Dave Martin References: <1542023835-21446-1-git-send-email-julien.thierry@arm.com> <1542023835-21446-8-git-send-email-julien.thierry@arm.com> <20181204170908.GB19210@arrakis.emea.arm.com> From: Julien Thierry Message-ID: Date: Tue, 4 Dec 2018 17:30:53 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20181204170908.GB19210@arrakis.emea.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 On 04/12/18 17:09, Catalin Marinas wrote: > On Mon, Nov 12, 2018 at 11:56:58AM +0000, Julien Thierry wrote: >> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S >> index 039144e..eb8120e 100644 >> --- a/arch/arm64/kernel/entry.S >> +++ b/arch/arm64/kernel/entry.S >> @@ -249,6 +249,12 @@ alternative_else_nop_endif >> msr sp_el0, tsk >> .endif >> >> + /* Save pmr */ >> +alternative_if ARM64_HAS_IRQ_PRIO_MASKING >> + mrs_s x20, SYS_ICC_PMR_EL1 >> + str x20, [sp, #S_PMR_SAVE] >> +alternative_else_nop_endif >> + >> /* >> * Registers that may be useful after this macro is invoked: >> * >> @@ -269,6 +275,13 @@ alternative_else_nop_endif >> /* No need to restore UAO, it will be restored from SPSR_EL1 */ >> .endif >> >> + /* Restore pmr */ >> +alternative_if ARM64_HAS_IRQ_PRIO_MASKING >> + ldr x20, [sp, #S_PMR_SAVE] >> + msr_s SYS_ICC_PMR_EL1, x20 >> + dsb sy >> +alternative_else_nop_endif > > What's this DSB for? If it's needed, please add a comment. > The DSB is to make sure that, in the case we are unmasking interrupt priorities, the unmasking is seen by the redistributor. Without it the redistributor might only start forwarding interrupts (if their priorities are too low) to the CPU once it has seen that PMR was modified, which could happen after the CPU has returned from the exception. I'll add a comment. > I would have expected an ISB (or none at all as we are going to return > from an exception). So the two reasons we don't need an ISB are: - the only thing that matter is that PMR modification + DSB happens before exception return - writes to ICC_PMR_EL1 are self synchronizing so we don't need an ISB before the DSB Thanks, -- Julien Thierry