Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1698713ybf; Sun, 1 Mar 2020 16:05:27 -0800 (PST) X-Google-Smtp-Source: ADFU+vsGhrYFcI6ND5dYU/viA84AmWkCx+rlBCoLvjMQAaXPysFRdfmM/+Fy15+kJq80Z1TbrZf2 X-Received: by 2002:a05:6830:110:: with SMTP id i16mr2655004otp.189.1583107527057; Sun, 01 Mar 2020 16:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583107527; cv=none; d=google.com; s=arc-20160816; b=jTtiMRYqfpmyevkDDL8/hRk0cxZRsRGzA6ksdsP77tuSr16ZR2YbRYLy7mInT7kMkF FdV1ZTpdez/0WpgnetI+9NqIbCc8j8FSmPTZiubTxlWEJtKt8aQ/KtH/JMXUT1/MqFnZ q+NK8D5iqiqNJ++r+zUhkSAsguHpowoFtQ8rISVP2ABL1MHT4l1FEdSma0iv8VU0Ul6z q9DoBEFyvxC1YkDQSxLKPuS9WSBcQsas5GPk3NyAt1r+PczHpfv9NQ+/JKeJCwD+SQsX EWjx/bx227Qcov06HS60GeVDVVonxKkzNKBT6I3O8cX5KlJ0Tp24V1fvrEMzF8VlV0Wz 2U1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=duQmTYNCdTI2ExbCdQAh/8UU3ifimZfip77jBZoZbNU=; b=E8O0emOaofhD3ZCRBqcONn0l2dDiuHVNbztm2Xwq6bntjoAGZ52pO5dzJ1bzEg1I/h mG6/7Iw3Oi+lXjLs+OiXOBai1o0BUwUod/GrNRnfl46A/tlI2geCcgtW2Jts0gphpmR8 m02UtQIvyqXg6QvNko2AOfn79la8jh5V6MP7BOLOqdTd1PJPx04+xpuHv+BzS0KHekqI e4xqAZdXCFB/K8y0Eb/Ja3Txd0Or+Zc1HAZTl/9L2ksbTHfssKoAonuSSi7Pga5D4iKv jvDgiSiD4eni2yMh0amu2Qo/WrGsFwhhvKvaR5rWjBisKMScz00UQjGFknoqTebajxWV ZL2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jlj7siV1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si5716950oif.14.2020.03.01.16.05.13; Sun, 01 Mar 2020 16:05:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jlj7siV1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726714AbgCBAFG (ORCPT + 99 others); Sun, 1 Mar 2020 19:05:06 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33608 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726592AbgCBAFG (ORCPT ); Sun, 1 Mar 2020 19:05:06 -0500 Received: by mail-pf1-f196.google.com with SMTP id n7so4669024pfn.0 for ; Sun, 01 Mar 2020 16:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=duQmTYNCdTI2ExbCdQAh/8UU3ifimZfip77jBZoZbNU=; b=jlj7siV1TsnOyaF1QtiqKfaebECjBDKmNmm8gEL4qjrYBk63y7xp8jMWhXyNh7Q7X2 YSv0ijY85X5tt61zI80JKR8FceG+hyKaKTY13aWQdAlQd3TTRF2ASyO3Jzotsl2DI8oy dVs0kIJMxRuDvZDgHTR/gjlh32aMfFeoCmer8w1ttzI17Yse52omc1BYOuus4AqYc6I3 4lt+mnUY60HfrHA7fHcIG72Wghpe4Mp2Z8GPGR3+bVH1wbtPlBBJsAeIizt1rVi8wPBw bFDGCbpr9j2QF8iBsvBDvcVib8UNAbqEc2YAoWyY+W/EpJX89VRUfkSA2+tjsSViVIVK ZLYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=duQmTYNCdTI2ExbCdQAh/8UU3ifimZfip77jBZoZbNU=; b=QGslXT/haoWvVtV9uEJj5rk3zO+BaB1b65O0VwF3oTIC3HJzL4jJ8j30ui1UODdjP5 iYxoCj5CQTdA8cpTicPc3s26VSc8Enjw+71+rXj5FI2xpAGg235y2RZ6h8cC8DQDktcx /VS8fR0G/t1TEhT09sTCvXF5Bhxv6oAD7wrglEUzHbcQ9d05GJ1at4zlTAItwuInEGm0 qPWqUADWwCYIEUpOQKBmEIUP6hoSCMOx4vai89TkCk+vHHHglA1a7IRUeSAvBPby4qo6 9BbO+35Hs79Hww0YKLfCG6Pj5ccjFz1SrnRlQc4j50EiqFtLe+xhWT3RSLcNELg4PJA9 drBw== X-Gm-Message-State: APjAAAUkWwpdbP4+byN7kfr0u/Q30pJJoGsfGLh+3X+eSvMYIOBrRd1+ 9l7aZAUP8WrhNzzN77vWFmt45Q== X-Received: by 2002:a63:7e52:: with SMTP id o18mr16843186pgn.46.1583107504654; Sun, 01 Mar 2020 16:05:04 -0800 (PST) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id y16sm18340134pfn.177.2020.03.01.16.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2020 16:05:03 -0800 (PST) Date: Sun, 1 Mar 2020 16:05:03 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Christoph Hellwig , Tom Lendacky cc: "Singh, Brijesh" , "Grimm, Jon" , Joerg Roedel , baekhw@google.com, "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" Subject: [rfc 0/6] unencrypted atomic DMA pools with dynamic expansion In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org set_memory_decrypted() may block so it is not possible to do non-blocking allocations through the DMA API for devices that required unencrypted memory. The solution is to expand the atomic DMA pools for the various possible gfp requirements as a means to prevent an unnecessary depletion of lowmem. These atomic DMA pools are kept unencrypted so they can immediately be used for non-blocking allocations. Since the need for this type of memory depends on the kernel config and devices being used, these pools are also dynamically expandable. Some of these patches could be squashed into each other, but they were separated out to ease code review. This patchset is based on 5.6-rc4. --- arch/x86/Kconfig | 1 + drivers/iommu/dma-iommu.c | 5 +- include/linux/dma-direct.h | 2 + include/linux/dma-mapping.h | 6 +- kernel/dma/direct.c | 17 ++-- kernel/dma/remap.c | 173 +++++++++++++++++++++++++----------- 6 files changed, 140 insertions(+), 64 deletions(-)