Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4544377yba; Wed, 17 Apr 2019 13:53:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4Vor0i8vF2vzcTVBwyhPm8/Avjyyg0rLEgW6+h17gOFJXAYaAkY6n4MWI9igV2zwkE+s8 X-Received: by 2002:a63:c45:: with SMTP id 5mr85700280pgm.385.1555534386290; Wed, 17 Apr 2019 13:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555534386; cv=none; d=google.com; s=arc-20160816; b=jY0M+xnFR15gYl7fTfR7SBDX0J4oxit97KQmhjLmaozv4rG+/qPhAEaUsEymxcwl+r T9snIQqSaQNRmYDiT42q/AZFwmXNmDWV0slf3Qomva8CY5rSV/ygS0kYcsEaafpLaRvB VWgrwpwD0SJOXDM1w0kw+iYQRX4/8/Tfo2fb7a1QI+4CXJmYOk/se2kOV2MIBBBj4qjQ KYz4Z325lRZwfF5wuLK4IxtRtwoS3tfnlHLPAm1welX698sCVt5hAZYupOBCe+HkfaIq yotvxD8CQnVGrEnoSZgpuu/tqZbTDfvBW4s2/juolMiD3h2zrRzLoCc6CC+NDkUik+5Y Fshw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=FKs6b6RLzOW6Pz03ZnepEKUCxUG5lBr2ZKHFqCP8uyY=; b=ZxdCtvlEqAm3SDyp4xvtEY44CVyBRiKyPtxNZ41OvitBF5cEFFpezopTUmA2whUyDG YgkrxEt7+cYqU5KS3zqERSvA0tDAC6wHtv21tnAAC9EdoIuJnSppkx7AW67zUtcNy8aK Q27Bs2C03qlrH3QF6b8XRDeJNPJxpHsIdlEwx7ksfbCZcCmYo9ASBghSCaOw0sYSMb0b Hkn8nBybhuJb/5bz5JfXgV2rk19IQGc22pLj5N8H+3zKSrvGjm+lNvH9Vt2Z6jiw6nea Q3NQTjcepdZanhgmHjjoHhLw1Q7sYYn6LZgx9eSHgIRex+EoMa0D0bzKvyO6TJ77kV+V b5uw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si54856pfh.36.2019.04.17.13.52.49; Wed, 17 Apr 2019 13:53:06 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732634AbfDQUsW (ORCPT + 99 others); Wed, 17 Apr 2019 16:48:22 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:47984 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbfDQUsW (ORCPT ); Wed, 17 Apr 2019 16:48:22 -0400 Received: from mail-it1-f197.google.com ([209.85.166.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hGrTg-0000OP-BW for linux-kernel@vger.kernel.org; Wed, 17 Apr 2019 20:48:20 +0000 Received: by mail-it1-f197.google.com with SMTP id o197so73941ito.3 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=ewuInX+FOw1AIuaS50Wc1sYSNkK/+EsWmTtMoS7PmzNtgK+0u4gtuVgRBziAvyTYMi TSFQYOm/be8CuKwdI2JtAYZPP6AE9jbgYSwDn3SVkdK0Q4k5lzJ3tSF1IoKZCFtZ+OiM APOVypppoRjSb7Tu+4TpeJ7puyq2DYsLCrpb9prWShPqvew1Ri7GCHa5Kw8/zAFrTtaR EdtdrDKIFSb+RNl6bPQEn1TPdYDVPPHaL6wrDPDDPCoye7w+OmfNyt/8q/SdqOc+KQH7 5mybXg2EIbiw2c0o0Az5DjI+U5ZaNWJY7EtQBEOmu/KAyW5TiaCrAlsaC3TD7hD6XuWy 4wDA== X-Gm-Message-State: APjAAAX5m9eUAlznqsGAXtwZxLQTK3Ftkc9ITBnLXsph/qDHmCHHnI8d DJIs218l80rWHUHH56NpNRBFjiSDFdVLQI5g06foC0AS6jcsupEb8kdaY25d12JjkxVALF9p5B4 nn/v8dCiWvG8oRv/ecGmrH+0OPxw2WmEwPVrqMul5ww== X-Received: by 2002:a05:6638:60e:: with SMTP id g14mr35030884jar.62.1555534099336; Wed, 17 Apr 2019 13:48:19 -0700 (PDT) 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 Cc: Marek Szyprowski , Robin Murphy , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Xinwei Kong Subject: [RFC] arm64: swiotlb: cma_alloc error spew Message-ID: <20190417204817.GA28897@xps13.dannf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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;