From patchwork Mon Feb 5 19:01:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 19955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1079917dyb; Mon, 5 Feb 2024 11:03:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGz5Br9+t7ScegPqjrWzh3wGL/7oDiVhgiNghyr8jS4QQlfyQ+7ZYUObrFnuZagn0XZOuBd X-Received: by 2002:adf:e40f:0:b0:33a:fdc3:a61c with SMTP id g15-20020adfe40f000000b0033afdc3a61cmr318311wrm.31.1707159784669; Mon, 05 Feb 2024 11:03:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707159784; cv=pass; d=google.com; s=arc-20160816; b=RmzUk9Jrlz8rmIf4j9kpV4KtDUnjEa7gWx8PWzqeIGavoq9P6hn4/SuCCg7yh48vqd w2O0Y54yqhAj0pe3jIopuCSlRzkZokyBb9TOVJ9675YibjTT6yEdyhqNYCMQ6+JF3IQc B0GSJwsOyQ3tZ4IT5bO/ASDipSDMHHeDygHuq0392eIkuQAwap+nU6t9SoOinDDkUcHt I5ZSF3+o6/DLyHZlfTCZ0/mIhUfiKta51Y416UB2O0MIgbBdEwbkS5YYp1O/UiVu3Fre wGbQRzSWVVzq6jB55CDUPq6EjRn2rcg2YReWGqgWRWIdE1qNGD8JSZjkueCDz8uS2x6Q pSeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=FD6oLrKscGRSmiILd3uaPXw/1sJQqmBuWEEbw2qP52w=; fh=9eVflyQ/Z9eDILsc5xO1KQg43qBgq4cKmcNoV2Ea+eA=; b=I70YLGpk9sO7rm2D77ZVK7UmCpfFqPUJOpEoGXZ5T9UNnafv87OHB4KyujMF4c8is0 hH/Co9YHP7eRvzFcJPYXWsqE1kYAWqIVpVHnDhHKXp/3nOWs12NsYKO4goXlvVYZyYgs Oo02nzh1yiNU88Bsqdb9kNJLyW8dRvbp2gTp+K6jwXW3d/vPggqJCqq0Agss13g55PNG v9x9XUGVHUhOaFQMGfhSToNrF+yYj6KoE+pAAVNQHmuvFVuN9VxPFiOCzoa1k0caDJum UonKWkSkjtC9ovOHX3526t7UUuY2badBFtzrWT/M97fGY/dWOCvHfO39RMBeG2AzmP9S +5BA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AEtdUvhm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-53273-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53273-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCW8z2/QUyfYhdIUBOz9Lc2g4QAyMvHhtOZm/KwqqmGgV/i/GkAKqEg+P9shFfkt0tkzfUC2PlxLqK726JYZTZ9gu6O0Rg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b22-20020aa7cd16000000b0055a3694a0bdsi176623edw.522.2024.02.05.11.03.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 11:03:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53273-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AEtdUvhm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-53273-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53273-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9F9821F2320F for ; Mon, 5 Feb 2024 19:02:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D23664A99F; Mon, 5 Feb 2024 19:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AEtdUvhm" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1548A48CC1; Mon, 5 Feb 2024 19:01:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707159697; cv=none; b=V5ygstYHT5PElL75cOVOoNEvuebOX6VqLCQhLiIVn79FnCRD09QHwtnsIsiaG/jY+aXHADOjSdcZV4MK3vq+sERVSiaLcYFzVbDftxyjuXbtXr+ibm5o10jsDDG3O+ly0AAarWfKTmYpTqogz8J+7N3c3izDDxJd6b1S/awEjeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707159697; c=relaxed/simple; bh=qXT6n/Xz8TGqf2KpHYW4visUF18bBDgbINzKQ8xLz0s=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=teUpLMaG8odHKBDXA8rfRhIhnXo8/2kYNTC8Zrog6Ys6MsEPEliD2gzwqVABAR5laelnu+qC6mXs0Rd7HbDRXq39QdhM+fcAJFQ0q5U7oPTatSHcNnOA+Lt9qqiWySWjRL34raQI66EITgxueo+beLEkD+2WwSeVeSIP7Jts28k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AEtdUvhm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA939C4166B; Mon, 5 Feb 2024 19:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707159696; bh=qXT6n/Xz8TGqf2KpHYW4visUF18bBDgbINzKQ8xLz0s=; h=From:To:Cc:Subject:Date:From; b=AEtdUvhmlT6Q4z2ceE1S+VpZHbA1rQEw8LO+Bf9ETCZgbd5ufIs6vM741g/Q1erY3 iMGw6ItvBEer3EgK3/IjPwBqeUyC0wFxJKJi0BEDpfeCs7dT2SMFjBkmzKcYwnUthQ WhFfz5iTvetNX+ZxtVlfj7t4egZ8PyHbQmkHyLVeII7nobppWisVcBQOZMDByw/Jkb qPLCTlbjBlSBSTy4ss5xYgKC3b5E0kaXBuKNu5cwCBpZKrs4crm/8AR/BZQl4XTORR p7Sxw9/iybUH35eJgPdaYL+6/igMauYf/6XDG8mUy/tmLL8nCpYXoYbE3WM8+Id2o6 MaepARhHxl+og== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , iommu@lists.linux.dev, Christoph Hellwig , Marek Szyprowski , Robin Murphy , Petr Tesarik , Dexuan Cui Subject: [PATCH v3 0/3] Fix double allocation in swiotlb_alloc() Date: Mon, 5 Feb 2024 19:01:24 +0000 Message-Id: <20240205190127.20685-1-will@kernel.org> X-Mailer: git-send-email 2.20.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790086778201433810 X-GMAIL-MSGID: 1790086778201433810 Hi all, This is version three of the patches I posted recently: v1: https://lore.kernel.org/r/20240126151956.10014-1-will@kernel.org v2: https://lore.kernel.org/r/20240131122543.14791-1-will@kernel.org Thanks to Robin for the comments on the most recent version. Changes since v2 include: - Restore missing 'continue' statement that got accidentally dropped while addressing the initial round of review feedback. - Reword the commit message in patch #1 - Add a Fixes: tag to the last patch Cheers, Will Cc: iommu@lists.linux.dev Cc: Christoph Hellwig Cc: Marek Szyprowski Cc: Robin Murphy Cc: Petr Tesarik Cc: Dexuan Cui --->8 Will Deacon (3): swiotlb: Fix double-allocation of slots due to broken alignment handling swiotlb: Enforce page alignment in swiotlb_alloc() swiotlb: Honour dma_alloc_coherent() alignment in swiotlb_alloc() kernel/dma/swiotlb.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-)