Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp671245rdb; Fri, 26 Jan 2024 07:20:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpl14FNOPqlGzDpWXYlnu/9WzLV60dqi2ydqy1VJ+WBNJwG/6ORBRxlcvhWRdyGff7SdeX X-Received: by 2002:a62:5f87:0:b0:6dd:a03b:5b6 with SMTP id t129-20020a625f87000000b006dda03b05b6mr948927pfb.51.1706282454541; Fri, 26 Jan 2024 07:20:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706282454; cv=pass; d=google.com; s=arc-20160816; b=hw2dFFCRLvpJ5xjWE3+JClI8wCtaRAj3Jb7vAGeOnbh5dKXyPcyC7PU0N6LA2lJeIc 8Qjhgbx4JqVpT86CTRiDBiVIjFCvKOXlTRXUeJWnvXpSR3CM/CFRaa+kN9OXmKbt6cj8 4JSadLwU+hsTdSR4/cPuiesBNm3gRZLOF9qJomCZUu6fhPu+vciL9F0uFvEnq4tsBjiC 0J+vp0JPtbxB0aYlWDqDbe8MFNtvIGRmuh1aDWi8mSRERW5hdjf2W2UMr26MTw2LrHto 3Eh2GdexU20bz0jA+h9wv4J2f2+fLP2WUPirQJHIstc3Us3nSKoDWxVUo/ziDoufdMRA jPqw== 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=eiF4IrF68JEkxmc3laPv4IletVVfxCtJyFPzhMaYnd8=; fh=eUW2zxU/ftxjyZ8n2XZAq5IuyvM6/MzpJm9KwbQWpiw=; b=sR9ZJAJnegv6iA191aj8Q3QJQhfK39oYDJNpnAdExTUePmJX90+gfK1QUWsMINALDb jy0EC/Le9YJxMyBvB9aljy8p+LNdAXV86dFV4ChUhPL6vJjEs156mxUgnHwH69zjJ0Kc oDEODAVZRILQnrtvZfM712AfHUe6Cp7j5I+ni9V04CzwtAHFc8SzbFOtn4SZqGb3P1Hn FVct/vWH0uQw8aT3/SfJxm9v9LiXSzwdWkyQZYNoQujqOurRFrnDGzAT6s9yjEwGNCxV PqJFznWrfY0NI7xFpsagZVPr7niF0MAssb/Cmzivme2ZxfiHT4tPR1l8APv/1tmbN06d UwHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XDZD4lLp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-40260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m185-20020a6326c2000000b005ce0cf4a970si1332050pgm.175.2024.01.26.07.20.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:20:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XDZD4lLp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-40260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40260-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8800F285BBA for ; Fri, 26 Jan 2024 15:20:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64FA71CF90; Fri, 26 Jan 2024 15:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XDZD4lLp" 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 8BD5B1DA37; Fri, 26 Jan 2024 15:20:03 +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=1706282403; cv=none; b=dfX9YXr3+vrZTwVHLJX6NFM7JvMdtDzKw7IMvzJ9EaAYsWMHFT5U97CL5f4/0pRybqIpHJT83Wr/mQe5fW2TDfoO9UwGqVdyJKqAHG7jiA89XHNPtcCCeyoGgGj7NLAJJTiy3a2o2/NHlhpWxPrWzIgj28O8SqxeyVke3iBAduc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706282403; c=relaxed/simple; bh=SC9QwQMbCTIJBA+ynOBg9aULds/BrGb1X+P+U7Xcrr8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=kh0l3Ky3xDUr633ENjBf/hgkmJ/z0KDte2K+H50EalJ/DH1ZI9Pao2ZflAvm6BMd04WttLJzJACkOponmmba4SALgZwFT1Hlb7SXrXtDeRxpmTVb8Ocxqq1Vzg6+Hup6QQJNpNwhFPhrt1Fc+Iye74P8jV70OIATZH+QM1pMJnQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XDZD4lLp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A419C433F1; Fri, 26 Jan 2024 15:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706282403; bh=SC9QwQMbCTIJBA+ynOBg9aULds/BrGb1X+P+U7Xcrr8=; h=From:To:Cc:Subject:Date:From; b=XDZD4lLpST9dO7xQN8icGOSn7s5rAjsEivyUrxvSbP4FFiijQ+ZX++/WjaCjut9/e pB8M+gfX/AuCItmYkloBZW/s2Y/NCKLzCyvAsYRTAmwJjVumpgtaPVeu8jeDPN/SrA yrHrcQTphj73gruYO9EQ+uwEfejq0gb6qCejssjVkiDZN69W67VUncIq4v5NX4R6L2 DWNTajyuXJIKHjzzhCcXPFKCOfuelOVF63Mj48Y0Z0qGW+uxn6/doYHXBhKewHjduA 2xQ0yMZbZp3C/3biVe3oOCn/fVG93zCOsu4d+pn+5H3x9St4yY6PED3iROSuJTHBMr SFp176CFmhmtQ== 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 0/2] Fix double allocation in swiotlb_alloc() Date: Fri, 26 Jan 2024 15:19:54 +0000 Message-Id: <20240126151956.10014-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 Content-Transfer-Encoding: 8bit Hi folks, These two patches fix a nasty double allocation problem in swiotlb_alloc() and add a diagnostic to help catch any similar issues in future. This was a royal pain to track down and I've had to make a bit of a leap at the correct alignment semantics (i.e. iotlb_align_mask vs alloc_align_mask). Without these changes, we've been observing random vsock hangs when communicating with virtual machines in Android. Please have a look! 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 (2): swiotlb: Fix allocation alignment requirement when searching slots swiotlb: Enforce page alignment in swiotlb_alloc() kernel/dma/swiotlb.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) -- 2.43.0.429.g432eaa2c6b-goog