From patchwork Tue Feb 11 08:38:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 24440 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF0B6206FF for ; Tue, 11 Feb 2014 08:39:35 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id w20sf16696353vbb.7 for ; Tue, 11 Feb 2014 00:39:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=EkvJ11qvJJ7LxE1GAvbGO4i3F2Fv6ht5LNJ4g2/INgo=; b=mrRfTQgKLtSLt1603qEM2mjT5oGat1fTrGUSt2in4nSNJjbxws6QiErFFdMnoocBGE ZpHRelK6ui7G3NjzI3fIHyDQDHNQvSaPlQxIjEpr5eckJaFnI0Eh8bw41YO4NmRcqwiZ Ahb+0xBRoGEXLyq8AX7luhndd65Qwu4lwRPHBC08MvZShlrnnIUieHD2msBDkAsHAQJ/ a5Aaki95t7yNt6rx07sxeEod32QRtABujX5C3gk/2KZ6+cwqvynbm/9IY2FYi3lx1oiX MyoijhLorsdtn5oS2pZfJBR7vq0Wu2jfv4+mFi7QFHrXXUxsk8PY2C9SuENIlMiakkAl vaNw== X-Gm-Message-State: ALoCoQlhIG7Ronl4U6Zz2fsyWDLeTfVGMqPOpDFCxILDv7ITZ0+uR4iobzbYVgAPUI/r4pQYBuXM X-Received: by 10.236.36.39 with SMTP id v27mr11576844yha.5.1392107974820; Tue, 11 Feb 2014 00:39:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.71 with SMTP id c65ls2307273qge.4.gmail; Tue, 11 Feb 2014 00:39:34 -0800 (PST) X-Received: by 10.58.186.132 with SMTP id fk4mr27108662vec.9.1392107974737; Tue, 11 Feb 2014 00:39:34 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id xs6si4635836vec.78.2014.02.11.00.39.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Feb 2014 00:39:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.47; Received: by mail-vb0-f47.google.com with SMTP id p6so5525545vbe.6 for ; Tue, 11 Feb 2014 00:39:34 -0800 (PST) X-Received: by 10.220.247.68 with SMTP id mb4mr20894vcb.37.1392107974647; Tue, 11 Feb 2014 00:39:34 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp229745vcz; Tue, 11 Feb 2014 00:39:34 -0800 (PST) X-Received: by 10.66.122.201 with SMTP id lu9mr30609320pab.40.1392107973580; Tue, 11 Feb 2014 00:39:33 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si18152485pbh.340.2014.02.11.00.39.31; Tue, 11 Feb 2014 00:39:32 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751462AbaBKIjV (ORCPT + 27 others); Tue, 11 Feb 2014 03:39:21 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:33694 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750758AbaBKIjR (ORCPT ); Tue, 11 Feb 2014 03:39:17 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N0T006TDPDFNV30@mailout4.samsung.com>; Tue, 11 Feb 2014 17:39:16 +0900 (KST) X-AuditID: cbfee61b-b7f456d000006dfd-fc-52f9e1b33d34 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id FB.EB.28157.3B1E9F25; Tue, 11 Feb 2014 17:39:15 +0900 (KST) Received: from amdc1339.mshome.net ([106.116.147.30]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N0T00JGIPD64G50@mmp1.samsung.com>; Tue, 11 Feb 2014 17:39:15 +0900 (KST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Marek Szyprowski , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Whitcroft , stable@vger.kernel.org Subject: [PATCH v3] x86: dma-mapping: fix GFP_ATOMIC macro usage Date: Tue, 11 Feb 2014 09:38:59 +0100 Message-id: <1392107939-29850-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgluLIzCtJLcpLzFFi42I5/e+xgO7mhz+DDB52WFh8WKthMW2juMXl XXPYLNYeuctucenAAiaLBRsfMVps3jSV2eLHhsesDhwesxp62Tw2repk83h37hy7x/t9V9k8 +rasYvT4vEnO40TLF9YA9igum5TUnMyy1CJ9uwSujN0XGpgKXnJWvOzqZmxg/MPexcjJISFg InF79jJWCFtM4sK99WxdjFwcQgKLGCV+XzvGAuG0MknMO/scrIpNwFCi620XG4gtImAgsfTM JCaQImaBm4wSP/f1AxVxcAgLOEj8uGMBUsMioCrx9ukNRhCbV8BD4taVTSwgJRICChJzJtlM YORewMiwilE0tSC5oDgpPddIrzgxt7g0L10vOT93EyM4fJ5J72Bc1WBxiFGAg1GJh/fCpx9B QqyJZcWVuYcYJTiYlUR4lY7/DBLiTUmsrEotyo8vKs1JLT7EKM3BoiTOe7DVOlBIID2xJDU7 NbUgtQgmy8TBKdXA2La684JtzqqtQcL1j+MfXhVjuatmv5LBTk6zNbv7ksSrqzoTrkn35rlp XlEzWHV5s9rPp7f+tvZ7Rv3e65ibqLFj79Ln2jdyGwuedR3Xzdc1i2d/P7O9RHxX/5YVNmc3 R95dffuhWtoOb8eL6huXT6264/NjK59i1AkW43mdylzXTz/5ZMpgrMRSnJFoqMVcVJwIALjB 7lcbAgAA Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , GFP_ATOMIC is not a single gfp flag, but a macro which expands to the other flags, where meaningful is the LACK of __GFP_WAIT flag. To check if caller wants to perform an atomic allocation, the code must test for a lack of the __GFP_WAIT flag. This patch fixes the issue introduced in v3.5-rc1. CC: stable@vger.kernel.org Signed-off-by: Marek Szyprowski --- Changelog: v3: - fixed spelling issues v2: - added more comments in the code to explain for _GFP_WAIT test v1: - initial version --- arch/x86/kernel/pci-dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 872079a..3519a78 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c @@ -100,8 +100,10 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, flag |= __GFP_ZERO; again: page = NULL; - if (!(flag & GFP_ATOMIC)) + /* CMA can be used only in the context which permits sleeping */ + if (flag & __GFP_WAIT) page = dma_alloc_from_contiguous(dev, count, get_order(size)); + /* fallback */ if (!page) page = alloc_pages_node(dev_to_node(dev), flag, get_order(size)); if (!page)