From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795979804; b=M4vO0KS6Vky4LHHfgO6JQLkAOrv4gi2PLdBG5RGqX5h8nWfnCdWAd7fLm6l2wV7UI3Gc 5U6iHNAWN9qQEpraD9gIz4+ikkriJZov2ZBW9ZDZaVylFEjcFnE8fPNa9tOboAk/UhokQ xtNF+t+mFfYOo9AfdazT5VdaMm0h6ko6SPwcarSvA+LnRXxofBVnZxb4voZPWGnJZ2USB UQ4P0qWDqan2ycVi2uUj4VoT8mIpUDLvcyappgj1g2+ZzuN3za7eRq8MOT+EbXByXRffu qH4QFtpJGBxwR12VJLX6+0a1gcW46VHxs55NyBLwgD5vUmxepgOylAnmbjrOMYc4vEw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795979804; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=Pwt36hLxhMeiR8O47nakJaHVZ7lZ/VWDytDRJ3XsPzQ=; b=HapYcRZDz28l2BfZZeA0ikgZLSMUWpsbSHlnJFdKS5dL9s6ZDPcuCBHa1fK8xH0ojrfv DPIZnCbsYrZEqVCXdbEZyirmcpnCBtQDZeS0opdnYhLIZgFSzSQPTzIHyXJLa+gww/uTm tFs9orxkZMwLoXZvzIowAnseW+ok5jJt5Qo41Cx4CCQsZ/SH3qVNeF+NCt7G0rs+T4tpf HO4B2/9IxngsXX3IuNrYBgDBG0SCUBn0F781LEVU5SUQAUxMs22pRGpYQWshnreGBYy8T KibROfMnJDcdNbhnC0zaGSNmHIACwDhflaXWkPLQ2suZz0DRBdVh8Bhf/YhnR5d6zpw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fnYV5M+a; arc=none smtp.remote-ip=95.215.58.51 Received: from mta1.migadu.com (out-51.mta1.migadu.com [95.215.58.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BDA0606A325 for ; Sun, 29 Nov 2026 19:16:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5BDA0606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fnYV5M+a X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=7l0Pd9OccAUSbfhRkPAV0S0BH4rCLeodKNXPH9wSoIE=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795979801; v=1; x=1796584601; b=fnYV5M+aMG7WlvulnpSL0WckGbngqdyLToynFJYGAk85J2gkdz50hLo4okX8C4zcPogXItXQ 8WfEK201ozmPr38S8CA7kp5Ls4ajEM01iQWkOHyTT/aKNKaRinYXMwjyV9EpNBOrB6L+g1ipRwM LSNeLRaOAbQLi3qI7TofM4+o= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id b2e1164fdd96b6c4; Sun, 29 Nov 2026 19:16:41 +0000 X-Mizu-Trace-ID: b2e1164fdd96b6c4 X-Migadu-Flow: FLOW_OUT Message-ID: <87a40abe-30e3-414c-ac13-ed166c91239d@linux.dev> Date: Sun, 29 Nov 2026 11:16:37 -0800 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH rdma-rc] RDMA/rxe: Bound MR copy and flush chunks to MR pages To: Andrew Stellman , Zhu Yanjun , "yanjun.zhu@linux.dev" Cc: Li Zhijian , Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261128140840.59003-1-bugs@stellman-greene.com> <20261129001904.79077-1-bugs@stellman-greene.com> <77aba02e-64a7-4987-80f8-46c5301ac106@linux.dev> <20261129135306.80838-1-bugs@stellman-greene.com> From: Zhu Yanjun In-Reply-To: <20261129135306.80838-1-bugs@stellman-greene.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2026/11/29 5:53, Andrew Stellman 写道: > On Sat, Nov 28, 2026 at 04:36:17PM -0800, Zhu Yanjun wrote: >> Do you make tests in your local host? Or just use AI to make static >> analysis? > My last reply was from reading the source. After your question I ran > a check in an arm64 QEMU guest on mainline 4f069ab1ec24 plus a > test-only patch (logging and a root-only hook), with 64 KiB pages, > KASAN and rxe: > > - Five user MRs registered with ibv_reg_mr, including buffers that > were 4 KiB aligned but not 64 KiB aligned. A pr_info at the top > of rxe_mr_fill_pages_from_sgt() logged mr_page_size=65536 and > PAGE_SIZE=65536 for all five, and the WARN_ON didn't fire. > > - A root-only test hook called rxe_mr_init_fast() and then > rxe_map_mr_sg() directly, with the MR page size set to 4 KiB. > rxe_mr_fill_pages_from_sgt() wasn't called. > > The v1 patch was tested on mainline 7cd8495c0f16 in an arm64 QEMU > guest with 64 KiB pages and KASAN, using a root-only test hook that > calls rxe_mr_copy() directly. A read and a write across a 4 KiB > MR-page boundary failed without the patch, passed with it, and failed > again with it reverted. The flush path was built but not run. Below is the implementation of mr_page_size: static inline unsigned int mr_page_size(struct rxe_mr *mr) {     return mr ? mr->ibmr.page_size : PAGE_SIZE; } In the function below, mr->ibmr.page_size is initialized: void rxe_mr_init(int access, struct rxe_mr *mr) {     u32 key = mr->elem.index << 8 | rxe_get_next_key(-1);     /* set ibmr->l/rkey and also copy into private l/rkey      * - for user MRs these will always be the same      * - for cases where caller 'owns' the key portion      * - they may be different until REG_MR WQE is executed.      */     mr->lkey = mr->ibmr.lkey = key;     mr->rkey = mr->ibmr.rkey = key;     mr->access = access;     mr->ibmr.page_size = PAGE_SIZE;     mr->page_mask = PAGE_MASK;     mr->page_shift = PAGE_SHIFT;     mr->state = RXE_MR_STATE_INVALID; } Can you find anywhere else where mr->ibmr.page_size is assigned a different value? Thanks a lot. Yanjun Zhu > > I can send the test-only probe patch and the user program (user-mr.c) > if they'd help. -- Best Regards, Yanjun.Zhu