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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 17324C00144 for ; Tue, 2 Aug 2022 03:07:15 +0000 (UTC) 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8NI3rJjIIbRJJKUGHeV3KDiw3P11x2OtvuRlLseienM=; b=0gLJbv1XpHMbiB j0Zn65EvCJg9anlNBnGz4yPUmPq4iqncimlFzA5DXG81VkkKcf2cL6g6M6o/VSn9IDu5FNAxArhE2 405iMl7QLVriB5yoIXhchZ7gkz/uv8nL+twRKV8GqKudQoescJ21X/+q+MXAkzrLZ1yFm7fWKDyoE H6nksXBR0MHkidU6wo+IleOszl3wZWq72Sb+v0+aXPXWrnSi8ITsW4+bXq2BTVQu0tIU6J6dNuKMY m++hYFwVfvo5Eg3PBsKVOlXZT4zShLah7E+IYeKEVyFqY1KHbopr4uQmtAu47ckkucPywKlPFOgx5 7pH0vqHE0/OnbP2dpYDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oIiFQ-009zZj-Bi; Tue, 02 Aug 2022 03:07:08 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oIiFM-009zYE-D1 for kexec@lists.infradead.org; Tue, 02 Aug 2022 03:07:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659409622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5zQia0Oassrqu4Y+65KjGvbcaoFf/cSiBHiey4HDVUY=; b=MMCweZRuCR+0Gxs3r1mz4Zu2Oj+uAUctkmtllm/iDdL+BgX7VYzs63FjjBoqmW/wywGFMK oDSZVIJAcTR++5CTLgnYJJip7pU+YpFJhyvfF8c1zgZ7DJTGmsnLPyxKeQcrbU7Jl+gx0i jTQEhdSmo3P49OLaLY7kLyDa22iPYmk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-12-SiwiOuq3OiSEzAI25UpcQA-1; Mon, 01 Aug 2022 23:06:59 -0400 X-MC-Unique: SiwiOuq3OiSEzAI25UpcQA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B33FD294EDCC; Tue, 2 Aug 2022 03:06:58 +0000 (UTC) Received: from localhost (ovpn-13-104.pek2.redhat.com [10.72.13.104]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB6A32026D64; Tue, 2 Aug 2022 03:06:57 +0000 (UTC) Date: Tue, 2 Aug 2022 11:06:54 +0800 From: Baoquan He To: "Fabio M. De Francesco" Cc: Eric Biederman , kexec@lists.infradead.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Ira Weiny Subject: Re: [PATCH v2] kexec: Replace kmap() with kmap_local_page() Message-ID: References: <20220707231550.1484-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220707231550.1484-1-fmdefrancesco@gmail.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220801_200704_634282_DF7217BA X-CRM114-Status: GOOD ( 23.58 ) X-BeenThere: kexec@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: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org On 07/08/22 at 01:15am, Fabio M. De Francesco wrote: > The use of kmap() and kmap_atomic() are being deprecated in favor of > kmap_local_page(). > > With kmap_local_page(), the mappings are per thread, CPU local and not > globally visible. Furthermore, the mappings can be acquired from any > context (including interrupts). > > Therefore, use kmap_local_page() in kexec_core.c because these mappings are > per thread, CPU local, and not globally visible. > > Tested on a QEMU + KVM 32-bits VM booting a kernel with HIGHMEM64GB > enabled. Wondering what arch you tested with. This looks good, but may not benefit much. Say so because I doubt how many 32bit systems are using kexec/kdump mechanism. Anyway, Acked-by: Baoquan He > > Suggested-by: Ira Weiny > Signed-off-by: Fabio M. De Francesco > --- > > v1->v2: A sentence of the commit message contained an error due to a > mistake in copy-pasting from a previous patch. Replace "aio.c" with > "kexec_core.c". > > kernel/kexec_core.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c > index 4d34c78334ce..6f98274765d4 100644 > --- a/kernel/kexec_core.c > +++ b/kernel/kexec_core.c > @@ -814,7 +814,7 @@ static int kimage_load_normal_segment(struct kimage *image, > if (result < 0) > goto out; > > - ptr = kmap(page); > + ptr = kmap_local_page(page); > /* Start with a clear page */ > clear_page(ptr); > ptr += maddr & ~PAGE_MASK; > @@ -827,7 +827,7 @@ static int kimage_load_normal_segment(struct kimage *image, > memcpy(ptr, kbuf, uchunk); > else > result = copy_from_user(ptr, buf, uchunk); > - kunmap(page); > + kunmap_local(ptr); > if (result) { > result = -EFAULT; > goto out; > @@ -878,7 +878,7 @@ static int kimage_load_crash_segment(struct kimage *image, > goto out; > } > arch_kexec_post_alloc_pages(page_address(page), 1, 0); > - ptr = kmap(page); > + ptr = kmap_local_page(page); > ptr += maddr & ~PAGE_MASK; > mchunk = min_t(size_t, mbytes, > PAGE_SIZE - (maddr & ~PAGE_MASK)); > @@ -894,7 +894,7 @@ static int kimage_load_crash_segment(struct kimage *image, > else > result = copy_from_user(ptr, buf, uchunk); > kexec_flush_icache_page(page); > - kunmap(page); > + kunmap_local(ptr); > arch_kexec_pre_free_pages(page_address(page), 1); > if (result) { > result = -EFAULT; > -- > 2.36.1 > > > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec > _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec