Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2839152pjo; Mon, 16 Mar 2020 05:40:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vstJGlNEtQhhiLxRg+YPPtM1Rb6F5RzhePl81pvsFZGUmhFjhwSstYqUnOcnDeFOMEZ7ZGO X-Received: by 2002:aca:d50f:: with SMTP id m15mr16592883oig.19.1584362445185; Mon, 16 Mar 2020 05:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362445; cv=none; d=google.com; s=arc-20160816; b=Quf9IXW6WCOvEjEhz5MNCBCsl34/G2JKDeOmD2a0VX1sH7AUAAutOIYKc2sDED7Pfo FnBlr+wFPL2mv2xoEpuPoOAZ9SlIGbmiy8YOSCQNrnAxGY80TaqG5ZFafb3aviNElbZO Ym+Sv7HTmzpn03LlKpLNqTb1tn17kRejZnUS3GXoGBTRseNmYhcenwJLGx1qgXTE69Jz 1ZLdu/0T6462VL2RZ6e7f+YVM2ihH/DM7lR2tRSqHWnOM7sbvgC0dq3prJEopXkWUW/e nYLLORhLrd4lkhjr3bSWjCHapt+wvFRERLwZMPkEZPiAV0DdbA/B4ZdXUVBnrbnXirRV 2Wtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=zz3LY4LnIULNvU2REeo9vroSmYzMKaaLGdN2qxLIwuw=; b=En3n0FJv7mTn93xfmIaZ/0vlr8hZKd/8Hf9JlKPPi9roxwdz/pD5/SSqpnxHpvhoWN e9DD5yeb2BDgWn3pHH6PgveNXEsEp+zaZwiqbx4OlvTY1Tx0gqeIrrvO4/hlUdlNcZfr 5LeZ0BEorGbUhyfiebODemDs8IXr79gl5kV/yxVuFkkfatF/WsjB2I+je5whsklxUgy+ FnQHIikL2WHpmOH9h3OoLPIwXdMzV3z7aizQMj1MDul9sRa1w4LicLZsU2+0GmQwsbmu R6TrEEBe+5VClhwrwloFKEB3rV+M4+bJ8Kjp5zwfwZ/tBbozWTio0QMPQnGw9AAGmCwH cNcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=a5K8dZM0; 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 66si9638685otx.151.2020.03.16.05.40.32; Mon, 16 Mar 2020 05:40:45 -0700 (PDT) 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; dkim=pass header.i=@c-s.fr header.s=mail header.b=a5K8dZM0; 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 S1731281AbgCPMiP (ORCPT + 99 others); Mon, 16 Mar 2020 08:38:15 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:58171 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731055AbgCPMfv (ORCPT ); Mon, 16 Mar 2020 08:35:51 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48gwkn2WC4z9tygR; Mon, 16 Mar 2020 13:35:45 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=a5K8dZM0; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id b-sdWkBrRdNk; Mon, 16 Mar 2020 13:35:45 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48gwkn1TCfz9tyg5; Mon, 16 Mar 2020 13:35:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584362145; bh=zz3LY4LnIULNvU2REeo9vroSmYzMKaaLGdN2qxLIwuw=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=a5K8dZM0rtPQrBXIENhJKCrGi9u581IUm5g2QO1QBHYk8nD3uEBcPHfiZy2ohQ8ho gI48qROSO33VlFay08xja22eTWgUzjFkhsK2mk603o9Wzm2TFwo/GLR+61BuJaqhFo fKc4fEIGdwFJav/ulZig4Rl/2idpNJ3FmdxRfTlw= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 303AA8B7D0; Mon, 16 Mar 2020 13:35:50 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 8eLsKBpz6-mm; Mon, 16 Mar 2020 13:35:50 +0100 (CET) Received: from pc16570vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1796B8B7CB; Mon, 16 Mar 2020 13:35:50 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 108EA65595; Mon, 16 Mar 2020 12:35:50 +0000 (UTC) Message-Id: <28206484284c1bc83b661de438eba04c6e75a1bc.1584360344.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 05/46] powerpc/kasan: Remove unnecessary page table locking To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 16 Mar 2020 12:35:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 45ff3c559585 ("powerpc/kasan: Fix parallel loading of modules.") added spinlocks to manage parallele module loading. Since then commit 47febbeeec44 ("powerpc/32: Force KASAN_VMALLOC for modules") converted the module loading to KASAN_VMALLOC. The spinlocking has then become unneeded and can be removed to simplify kasan_init_shadow_page_tables() Also remove inclusion of linux/moduleloader.h and linux/vmalloc.h which are not needed anymore since the removal of modules management. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/kasan/kasan_init_32.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c index c41e700153da..c9d053078c37 100644 --- a/arch/powerpc/mm/kasan/kasan_init_32.c +++ b/arch/powerpc/mm/kasan/kasan_init_32.c @@ -5,9 +5,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -34,31 +32,22 @@ static int __init kasan_init_shadow_page_tables(unsigned long k_start, unsigned { pmd_t *pmd; unsigned long k_cur, k_next; - pte_t *new = NULL; pmd = pmd_ptr_k(k_start); for (k_cur = k_start; k_cur != k_end; k_cur = k_next, pmd++) { + pte_t *new; + k_next = pgd_addr_end(k_cur, k_end); if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte) continue; - if (!new) - new = memblock_alloc(PTE_FRAG_SIZE, PTE_FRAG_SIZE); + new = memblock_alloc(PTE_FRAG_SIZE, PTE_FRAG_SIZE); if (!new) return -ENOMEM; kasan_populate_pte(new, PAGE_KERNEL); - - smp_wmb(); /* See comment in __pte_alloc */ - - spin_lock(&init_mm.page_table_lock); - /* Has another populated it ? */ - if (likely((void *)pmd_page_vaddr(*pmd) == kasan_early_shadow_pte)) { - pmd_populate_kernel(&init_mm, pmd, new); - new = NULL; - } - spin_unlock(&init_mm.page_table_lock); + pmd_populate_kernel(&init_mm, pmd, new); } return 0; } -- 2.25.0