From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92E02C433E0 for ; Fri, 26 Feb 2021 04:19:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 496C164F14 for ; Fri, 26 Feb 2021 04:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbhBZESs (ORCPT ); Thu, 25 Feb 2021 23:18:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbhBZESp (ORCPT ); Thu, 25 Feb 2021 23:18:45 -0500 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A1A9C061574 for ; Thu, 25 Feb 2021 20:18:05 -0800 (PST) Received: by mail-qk1-x72b.google.com with SMTP id 204so7950130qke.11 for ; Thu, 25 Feb 2021 20:18:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fDTKQXWPODousjcFxfPrAdhXiScgfthwkHIVsnIoPbM=; b=abTtJIMMZ8KToSFWbjzFi32HOkPDN2rxZ+IfBv+eO62ap/dN702Uq0mU9oHC9j+snt vnVWV+5jH/p/0R+4U10lm2zTMAo+mTTld64KVC2G+prj4nocAzeugJM4VE5FsldHI9zg D677137O5m7d9bvVpQQ+IkqHWrA56M7YEa+Ng= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fDTKQXWPODousjcFxfPrAdhXiScgfthwkHIVsnIoPbM=; b=GYb1AobVpOgxNWzeQkqnBgTR36GEuYAiqN4hGi5RJQWv4LsFbfv6BPmTzSPPPfOqkE 10PZfc7MxSv9+aAmOSPsvSYUQJ1e4bMYWpTiqxYjzZWWQq8xXFHrbpNT1I3XK/EikauG 0ma+ifQA2MwEUczXcb+Zml2bPoRjYjO8bRD/8CwELUrvCZOCwZ3RrDcaqqO0UNz7Hiir H/A2U5j6MCzZCDyMSP9oZzqxGu7pcXb1TgcULODHAP4tIz8ap/fgqnROeEeIIXw133KQ O76fsDrGvn8cbF8yQAts94csSB2ZDH8OIa9EqvNxo7rYchrLjnSL8YDfdKLb/NuQJNx/ p71g== X-Gm-Message-State: AOAM531QL81sVuDSkyM5UYSCKTEjjQHLR12yOcsHrNcEr+oE2UNzxprF 9QGlEsgRRIrKkVecCCqMUS+bblg+2L64VQ== X-Google-Smtp-Source: ABdhPJxDTSFWfKJYme4dHZxcwefIYNMukDkaQMQ9S3lXJo1ntWwgRLdzTKAxr5CjgBYRybcdj1CHQw== X-Received: by 2002:a05:620a:1351:: with SMTP id c17mr1029656qkl.350.1614313083979; Thu, 25 Feb 2021 20:18:03 -0800 (PST) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com. [209.85.222.171]) by smtp.gmail.com with ESMTPSA id 38sm4987924qtb.21.2021.02.25.20.18.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Feb 2021 20:18:03 -0800 (PST) Received: by mail-qk1-f171.google.com with SMTP id w19so7935669qki.13 for ; Thu, 25 Feb 2021 20:18:02 -0800 (PST) X-Received: by 2002:a05:6638:5:: with SMTP id z5mr1097392jao.84.1614313081344; Thu, 25 Feb 2021 20:18:01 -0800 (PST) MIME-Version: 1.0 References: <20210209062131.2300005-1-tientzu@chromium.org> <20210209062131.2300005-13-tientzu@chromium.org> In-Reply-To: <20210209062131.2300005-13-tientzu@chromium.org> From: Claire Chang Date: Fri, 26 Feb 2021 12:17:50 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 12/14] swiotlb: Add restricted DMA alloc/free support. To: Rob Herring , mpe@ellerman.id.au, Joerg Roedel , Will Deacon , Frank Rowand , Konrad Rzeszutek Wilk , boris.ostrovsky@oracle.com, jgross@suse.com, Christoph Hellwig , Marek Szyprowski Cc: benh@kernel.crashing.org, paulus@samba.org, "list@263.net:IOMMU DRIVERS" , sstabellini@kernel.org, Robin Murphy , grant.likely@arm.com, xypron.glpk@gmx.de, Thierry Reding , mingo@kernel.org, bauerman@linux.ibm.com, peterz@infradead.org, Greg KH , Saravana Kannan , "Rafael J . Wysocki" , heikki.krogerus@linux.intel.com, Andy Shevchenko , Randy Dunlap , Dan Williams , Bartosz Golaszewski , linux-devicetree , lkml , linuxppc-dev@lists.ozlabs.org, xen-devel@lists.xenproject.org, Nicolas Boichat , Jim Quinlan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c > index fd9c1bd183ac..8b77fd64199e 100644 > --- a/kernel/dma/swiotlb.c > +++ b/kernel/dma/swiotlb.c > @@ -836,6 +836,40 @@ late_initcall(swiotlb_create_default_debugfs); > #endif > > #ifdef CONFIG_DMA_RESTRICTED_POOL > +struct page *dev_swiotlb_alloc(struct device *dev, size_t size, gfp_t gfp) > +{ > + struct swiotlb *swiotlb; > + phys_addr_t tlb_addr; > + unsigned int index; > + > + /* dev_swiotlb_alloc can be used only in the context which permits sleeping. */ > + if (!dev->dev_swiotlb || !gfpflags_allow_blocking(gfp)) Just noticed that !gfpflags_allow_blocking(gfp) shouldn't be here. Hi Christoph, Do you think I should fix this and rebase on the latest linux-next now? I wonder if there are more factor and clean up coming and I should wait after that. Thanks, Claire