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=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham 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 79898C282DA for ; Wed, 17 Apr 2019 20:48:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 446DC21773 for ; Wed, 17 Apr 2019 20:48:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fwvAgGUT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 446DC21773 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=W3aNreY7iVRzZqQ2QvmvMRKJ/Qrf6StfYUMaw8sR+K8=; b=fwvAgGUTh4Esue u3Lj/taeEzVvUaZLusiUThHLb59AGidbHLLRyQ4Gb/cGlQUwyigmfp5xP03J3gmTgM7BvwN4S7+Fr 6GAclRyUCfEwhwdBB4UEicaMZ1jKUNpAyyikEX4jTaEqtnHFcb6Mdyispww02Ytw0lUwQk409S8yz pUCxXC8WaOXp4bOwXvI0sTmpM6arMneMwIGGhr4PnFqbS7YUvNkHOeNAnUHMqLuLSANZSjzguqFWT 8PrQ+rfyzyzWQfVU9hiUlnfU8RDEawK9YKHEzxxj+ceXNzVnbJuvox3basq4H+FrOs8UvTclaZG9H 3QnjORiekDmdtk1+WAWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGrTo-0003zD-B1; Wed, 17 Apr 2019 20:48:28 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGrTk-0003yS-LM for linux-arm-kernel@lists.infradead.org; Wed, 17 Apr 2019 20:48:26 +0000 Received: from mail-it1-f200.google.com ([209.85.166.200]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hGrTg-0000OO-BS for linux-arm-kernel@lists.infradead.org; Wed, 17 Apr 2019 20:48:20 +0000 Received: by mail-it1-f200.google.com with SMTP id y127so87536itb.1 for ; Wed, 17 Apr 2019 13:48:20 -0700 (PDT) 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:message-id:mime-version :content-disposition:user-agent; bh=FKs6b6RLzOW6Pz03ZnepEKUCxUG5lBr2ZKHFqCP8uyY=; b=MpaxZR6I8DEcwQY6BfvJFemG+p1153a3Q4DZNmroKicG2TVkOd1HUnoK00Nk67bnn/ 2FGdMmuxz2z1NPYMETTYIiM+whh9asBzp9WgSN6dTD3rOe1fIjC92yNnn1vO7KCH3o29 VeMWQtEyWhafTSOZQlBfxsQN4YdraEdxxA5zRDKBdABRmwDQeeSigC1Jn5uDkb98fbX6 lLkfPoZWMb+HjcIaqR9rMj1nMN2GnpO4Q/kLyf2RwxJ/6y8aEfki3IGa3rPWcDSTXy+n AdQ4lEwG0bfXUuonFnYVXFkr0M/WkK7NkUSO8Isn2O1+V1p06IrVRu26u2lNKI05S5Lf wY7g== X-Gm-Message-State: APjAAAXqxPdKkq3vpcuer7qHmuuY0w2VXIWe/ktfhPmpByVy7/j6Qn7f OY7eIcTeGVpBdmDo70dUHB9i8Q+WL/5Icu7fQ+cqH4d1gTDBcRa7eu9g0HapqvR2EMkEHx3XEEV UDPIwEg3+sm58PS5lzLO4Jj8vK1W4SRddQKNHqG2xAWk/IWX2XQQE X-Received: by 2002:a05:6638:60e:: with SMTP id g14mr35030886jar.62.1555534099336; Wed, 17 Apr 2019 13:48:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhLv8FzWKOUKRcFaZQ9Q3wrgT5tWJRdwXvjRnIIBQ9dn0sCLbXg/33/O5gcbPcDwLcpplrVg== X-Received: by 2002:a05:6638:60e:: with SMTP id g14mr35030865jar.62.1555534099071; Wed, 17 Apr 2019 13:48:19 -0700 (PDT) Received: from xps13.canonical.com (c-71-56-235-36.hsd1.co.comcast.net. [71.56.235.36]) by smtp.gmail.com with ESMTPSA id c99sm47406itd.4.2019.04.17.13.48.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Apr 2019 13:48:18 -0700 (PDT) Date: Wed, 17 Apr 2019 14:48:17 -0600 From: dann frazier To: Christoph Hellwig Subject: [RFC] arm64: swiotlb: cma_alloc error spew Message-ID: <20190417204817.GA28897@xps13.dannf> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190417_134824_840718_495D6C00 X-CRM114-Status: GOOD ( 12.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xinwei Kong , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Robin Murphy , linux-arm-kernel@lists.infradead.org, Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org hey, I'm seeing an issue on a couple of arm64 systems[*] where they spew ~10K "cma: cma_alloc: alloc failed" messages at boot. The errors are non-fatal, and bumping up cma to a large enough size (~128M) gets rid of them - but that seems suboptimal. Bisection shows that this started after commit fafadcd16595 ("swiotlb: don't dip into swiotlb pool for coherent allocations"). It looks like __dma_direct_alloc_pages() is opportunistically using CMA memory but falls back to non-CMA if CMA disabled or unavailable. I've demonstrated that this fallback is indeed returning a valid pointer. So perhaps the issue is really just the warning emission. The following naive patch solves the problem for me - just silence the cma errors, since it looks like a soft error. But is there a better approach? [*] APM X-Gene & HiSilicon Hi1620 w/ SMMU disabled diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 6310ad01f915b..0324aa606c173 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -112,7 +112,7 @@ struct page *__dma_direct_alloc_pages(struct device *dev, size_t size, /* CMA can be used only in the context which permits sleeping */ if (gfpflags_allow_blocking(gfp)) { page = dma_alloc_from_contiguous(dev, count, page_order, - gfp & __GFP_NOWARN); + true); if (page && !dma_coherent_ok(dev, page_to_phys(page), size)) { dma_release_from_contiguous(dev, page, count); page = NULL; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel