From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 922A039478D for ; Wed, 29 Jul 2026 05:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785302153; cv=none; b=kzKaJE6DzZ3Q51mWte03IsB23Scskw1zejVJPsyW5H7tQ/e29out2iXL5itaqU7k+RFesF1gflrmq08tkWYzJuLdLcYAHWZzxoAOF/XHSzZCh9EVVPxdrpD6JHEaklmYCuDC8rCaGj3auvibnFzpqVJRC0KGwALINeGL0uepHuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785302153; c=relaxed/simple; bh=arvW8DEjXjLKtC6BO9hMfUJE3a2BUgzm9bXYSPBa1uM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p0X/uLjye9ku56Ih9Uvv6sFONyV2t+zU/jWDHDTxg+A7TqMsYdS/PQFuHihNFXhdKdQ0eeK/3nHU7QU2Bqkj5mzwVVkiOvYLAYJFT6Gwhuusm6/+U0FgrjX2qjtGa3wnQn0nBPgIJhtyhE5o7ajt8hW6f0MVjVpsp/1DC1sjWQg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XAC73K+Y; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XAC73K+Y" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2cab97c86bdso42545ad.1 for ; Tue, 28 Jul 2026 22:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785302152; x=1785906952; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=oi3z5OGmFTcAu6ua8IwxSpW3BCYGUVzFL1IOvsxUp2E=; b=XAC73K+YPBVhImCmFchTHVQa5BsmFaZj80CXTx3uqwOlPjQTvTGrrh2qay+nNmbiz5 p8F3y9elDJ53jnlKYICZdiUAzKcL1rpcFUMUnX9pLrOcV/CTPaZ4Jb9uwYyOHGV7q0AR daHVrqBtjMNQ4Lolwj+qwa1fZ6UV9R73xcjKLQqrPMF0si6iowjvVUnXegSGFAH4m3w0 OLJSTcebRCdQ0EKVaI7XwdqiM0JQRFndtXHNt/TLlZ6O6MEZrhrg8zCKMLgkfxRC7mno pZYMdWCpTMpHFFhll3VctbiJ7jUhKP9MFgFLBpE193fEfJjusHAFPPGyMVQ2gs40sLfq q4gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785302152; x=1785906952; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=oi3z5OGmFTcAu6ua8IwxSpW3BCYGUVzFL1IOvsxUp2E=; b=QPefITJhuVxQKWbnLBHD4gY39X1K5lefOd2RNr4INFhasZBScTC/NgxwVxvIKfdW2J hGQhzSCJVQB75Jg3HdNBtNiVq4oFhJpyO1Ry6DaYQ/GWswc1B6gHKr7a2BtggzmipF0j 3D9bNnPjwypNa8+nx1J+m+C79yLPqzpWvhTCFWrfVjvsV5+UxFo2BvdNGIDFLpL7UG8R abAAWotyw8E6TRaLNQZVBea5R+db2wbtKXtjUSyu6OCnD3l0q6G6nccuL/smYrkUKmfM UfGej0svLCmVUwXY2nJJJ3L1CCj6NbhHAMM+tNn3tmoOj1rx6a2DvN3ye5MDOz/nmmCu ezDA== X-Forwarded-Encrypted: i=1; AHgh+Rq5/sGbr82VSI1+vNRk/mDd1OzQIL3UKiR4k241pwlCAZ0czXGjOqIwHW4avhmzC7e/FHUgVhz5W4dSfrA=@vger.kernel.org X-Gm-Message-State: AOJu0Yy0uBzhdLYGSrNiNduaQX37DGYGtr0MVfIifVVwfO2uvB6I3Axa Pujs2/hU6w/dzD6g8pWBcnlYoPWKa66mX4BGqiNKMUfUx5ttzEBZMpHGpiYKG7X/QQ== X-Gm-Gg: AR+sD10lxvnQFQ97mxLYug7z2qaHjCFkI6hQhZ17LFGB4agsEi4XyDWPk0XqSafpiia MveB/1ArCYzhVFI/fRMV516mF/2UBgLNy4Zh7dwtZxdNJUNVbcYf/ENy6zn6yASWU06jEKmcWXG stRovkrrAmmNJIeGh7sxxuDnlAGvaPAPCbWw0l6cKI421D2bChTDp39fPRdw++NpOPbmlg0EVmT TGp1KhbBamMP00IOaHw1fi89NXd3B2fWMKvE9pnJ8L+dnl/73JCLrovXWqbQ5Tw+Pd0pdat+y6B wsJcWmXTD1nPpvfZO3E4COgcwoBwEkozzl6dlcta/wFzRIEM976clWPgzilWDM3JxT1ECIuFhuG cUPU29TFtTuKCWs9cQy0JTct3ShLmaGxznZmObhsFEzrAQ7wETdUzmtveVDvqpiONatiG3HiYQ0 egXXTZvcdmzMkisawDWElJ8WWpiSTmoXwJUXX+S4ewvEVvIDAEN4Ae7JwRnivYRBQcMaC8wDzoe Yg24Vk3xtAS4oQVtE9Nr1g= X-Received: by 2002:a17:902:e014:b0:2cf:4353:f117 with SMTP id d9443c01a7336-2d026c5c8c4mr1262155ad.0.1785302151338; Tue, 28 Jul 2026 22:15:51 -0700 (PDT) Received: from google.com (21.168.124.34.bc.googleusercontent.com. [34.124.168.21]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84ea0051591sm789220b3a.19.2026.07.28.22.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 22:15:50 -0700 (PDT) Date: Wed, 29 Jul 2026 05:15:43 +0000 From: Pranjal Shrivastava To: Nicolin Chen Cc: will@kernel.org, robin.murphy@arm.com, jgg@nvidia.com, joro@8bytes.org, bhelgaas@google.com, kevin.tian@intel.com, kees@kernel.org, smostafa@google.com, baolu.lu@linux.intel.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, skaestle@nvidia.com, mmarrid@nvidia.com, skolothumtho@nvidia.com, bbiber@nvidia.com Subject: Re: [PATCH v2 03/11] iommu/arm-smmu-v3: Add arm_smmu_drain_queue_for_iopf() helper Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jul 28, 2026 at 03:17:09PM -0700, Nicolin Chen wrote: > On Tue, Jul 28, 2026 at 09:16:49PM +0000, Pranjal Shrivastava wrote: > > The following is a unified drain_queue helper, that also attempts to > > address Sashiko's concerns. This applies on top of my runtime PM v9 > > series [1], please see if it works for you: > > > > Subject: [PATCH] iommu/arm-smmu-v3: Add a unified arm_smmu_drain_queue() helper > > > > Introduce a unified arm_smmu_drain_queue() helper to replace queue > > specific polling loops. The helper handles both snapshot-based cohort > > draining (for IOPF) and full queue draining (required for Runtime PM). > > > > The Runtime PM explicitly gates the CMDQ (via CMDQ_PROD_STOP_FLAG) prior > > to draining, this allows a single, snapshot-based target to natively > > handle all drain scenarios. > > [..] > > queue_poll_init(smmu, &qp); > > + qp.wfe = is_cmdq; > > The callers of this drain() will be RPM and PRI, either of which > needs busy-waiting. So, I have added a different drain() helper. > I run Sashiko locally; it also gives a clean result. > Ahh my bad. I meant to set qp.wfe = false, is_cmdq is a rebase remnant... > Commit: > https://github.com/nicolinc/iommufd/commit/d10325ff40fd45c476bc98d484d8dd2cdc7fdf95 > Thanks for sharing this, looks good from the CMDQ side (since we call this when new CMDQ submissions are gated). For PRIQ/EVTQ, my only worry was the HW producing more events, say Device A is detached (we call drain from attach_release) but Device B (still attached) starts an agressive DMA with multiple PRI requests/evts. Maybe we should go back to snapshot based polling for that? Anyway, we can discuss this when the series is posted. > This will be in my pri-v3 series: > https://github.com/nicolinc/iommufd/commits/smmuv3_pri-v3 > > We have too many SMMUv3 under review now. So, I will post it once > some of them are merged. > > Nicolin Thanks, Praan