From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.119 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796355949; b=cEXILGqg6LED3PrOWHAE5O0Dfm+BpWeLxeCwxjbw3t42rJkchcd0fWRKHt4FjWQtA6Vo OLfYHeVDbHENeSKUUcueKav61TC2Hxo/s1Nb722B4qb7NU6w5axk1I5pIfuQp/BRv0nsn t3iycAL7SkBDKyS+HS4y1hnmf1wghIVFVeOwjOOJRntu1Z/Do2RchNY3L2ClIC7ZatGG2 TYoreoU+dmPYqWs058gw7trxbLio6JSqg+Z+7ffci0OvwJ4xtem6GYS/N4MgvXc3Ocpy9 3g7Mq1z2QpgCbG2/w3HM0OJQjz3tAdA7cME89VWSpKDF3SnOsaHywiXFSX1yL0NuhRw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796355949; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=bN3tenzIceispf5XdDPsIopJ7BXCQZFoVNLY/e5NinQ=; b=2ZAqBvoJYocGzz9QlzSeuwk9+fvfHOdo24+sQaVVlf2Q/pepYhqd1uPSOf3rlztUZVXv xehRahxs2PVCFfVusL/P27DJow9qFWjAoiKRwBA1Zev4fRit0M06twOxNDRcXbL3DCO9z /5hd1LXh9krE5AA1wwunj1I9rz+PraNn8XdkxAsQNdtEHVVz3NXOghxIFbYl73PbUhNiS 9uUtOof53jCq6qmZKn5P1gMEl7sHOplSVpgLleJE3YTF3FMdBj63pQ3osGt5gcLbHZ/8o I+RJVX2HBFz0M0+JTYva8Wb3wstPRZrUmdIU0vN3D6tjoLwNttfntX6ugHaTeZIAerA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=B2TOHi6L; arc=none smtp.remote-ip=115.124.30.119 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 757F2606A32C for ; Fri, 4 Dec 2026 03:45:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 757F2606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=B2TOHi6L DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1796355937; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=bN3tenzIceispf5XdDPsIopJ7BXCQZFoVNLY/e5NinQ=; b=B2TOHi6LQh2Gpe+zJdIJZDhNUEjpeDstDD9Kvw7+H2m+3c0EOF7RPBWQs6aE6JjtRV3+z8n5sIVKwqVQnjntL9GP70Pag4bh28DCkLcVVJ4tFf8k4jjp6lxuNWx756zprZXySczmQqlQRvlQeCtv6bFHzYsKNcNxrDLv44Y6ktQ= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=jiangtianfeng@linux.alibaba.com;NM=1;PH=DS;RN=42;SR=0;TI=SMTPD_---0XGFrhlE_1796355925; Received: from h68d07384.sqa.eu95.tbsite.net(mailfrom:jiangtianfeng@linux.alibaba.com fp:SMTPD_---0XGFrhlE_1796355925 cluster:ay36) by smtp.aliyun-inc.com; Fri, 04 Dec 2026 11:45:34 +0800 From: Jiangtian Feng To: shivankg@amd.com Cc: Jiangtian Feng , akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, bp@alien8.de, ankur.a.arora@oracle.com, dave.hansen@linux.intel.com, tglx@kernel.org, bharata@amd.com, hsalunke@amd.com, mingo@redhat.com, hpa@zytor.com, david.laight.linux@gmail.com, rientjes@google.com, torvalds@linuxfoundation.org, tejavojjala@google.com, nhuhuan@google.com, pfalcato@suse.de, peterz@infradead.org, ziy@nvidia.com, baolin.wang@linux.alibaba.com, nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, usama.arif@linux.dev, kas@kernel.org, ying.huang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, tianruidong@linux.alibaba.com Subject: Re: [PATCH v4 1/6] mm/highmem: introduce copy_mc_can_batch() and __copy_mc_pages() Date: Fri, 4 Dec 2026 11:45:22 +0800 Message-ID: <20261204034522.302814-1-jiangtianfeng@linux.alibaba.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261201-batpagecopy-v4-1-dd82a573e573@amd.com> References: <20261201-batpagecopy-v4-1-dd82a573e573@amd.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Shivank, > Add copy_mc_can_batch(), which tells whether a page range can be copied > with a single copy_mc_to_kernel() call, and __copy_mc_pages(), which > does that copy. There is a pending interaction with the arm64 copy_mc work. I am preparing a respin of Ruidong's v15 series: https://lore.kernel.org/all/20260618092124.3901230-1-tianruidong@linux.alibaba.com/ The respin selects ARCH_HAS_COPY_MC when ACPI_APEI_SEA is enabled and provides architecture-specific copy_mc_highpage() and copy_mc_user_highpage() helpers. Consequently, ARCH_HAS_COPY_MC would also enable this raw-range fast path on preemptible arm64 kernels. Your range wrappers handle KMSAN metadata, but the arm64 helpers have additional semantics. When enabled, they reset the destination KASAN hardware tag and copy MTE tags and their page/folio state. The user variant also maintains the dcache-clean state needed for later icache/dcache synchronization. They queue the actual source page when either the data or MTE-tag copy fails; the latter failure has no copy_mc_to_kernel() residual from which to derive a PFN. The raw fast path would bypass these operations. Could we separate raw-range batching from ARCH_HAS_COPY_MC with an explicit opt-in, for example ARCH_HAS_COPY_MC_BATCH? The Kconfig help should state that selecting it requires the architecture's per-page helpers to have no additional semantics beyond the raw copy, KMSAN metadata and residual-based source-page queueing. That description is only about raw-range equivalence; the ordinary copy_mc_to_kernel() contract remains unchanged. copy_mc_can_batch() would then check ARCH_HAS_COPY_MC_BATCH instead of ARCH_HAS_COPY_MC. x86-64 and ppc64 can select the new symbol alongside ARCH_HAS_COPY_MC, preserving the fast path covered by this series. Other architectures retain your range helpers and caller conversions, but take their existing per-page fallback. No arm64 exclusion is needed for raw batching. The range-order change and its failure-order effects remain a separate review item; this opt-in only prevents bypassing the architecture helpers. This seems preferable to making arm64 disable PREEMPTION or dropping the generic range work, and leaves room for a future arm64 range helper that handles its tag/cache/failure semantics explicitly. x86-64 and ppc64 would retain responsibility for validating their respective raw fast paths; arm64 would validate the per-page fallback. Would that split work for v5? I think the selector and the x86/ppc selections belong in this series, so that adding a new ARCH_HAS_COPY_MC architecture cannot silently opt into raw batching. If you prefer a different ownership or ordering for the prerequisite, please let me know so we do not post competing versions. Thanks, Jiangtian