From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 2FF27378D74 for ; Mon, 3 Aug 2026 13:37:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785764246; cv=none; b=sb6mu/rofKfrGnGAH2WisqemYCiAi+0e6jcUvAYXbRfAO/e6URd/uUYf3cr/L84rCbzHqqHkwQNPz864LZbNQVrihFksJRLWLsS/nc73kNwDVYQXUzOm5egRr3ahPB6kDrnJgn2LlNBDZVTiRTL4Glless7nti0rNC22ppKh6/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785764246; c=relaxed/simple; bh=Q3lC7ph52pwscqvZuwjZ4AiZmrJuilR445nvJqXc3vg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YL71bhSN6vxmum/s2/OgGykWxLMw0Kl6xhnSMyY0qwh7uN5+JLEzSJrHNHsVP96SBbU8xYojkGqhZQKC5rbGb6YfhqQHo3Vfnt5xSP98yLyqf1jCv+B/sPhHPtgY6dbm7M/UzxQChi/MxbsO8KyqjFHew2zku1iyrw9xzgqnXgI= 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=ewvIMfOv; arc=none smtp.client-ip=209.85.214.175 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="ewvIMfOv" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2ccdf36f63dso145055ad.0 for ; Mon, 03 Aug 2026 06:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785764244; x=1786369044; 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=pzkJ11PcuZctbuKF6H3B97Fb0rqT9GRSf4tUaQ3n42o=; b=ewvIMfOvYSQ4tbdLUqjlFSbh7fH8Ph1bjMOZeSEPbCVxv4oLkXNIqvBnhBE0H+Ipzo /VJIMte0vYxnpHMt4tHUh4KvOKo7WLJiFsmSUmB+Zie5n9Vsz5bPooO6QmBuisDpuKw1 aLkFChpKX3bv1qFqUHv6XyNoeVWrvlv8wPZEQArn6gVVuSomo+bZq/Xb2aNZm7RSBxpV 4igqRyrhQDTe8uuOGPuMdYb2W8eNzOkXpIypRd3JlAFOwDQlYK58P+32O5wWIbBtt6BN hYvMmHkrFfQTEtMNUThL+0zp60ydgpfrXmnd0zwyIbAAzRAa9lADAmxK7pKy4g4sXOGN sPaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785764244; x=1786369044; 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=pzkJ11PcuZctbuKF6H3B97Fb0rqT9GRSf4tUaQ3n42o=; b=sUCIOefnvp34rT3fliwL/A/CU1JAsaPEo8RzoYT15O7b2kF7NCDAwnAIeCUUxaP/+8 Z21VqJVQHKZyQsx6cLMrD0Qfbf7N08lDf8pJnaQMkERzbviCvi3mfa0UmEcpAciKnThp U6ZZmrWad+66pqjiVHRatEjVVJA1ZWhXLWKsCNpNB1GKqM968GM1Os6tj0kteIN8OnKy Mm7sN4ALg1UxSDaDVOU5CXKCC0vg2hbqqMp0ThUm7xfDNnw4l2ph/M/VMlmalYpFIOez AcLtGHf3/BjDhsDO0gP4U3W2AvIpz/DSPeQfeHh6Slqoph45fVqEwL2+NPkTAjD23pzx oEIw== X-Forwarded-Encrypted: i=1; AHgh+RrdCe9OsIgiPhQnU2fQVheN8vDaQcs/NIXPJ/noX2nIrWB/NxeIkjA3u4lQfYEpou+Hlp8kFVgMINt05Q4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxx2YhQGs8Osr6BHFBUlg3CM64zKgf5iO7mKHOt7IbVAOwzpWhb k8wtBpi3qWvf045XthyTgHKnkYFduUctX/NxtlFWUdA4uB6dcikhjCyjYUhgqQVBBg== X-Gm-Gg: AR+sD11IDFVgLORMPfj3sdrFP+sVLZnsthjFNnb6UU67J83+xDts71oga4BsiV5mTRX 5hDXE35GO4ibRmwuTlbnSHNK6tIFdC+57ZpQaPdtURyr2/z7CKrzQMOI2q5o9i1294sTzIdnpKz GX5+gAMFV6ehV1+ZBs31gxyuvmtlJIOKeD0wV99jDxYCvvEeaoxqtSUG8B14pzWcTwPQuDfiP2A lGKVadXaZdoWKR+dNSQEHxC0MYnUfkFqoWjvKZBBPdZCeR5kt9l8ZpWj6TSTgkC4YV4aRNSJkGh 2nj/CmTUoWry5AUjVSj85UWCEXYClezmp51brOwsv5jaeUUO5ka5QzbKBO9gtOcIn6a/B6gb0B/ /erRUYYuTvtlberALKEzKvRnTbMvuYdsWp5J7fY1jwjleXIxkylmPU1II8y7o8SlJfgix/q7iy7 LuZc30DN+EgTDA7fjfWpHVfR6JMo771qkTOOKliKzMglByYED7mGZKp1wBVzRqq4QDQC1tMElIF YvBe1Djsci6vlWDHpIE2+E= X-Received: by 2002:a17:902:d2c6:b0:2ca:be81:b469 with SMTP id d9443c01a7336-2d0545416f6mr12684095ad.0.1785764243858; Mon, 03 Aug 2026 06:37:23 -0700 (PDT) Received: from google.com (21.168.124.34.bc.googleusercontent.com. [34.124.168.21]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38fb2e11478sm3955257a91.3.2026.08.03.06.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 06:37:23 -0700 (PDT) Date: Mon, 3 Aug 2026 13:37:16 +0000 From: Pranjal Shrivastava To: Robin Murphy Cc: Nicolin Chen , Will Deacon , Kuan-Wei Chiu , joro@8bytes.org, akpm@linux-foundation.org, cychu@google.com, hhchung@google.com, amitamishra@google.com, marscheng@google.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, jserv@ccns.ncku.edu.tw, eleanor15x@gmail.com Subject: Re: [PATCH 1/2] iommu/arm-smmu-v3: Replace sort_nonatomic() with sort() Message-ID: References: <20260730181216.2709088-1-visitorckw@gmail.com> <20260730181216.2709088-2-visitorckw@gmail.com> <00dae86e-cbc3-4d6e-966f-39afd4b8c2ec@arm.com> 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: <00dae86e-cbc3-4d6e-966f-39afd4b8c2ec@arm.com> On Mon, Aug 03, 2026 at 01:35:52PM +0100, Robin Murphy wrote: > On 02/08/2026 6:45 pm, Nicolin Chen wrote: > > On Sun, Aug 02, 2026 at 10:23:48AM +0100, Will Deacon wrote: > > > On Thu, Jul 30, 2026 at 06:12:15PM +0000, Kuan-Wei Chiu wrote: > > > > @@ -4047,9 +4047,9 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu, > > > > } > > > > /* Put the ids into order for sorted to_merge/to_unref arrays */ > > > > - sort_nonatomic(master->streams, master->num_streams, > > > > - sizeof(master->streams[0]), arm_smmu_stream_id_cmp, > > > > - NULL); > > > > + sort(master->streams, master->num_streams, > > > > + sizeof(master->streams[0]), arm_smmu_stream_id_cmp, > > > > + NULL); > > > > > > Makes sense to me. Nicolin, did you choose the nonatomic version > > > specifically? > > > > It's probably rare to have a large multi-stream array, so I think > > sort() would be fine. > > Yeah, probably 99% of the time the size of this array will be 1. An > exceptional value of "large" might be something like 64 for a massive > (non-PCI) DMA engine with separate read and write IDs per channel for no > good reason. > > If and when someone ever were to report RCU stalls here then we can first > ask them what the heck their client device is... and unless and until then I > wouldn't think it's worth worrying about. > +1. Agreed, it should be fine to use sort() here.. > Thanks, > Robin. > Thanks, Praan