From patchwork Mon May 29 15:14:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 9753347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BD96960249 for ; Mon, 29 May 2017 15:14:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADC612849E for ; Mon, 29 May 2017 15:14:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB30928515; Mon, 29 May 2017 15:14:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 696EE2849E for ; Mon, 29 May 2017 15:14:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751011AbdE2PO1 (ORCPT ); Mon, 29 May 2017 11:14:27 -0400 Received: from mout.gmx.net ([212.227.17.22]:57694 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbdE2PO0 (ORCPT ); Mon, 29 May 2017 11:14:26 -0400 Received: from ls3530.fritz.box ([193.159.22.181]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LdKs1-1dg8YE08xt-00iSqE; Mon, 29 May 2017 17:14:19 +0200 Date: Mon, 29 May 2017 17:14:16 +0200 From: Helge Deller To: linux-parisc@vger.kernel.org, James Bottomley , John David Anglin Subject: [PATCH] parisc/mm: Ensure IRQs are off in switch_mm() Message-ID: <20170529151415.GA20946@ls3530.fritz.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.8.0 (2017-02-23) X-Provags-ID: V03:K0:egF2YB3hX498jODZgxka3H5Dqr2vWEnifWCpvWVD0bHXSCuw+6u Uj4piqG7LhS/gquZFQ9ayQ1tkBdud/oWqCNi+D+9WUzCxp56861CR5fvUD1i4AGJlkvPELC c1uM/snGZXyxI7RgD0yVMUWESz6G/ja6jThE5vShEYjSi8pztzXAIOGyX9ybGNcc6YH2H1C O9iAlIC8xa4lNtN/KXqqw== X-UI-Out-Filterresults: notjunk:1; V01:K0:0hDRNGdg4v8=:Kiznc7DLuf7ja9SSWjxrJw nWaH8YaOh5TIOdC+jdNuX9je1W4PVf6FTLDDW1fl+zJCL0EmkhSO4FIj0PnRvC5RAbjjAYCth phP4vftJsIWcHzEB6g3A4p7SFUc0CaIy7yTZTZNUgEsw7n0+4ccqW/Fqw+PXSKCGce6XwD8wj tUiwm93/xS18evkfR+PZZnLaw7Jq8A/anfwmXSlR2wVryBFhKlS2oEmxFBS1QhMUTt4Olpr0n ZEXQ0t/ekvUzypUJDJnx72Jed/O4BHhw2ses55dClo3RTAx1YumExSoAn6QEX3tLI9HNgnwHE WZNxHMdsOt/rbtAcxtIqLvlXllh7NvZA03pUlBHHuPLuBn0RmYfLSpAALUi5cGdHqrUTJaA1t HDz0B+y02bvBOPfy9fswrZDVZNHHh+avlRwZf9fulZPN+5WWd3ru15F8GO8wMn8h9PnpobpbL Dhr38cmf41MLzEOs0s1j+1gq46MSJcYa2OZypVDQ6QRDupu6qf24M1MuyuE16sLj6K8SH/6YQ 2k/phe5zKBb0akyI5NIUS5xszBPGWphZ05MS0nfVlhQ51sCO3tm2KNvRF33OXFWg1jlffmGzp 347lcpUXx3mm9rso3NHgggnaY0gVQtttWWHiLtd+oFkD9mra8PzQAKPKPwuRep0beo36t5A4s LahBFp0PN+ps1XF96zAk6YKtMmJDdwT//f+bI+ZRBcIb/B8Egx49+XfegNuSma/rwtlJXTOPj 6qWVFTEeUEJPGYEL0FRIw+U6gt2xMvrk55Hjtr9R+oNEZ38Tf4AcSH9IAMs= Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is because of commit f98db6013c55 ("sched/core: Add switch_mm_irqs_off() and use it in the scheduler") in which switch_mm_irqs_off() is called by the scheduler, vs switch_mm() which is used by use_mm(). This patch lets the parisc code mirror the x86 and powerpc code, ie. it disables interrupts in switch_mm(), and optimises the scheduler case by defining switch_mm_irqs_off(). Signed-off-by: Helge Deller Cc: stable@vger.kernel.org # v4.7+ --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/include/asm/mmu_context.h b/arch/parisc/include/asm/mmu_context.h index 59be257..a812262 100644 --- a/arch/parisc/include/asm/mmu_context.h +++ b/arch/parisc/include/asm/mmu_context.h @@ -49,15 +49,26 @@ static inline void load_context(mm_context_t context) mtctl(__space_to_prot(context), 8); } -static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) +static inline void switch_mm_irqs_off(struct mm_struct *prev, + struct mm_struct *next, struct task_struct *tsk) { - if (prev != next) { mtctl(__pa(next->pgd), 25); load_context(next->context); } } +static inline void switch_mm(struct mm_struct *prev, + struct mm_struct *next, struct task_struct *tsk) +{ + unsigned long flags; + + local_irq_save(flags); + switch_mm_irqs_off(prev, next, tsk); + local_irq_restore(flags); +} +#define switch_mm_irqs_off switch_mm_irqs_off + #define deactivate_mm(tsk,mm) do { } while (0) static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)