Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp81945rdb; Mon, 22 Jan 2024 12:38:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHoFiS41kOrF6u4LGOqiJF4t+IPibdKBlXIBggwLz1QgSyEiTq5hlIMcInUyeWycA5Jayzk X-Received: by 2002:a05:6512:1c7:b0:50e:e888:2c3d with SMTP id f7-20020a05651201c700b0050ee8882c3dmr2184178lfp.25.1705955905788; Mon, 22 Jan 2024 12:38:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705955905; cv=pass; d=google.com; s=arc-20160816; b=p67VRN0BBydcN66BWJ0GNzYn88dKDwMGBzzsic/5AsE5vsfC3GBVoDqh56VAeV2ivG PfZYZus4wUHFgyXmq/yZhjVT/I74NbeFk69rdzEuBYS8auSjurkg602rcQ+mskT/N5nV uV6z2kFqkx6bv5zR8TZNx5VTCExkMunslc1IJ+SH5y3z2wUHvH5mNBk92jhTbsGDt9Do MPUAOvBLCZ6JDH5ot+XOq7Xu7O8gBxVre5ir9HYBIp3hBYwuguCnCrp+ZkPwYC+k85Kj 3pzG7HcBXOXttEsg89nUPwDIkRw/glNAINhEuDaa5xywhAdf953FkoU6CfeYporyq04n inDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=ovPyY1cT5jVLmjOiRM1g4P8UYTcopXTaszvOlquJxEk=; fh=txQBxtsczLq5ZIbnD/1KjfhCB8cVAxBUySnKAdT8Yyg=; b=pFW0ndnrPLBIAykHlXBwmQXD5has2eja/gvWWCRiIQVpoxMovl8l/ZAgZno3qGV0XW 5BXkdXAgBjLlzDMeWlRyuTbCXvE42dJtg2E13aOXIxM7M1ZCXNKMJ142j9JmuV/KlkuL 3uJq3Y+2yzlnCPG7uNl3wwm63HskLpqnVIiQ/B/+CnaWMqIR9BoplBvHyhO52W29ytVp vRgQLzahHOP6rtqHqDhQ6GrAjYKQYklSKYFzCGa4nWmgmW3cDBul7bP1ZqgKMDsAKP2h DZyX362b/5fyPVWnie1v1mKOIh0TsYTFksw480nVinAeaIlY3VjbNx8M07ulzTRzv+qi Kc5A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2nxz8Zti; arc=pass (i=1 spf=pass spfdomain=flex--isaacmanjarres.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34124-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34124-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gs19-20020a170906f19300b00a2aaed937b1si10539048ejb.783.2024.01.22.12.38.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 12:38:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34124-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2nxz8Zti; arc=pass (i=1 spf=pass spfdomain=flex--isaacmanjarres.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34124-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34124-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 62E571F280B7 for ; Mon, 22 Jan 2024 20:38:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C37C47A5D; Mon, 22 Jan 2024 20:38:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2nxz8Zti" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 8D344405CF for ; Mon, 22 Jan 2024 20:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705955894; cv=none; b=bXsX2lUaezKiIygSpF6FDW8PhCIPxSOK3ze748scDVYHamHZbgQKHCmc+GvETyisikiUg8suhuYn8yLlb+573+208RhndafP8+9lC1OStJbU0aCsTC3uq5kVlAYydYsuUyAYDTsF1eGNQfuAOllkrNHXWSz0a18zMh9GbxJWLI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705955894; c=relaxed/simple; bh=ht3OFOZepzevWY8LrzdZG62HQxz9zjIpaWrIyOKZiuE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=MUGggi8f4hGpUGJQgkol54IYKZm16mE6OA5GckQiuPSdaYhWDoa4L5MfsDcF6VuHURc7YAASVBUiL/Sx4Dfa/AwieTz70IRwek2DCaXo2/A7LVU+83ZP1oCOQg0WR7gCUjB99CpsHfWL2ZjVOOALDtUkoDh/k9QkU1rkrzapcFg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--isaacmanjarres.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=2nxz8Zti; arc=none smtp.client-ip=209.85.128.202 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=flex--isaacmanjarres.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5ff7eabfd94so50509727b3.3 for ; Mon, 22 Jan 2024 12:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705955891; x=1706560691; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ovPyY1cT5jVLmjOiRM1g4P8UYTcopXTaszvOlquJxEk=; b=2nxz8ZtiJKl6Q5iGEQ0Hz1Q2wdky21x054B3PMCtxayWnc57cypLkoZGL9OlndFBfe 5yeesWtBsbK8gweiCgjpGc0JTshGwm/oQeAz0PJ+JDm7sgyeOY7LA+k1jd4nVkgHjJ6Y NnNSkY9ThqlLZ0oXHESAnbOyL34Bvihur8r9JW3/k0RU7nP9Ba5+aiU7jTmfLEo6yCks WFRW8Y0rtqj7KXOlWFvsR4UJ5+x3eDqfMDrOSprUHIl4+8UaBY57UcqkEzBYBoWBV6hE i87qeIMuqu3BhnitatRMVp2aZD2S1ydAViZ6kU1EkGnmQ7/UbQjuBafq02nvU0pVsFoY DKjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705955891; x=1706560691; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ovPyY1cT5jVLmjOiRM1g4P8UYTcopXTaszvOlquJxEk=; b=QDRinVU6k2mSERxAxY5j4evWtpp9bUmbNc+WIQyMfTjRaoYwiY1sWQTg26sTsxlyas xc4/3PKbf7k1u9iOY7s+ciaFSzgWS+s2nWWcZGx7+T7mr1YoFTByGx49PTxW01/adReI wHJOALx7/+GmC7YJNv+5ocFLt/DCBe7tmwKb0Lk0tEcsDndUzBWvJuqDkVU0Q7Kwg/Ad pqzKa96ZqhbQjcPuKx3aGsTrgaXgdNfPA/LubwmI0GhnQo9rAnexXuq9mFSKShzv51sG 4bPQ10IiYDAiR7IUb4sQTycRzTpNe0ynONUqURGZV5rm7bcdhTgExcSt/K+e71QJhGd+ uD+A== X-Gm-Message-State: AOJu0YwyyAlEzHdlRaYzWue4+yqUhirOXGQg4cu0/O7r3P0aQBrIy/cE QI4n3Quht+husVA+59sxxh7LAdxEu1PFj82fVVJgEuwdqx2kkhiznRtbdjZsbjWV/ScSAFIIiMy T4yBLpL1ZHewIIbJsaNPXRcvhxDzUL+YNZw== X-Received: from isaacmanjarres.irv.corp.google.com ([2620:15c:2d:3:17ea:d296:86a:98b0]) (user=isaacmanjarres job=sendgmr) by 2002:a5b:1cc:0:b0:dbe:3e36:17db with SMTP id f12-20020a5b01cc000000b00dbe3e3617dbmr2237086ybp.1.1705955891476; Mon, 22 Jan 2024 12:38:11 -0800 (PST) Date: Mon, 22 Jan 2024 12:37:54 -0800 In-Reply-To: <2024012226-unmanned-marshy-5819@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <2024012226-unmanned-marshy-5819@gregkh> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240122203758.1435127-1-isaacmanjarres@google.com> Subject: [PATCH 5.15.y] iommu/dma: Trace bounce buffer usage when mapping buffers From: "Isaac J. Manjarres" To: stable@vger.kernel.org, Joerg Roedel , Will Deacon , Lu Baolu , Tom Murphy Cc: "Isaac J. Manjarres" , Saravana Kannan , Joerg Roedel , kernel-team@android.com, iommu@lists.linux-foundation.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" When commit 82612d66d51d ("iommu: Allow the dma-iommu api to use bounce buffers") was introduced, it did not add the logic for tracing the bounce buffer usage from iommu_dma_map_page(). All of the users of swiotlb_tbl_map_single() trace their bounce buffer usage, except iommu_dma_map_page(). This makes it difficult to track SWIOTLB usage from that function. Thus, trace bounce buffer usage from iommu_dma_map_page(). Fixes: 82612d66d51d ("iommu: Allow the dma-iommu api to use bounce buffers") Cc: stable@vger.kernel.org # v5.15+ Cc: Tom Murphy Cc: Lu Baolu Cc: Saravana Kannan Signed-off-by: Isaac J. Manjarres Link: https://lore.kernel.org/r/20231208234141.2356157-1-isaacmanjarres@google.com Signed-off-by: Joerg Roedel (cherry picked from commit a63c357b9fd56ad5fe64616f5b22835252c6a76a) Signed-off-by: Isaac J. Manjarres --- drivers/iommu/dma-iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 48c6f7ff4aef..8cd63e6ccd2c 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -25,6 +25,7 @@ #include #include #include +#include struct iommu_dma_msi_page { struct list_head list; @@ -817,6 +818,8 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, void *padding_start; size_t padding_size, aligned_size; + trace_swiotlb_bounced(dev, phys, size, swiotlb_force); + aligned_size = iova_align(iovad, size); phys = swiotlb_tbl_map_single(dev, phys, size, aligned_size, iova_mask(iovad), dir, attrs); -- 2.43.0.429.g432eaa2c6b-goog