From patchwork Wed Jul 10 13:57:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13729369 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2050.outbound.protection.outlook.com [40.107.215.50]) (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 D5D0A128369; Wed, 10 Jul 2024 13:58:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720619902; cv=fail; b=VEQZKAwjveDH9wL5sYlEwcPtn7XowDLuw5w71Ja0cig+4oDochjGemBJiJRHl4rDbTR4SfidQFaXrhMYwrA9n08C8KA+8gfoyJVRTeBPhfgpOHneAlQAsmancO2l8PlvebUityNmkxEYIWahr9f9Qbr5oWpXXrZkoooYOex8LpA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720619902; c=relaxed/simple; bh=7jQqwDm0MXfoSh6Wk/rFcNBHz1G4QRxsSCcSK5si6Ds=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=EGWlceDTKH6rkvDaTu7DeARGRWu7/PWpwSjuURYxg9dR1CNfwqZjivNtPGXFzXG+tkcDQwjUrLMLsKfn3Maok5rW+CKqT9ybxYP8V2jOb9p5BkM9OWdUAcOYD/saQIDokq2KqOVrZ1aFElgpnK6ovTTEWOZV/Vr2ThuA7z9N6bU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=OiTLtJUe; arc=fail smtp.client-ip=40.107.215.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="OiTLtJUe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iXohaOyD5v6GL0X0OPJKkNN48/SsCzeCuM4v1Apubm/WD3riWZo6KG8JnC4IN2hJ0mXFVlpSkTfzAxx0xtSwtqOHFj16xJEC3rKtxW7vu5gvkoWIbqx04SlBStRXuXpBJLKt+lNcFN+EmoZNgyN2M7PKNUFGGjVRuTVCaaZvNSQWtbufo0yL1EfQ902rJEMCAvBF+/WeJscNhhOTGK3vXjx+SOuUl+uxblWVPSpYiSbNbsvyF85TRBQOWELm/7nno5kwhf154W+U7c5S8mtyqqiCeXlIITAHs35JgO6rHprEq7WyWR+kgzA8icNIKGq/lWeLXwJm3GOsEkJraUNTew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eVfWZv1bxzI2AFs3g8Xez+PQlX+2bEmv+QBnAFOvTTs=; b=mj5GTVmp+yqAeKZLoQnTeF+EtrfUDIAaqp3BI7Ti7tDC95sVmQuhzkOwe9/QwjYuShRh+ge1Nh0v9fcrvNseQvf5xUCX4u98IIeKeaim28oozT77JBtQQp4VFO3uoz+fsjob5NZmyzNwT8Xcimvh8R94EPKwRmWRl2S6i+B8f83UycU+xrTEQHbDLVAntwZot3TMA7uXJ3gbMWm8Ws6pAaKxHwOZFk8iAr2mVv5bV1yLMLcAOYIkRJcKjobSLhNBZGjaRPMvu1eV48fLdtaxBhz5yyc4G8PXin19p5RFfcW0OJsLwfE5w2yWConEonkdm2mRjG10xjNpvjEJH+kLsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eVfWZv1bxzI2AFs3g8Xez+PQlX+2bEmv+QBnAFOvTTs=; b=OiTLtJUeF91hdaaG5twoAQg63D/Dr/S9XsvwbbFMP3oKY4lldDiZ/ThQBMuF+XQYx4QUEte35WjchC6KL7YXUp3a/JwagbtCaG/DmFIpRDjovtY4YHjOastvnxeLJS3W9xsNgvf9gZKH0tON+krd9sOoBlXRRTs5UtJ+ckQjgrj/QufEk9eNuY5XJq93Kuh1ew+YOMvhzZEVlW9AVbsTkQGsQhq+ocNfO+6q5hZLPmjne9YLN2B5lSLvEJVcSAUORpKDep6DJ/SAw1Nvx5P4uL+jAFB8QK7px4q3PNv0Dqcw940AyCKUGkSBSs6MlUjJHrnVcZ8Xjxv8lVYgpxuMMQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) by SEZPR06MB6383.apcprd06.prod.outlook.com (2603:1096:101:12c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Wed, 10 Jul 2024 13:58:14 +0000 Received: from SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd]) by SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd%5]) with mapi id 15.20.7741.033; Wed, 10 Jul 2024 13:58:14 +0000 From: Lei Liu To: Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , =?utf-8?q?Christian_K=C3=B6nig?= , Andrew Morton , David Hildenbrand , Matthew Wilcox , Muhammad Usama Anjum , Andrei Vagin , Ryan Roberts , Kefeng Wang , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH 0/2] Support direct I/O read and write for memory allocated by dmabuf Date: Wed, 10 Jul 2024 21:57:52 +0800 Message-Id: <20240710135757.25786-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCP286CA0073.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:31a::18) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|SEZPR06MB6383:EE_ X-MS-Office365-Filtering-Correlation-Id: 78d1f3d9-dc82-42b9-e7c7-08dca0e85737 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|52116014|366016|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: 7Lq4GyPq4CpU2WpK5VvQnF0Gm+9EqPSZWlL50s2IBT9aBt2Px5HLy5AGRWDPxtLEZbsiTbHUdfgfFR7um/lT7q+EPfUnP5kIP9rn5FZGuhMeBVXxiZQL/CSAZIW4cM6KDHK25O44DraJOlGvGb5oNSA5N6ABAzORD2kREEiLhloT3Id6ZI1fFPFhWJbSszEr6Rq2/2mMH1rx1SZHX+0zrT6Ea0VAPep8XWffJ2lxsRHL03eFUbeJA0Qo/huzxjt34a22x0IJ+cNf2FBMnebLKGiHRSEoDWZK4Lpv+OGIj3TL5r1Nt/HECKvWezjCSh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GkXInVeXV54a6w/q+yxJekL+0z8K9K8hejod040YfojhKEJw/4pRtcRt3dT9qCyrgcWww4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5624.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(52116014)(366016)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +/oZD+FZ8889yxcdc+raAqIq+zMzHaiXDMnscRfKSMA+cz7yzQJJucOTHPz/N2kU51VEY1rzHPNk39sBd4/h9oNPPLcMcISEx0Bot+r1nm6E6apNh3WD6Ezas93lx/7ihQGyp55OEO0UcuNG8zQ7OHTOEXtUo31dHV2yBqBARwHUbISShcPlqY8tkmnPCPHpDUUpB1GqAlyjjqWn/i21FzyC2H+uid5jn4hQU9DuGs7yZPUL+rAceKwsHffz7GOo6eVXdnbeO73j/a7WPZolii310kNMr3CgS3Hhy6fXeAJLc01IS1s5nO1zOQ1k1RsriPEeur+6eDlOJBefil144F7UAvFWimlXwc4NLvCU8HWy7uTxoBnVW03VTNEDq9DfmUYLEfIKpO5ad3O4sPKu7l2suSH3759AAc6zRf7/B1Ovyp8ICYRbAjraB788q7Sx2AQpf5+EEVQZc+LTZykBc1Q3SAekqtSCXQnIjKeRiFkWvD7xmi2Oy8aevQzTAs00eCZXZdo0rd6ffVKXKseTwRgvD97BU5ZmxHqCkILSi6HCHswY8l8iwGDLsxcrk8Ztu9R1b4uf5VTs4aFIywmsZl5yHlnwahJFhbFZ/8YsDrbrtxPbFpDWM+9tzSJVwgcyf9dF/wkXeYuDohY4joIeTp4WbdJurCVVnPldrE+AFBoLGzNlYsaeLV66kASmjql0YOqiFy/iS/PPUiRLpJFUX/gEJQr15DjP1xt+wv0A0aWOC+va1lQ3tunq1ZfMDg1cWl10xSLVoiyNEcUnqhsVfV5VjJ17xD5IBzsMNeYgG4iFnY0wCfTP+46jWDHIP6WBdT5hIKrS+zZ3UhnJEVnhtsXQqvMQBWfOkinM+6OTMpkI/5ioCh+5Kzn5UdMXaVYGX0vNcJTLrPrC+spg3AGCpsv9K3ihJlYDcjxKdSDIHeyMQD+0M85MXcRScrmJnG2RVejcIAAKH3Dr6m/sUGu5VDG7KAFeVeh03w5glekg77Z/qwZI1rdVYbkSDiwT8fPKfdUrExP/49vaIHT0Van5zGpO26p2+eKiG2dlROwJqJEONiqp8U40leZFr2YusWhdbEwwNvzUrFKZLyg7AIB/qHsosHBs8/XPD/nlBNM3VBTimI1UwNLHc1aqBMsHGzzK1NS7NE2FecGtXpl+JvsQoGuJf8THPGElLuShQKLyBYnOKyCiaHXSPQKXk6vTkmBJbJxebjpaKOhsrd276pQHMdyExCc8k602MsphO/Tk9daGxETdW54MlDcjksNTxFRN9KR48Qs31TF0h+g3MV27STS3o82/DquuidsnDX+80BSQx5jmQPqRDzN7gd8TrtrZ5hi8cp7NkHFttBKck8S9lK51dCJ+iYFU1ysRCsF5ccMICDcVJ9BxRz5MX/L3Eu3G7bqrDrdJXmThDRk1OFMyFhwP74q51FSi1Z/GnA+wSQwMvr5eyg6XX7wMgGxy0O+45ZDz1xkT8CWvivnkAywhRmEJ5hbpoOmxo3C+X9RcAzhXdiseL7Sm2dcRgT5nq3BBG/uL2grd/liHmn7arwqKsK9Z6MdHQuhNCfQBjW4LLlD2LKPD78xjsesG3DzndE/p X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78d1f3d9-dc82-42b9-e7c7-08dca0e85737 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2024 13:58:13.9903 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X3v8YVbJbbp+T5wvFwgq+NGy96poQFcPF9qNBjTLgJRLs836ahCjMTcPl1zQ/LNnmlxQNF8ed1W3QVHuT2zu+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6383 Use vm_insert_page to establish a mapping for the memory allocated by dmabuf, thus supporting direct I/O read and write; and fix the issue of incorrect memory statistics after mapping dmabuf memory. Lei Liu (2): mm: dmabuf_direct_io: Support direct_io for memory allocated by dmabuf mm: dmabuf_direct_io: Fix memory statistics error for dmabuf allocated memory with direct_io support drivers/dma-buf/heaps/system_heap.c | 5 +++-- fs/proc/task_mmu.c | 8 +++++++- include/linux/mm.h | 1 + mm/memory.c | 15 ++++++++++----- mm/rmap.c | 9 +++++---- 5 files changed, 26 insertions(+), 12 deletions(-)