From patchwork Mon Jul 31 12:05:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFyay1QSyBUc2FpICjolKHmspvliZsp?= X-Patchwork-Id: 128658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1994825vqg; Mon, 31 Jul 2023 05:59:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/y9IlpB/wdf4nE/2O59hhAq0j70VWhp49EfLCGMwwDn4qZC/RMtZxhvWxTze/BB0yUhkc X-Received: by 2002:a2e:9a89:0:b0:2b9:e701:ac48 with SMTP id p9-20020a2e9a89000000b002b9e701ac48mr2261034lji.32.1690808349341; Mon, 31 Jul 2023 05:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690808349; cv=none; d=google.com; s=arc-20160816; b=m2H0SAXlKEap2vB2QZMRW7h4J+qQeMOOi09VGDp9/qXL7rvRegdKpVsDzPRNShD2RO tF7EnNbK1XUte3u0jsADWWHHPZfaVGZgz8auo0Igl2r2gOZQBiY2MnEJTLkcIQM77Sjm H2L77rDlxmGD6n8g1YPxJo1V3F04iBuC+XZYiWpHF98lwegmOiD2l2oV1o9A3OaGr6o4 RIgsQ5g1h+VQfSEiCJcwfAg9Yr5Axr7kBLTa+bZk9L3V18jmZCYT2w3tK9rdDX2Rf112 U6Ji+UFz9pe7SxSWPt2sftf6ih/zr6h+pIf6XSZkHDz8PeuAJT7WzdCvxcB9CKTgZNAc 0Ufw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=C6CrSBdjoAyzVpB6u/w8qzO48wNDLvceWe2rRQBmWzY=; fh=xPz9/4W86eE1k+3tCnyVusRA5QBWjrMuJUN7jlubcu4=; b=zVrJl4guK3pfvmnxlpqfSe2R+G8TebX5v3ZP5afjQYc318z3LXSEGNot8G8P0LYi5B 1qDG2bHexCuEJZSOr4/F+CX9EX9RBHNBo4pwaii5zhclfbM2r6akmNzoO6hGUk0GcMeS KqW+ARJSlQIDxjV/3QVw97biIDpQvXsv4UXFHuIBb9ZH+4tJlppZ/jDMvbK0wqngMsoU 9HCB0kIWUohC3+KaTYFnzGQvxdrihISENHm83Kl/1og4S5BQCKLDROvmLm2Cf2vKcy7S DXt+GTkLDxysrqIGER3NYiBMBUecFy12YJCV66sdD/cOKEFSuj5BrlGKVeovBSWEFCYP RkZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=dkhSndMq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lu32-20020a170906fae000b00988d0cd5273si2901131ejb.112.2023.07.31.05.58.45; Mon, 31 Jul 2023 05:59:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=dkhSndMq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232461AbjGaMGZ (ORCPT + 99 others); Mon, 31 Jul 2023 08:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbjGaMGU (ORCPT ); Mon, 31 Jul 2023 08:06:20 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C6BE1728 for ; Mon, 31 Jul 2023 05:05:53 -0700 (PDT) X-UUID: 966417702f9a11eeb20a276fd37b9834-20230731 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=C6CrSBdjoAyzVpB6u/w8qzO48wNDLvceWe2rRQBmWzY=; b=dkhSndMqGlZ9VYhEzuPygaPnNLY9kuMGzrE1CW1EF5p95rcnNJCh3NNOPBMSAulzKmf6KTd30rHaRdqPE7z9Di4S6NqY9EuQsAue8GtsE+tZI3xErMmWtZWu9awXTNE8rGnAhFU/j7xLogUg32HLadMU65hG/BzHrDtnSVY4PUw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.30,REQID:e10c6e47-7cf2-4c21-9392-b58fe3e93d76,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:1fcc6f8,CLOUDID:c39bfbb3-a467-4aa9-9e04-f584452e3794,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 966417702f9a11eeb20a276fd37b9834-20230731 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1546789419; Mon, 31 Jul 2023 20:05:48 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 31 Jul 2023 20:05:47 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 31 Jul 2023 20:05:47 +0800 From: Mark-PK Tsai To: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Russell King , Matthias Brugger , AngeloGioacchino Del Regno CC: , Mark-PK Tsai , , , , Subject: [PATCH] arm: kasan: Use memblock_alloc_try_nid_raw for shadow page allocation Date: Mon, 31 Jul 2023 20:05:36 +0800 Message-ID: <20230731120537.13152-1-mark-pk.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RDNS_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772941055979827331 X-GMAIL-MSGID: 1772941055979827331 kasan_pte_populate fill KASAN_SHADOW_INIT in the newly allocated shadow page, so it's unnecessary to use memblock_alloc_try_nid, which always zero the new allocated memory. Use memblock_alloc_try_nid_raw instead of memblock_alloc_try_nid like arm64 does which can make kasan init faster. Signed-off-by: Mark-PK Tsai --- arch/arm/mm/kasan_init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c index 24d71b5db62d..111d4f703136 100644 --- a/arch/arm/mm/kasan_init.c +++ b/arch/arm/mm/kasan_init.c @@ -28,6 +28,12 @@ static pgd_t tmp_pgd_table[PTRS_PER_PGD] __initdata __aligned(PGD_SIZE); pmd_t tmp_pmd_table[PTRS_PER_PMD] __page_aligned_bss; +static __init void *kasan_alloc_block_raw(size_t size) +{ + return memblock_alloc_try_nid_raw(size, size, __pa(MAX_DMA_ADDRESS), + MEMBLOCK_ALLOC_NOLEAKTRACE, NUMA_NO_NODE); +} + static __init void *kasan_alloc_block(size_t size) { return memblock_alloc_try_nid(size, size, __pa(MAX_DMA_ADDRESS), @@ -50,7 +56,7 @@ static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr, if (!pte_none(READ_ONCE(*ptep))) continue; - p = kasan_alloc_block(PAGE_SIZE); + p = kasan_alloc_block_raw(PAGE_SIZE); if (!p) { panic("%s failed to allocate shadow page for address 0x%lx\n", __func__, addr);