From patchwork Fri Jan 24 13:53:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 23675 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 96829203C5 for ; Fri, 24 Jan 2014 13:54:39 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id ii20sf5271434qab.1 for ; Fri, 24 Jan 2014 05:54:38 -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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=PWA8Sqp6mAcy+f8RZ5gzIyrKB7GaIHFoRROYsA0QMUQ=; b=OhAJ+Lo1iGx7Ipiq5jbumWKQ6dgl2rrT8QH/53rl0K7E9vgXd0x5DQrM1tIqSE2KiU nfakAQIu1o7qsvLPtIp6EzHTpmYViQqw+W5JpYq+vny+9Wn18IKVrooQQS1R4uB2yuoJ Mazn+80hXjno2ZOTcQJHc7cF41LntbjmCEOIoPHlvCW3ChQTEJ998yR34C4uNqG3ldbP WdPqOhXN2UvvJ92bokzxD0E9XwWnnOhphZx7JDFSfgDgKLR+wtrdn+QCLT48hjuoVWem vIZZ9ywuRnEIFeJQo4O454xjv5Xkc/zVQXxZT7HCv1e7WH+xsiC5ludFNi2oXiV0E6w8 Pn3w== X-Gm-Message-State: ALoCoQn7wiTSKrzSK+c0MNbU33gasQBeJyWSaWz0dHVtTEBcXeKVFMSndd1VDz+uai0TMhkrgYr5 X-Received: by 10.236.111.73 with SMTP id v49mr4323344yhg.46.1390571678662; Fri, 24 Jan 2014 05:54:38 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.196 with SMTP id m62ls545987qge.11.gmail; Fri, 24 Jan 2014 05:54:38 -0800 (PST) X-Received: by 10.220.159.4 with SMTP id h4mr7760703vcx.1.1390571678535; Fri, 24 Jan 2014 05:54:38 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id a2si553042vea.67.2014.01.24.05.54.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 05:54:38 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id oz11so1926504veb.7 for ; Fri, 24 Jan 2014 05:54:38 -0800 (PST) X-Received: by 10.58.94.195 with SMTP id de3mr192539veb.39.1390571678195; Fri, 24 Jan 2014 05:54:38 -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 u4csp103878vcz; Fri, 24 Jan 2014 05:54:37 -0800 (PST) X-Received: by 10.66.227.4 with SMTP id rw4mr14514069pac.128.1390571677041; Fri, 24 Jan 2014 05:54:37 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gx4si1238054pbc.261.2014.01.24.05.54.36; Fri, 24 Jan 2014 05:54:36 -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 S1752783AbaAXNy3 (ORCPT + 27 others); Fri, 24 Jan 2014 08:54:29 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:40119 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752209AbaAXNy1 (ORCPT ); Fri, 24 Jan 2014 08:54:27 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MZW0033ARYQ58D0@mailout3.samsung.com>; Fri, 24 Jan 2014 22:54:26 +0900 (KST) X-AuditID: cbfee61a-b7fb26d00000724f-6b-52e270924271 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 71.03.29263.29072E25; Fri, 24 Jan 2014 22:54:26 +0900 (KST) Received: from amdc1339.mshome.net ([106.116.147.30]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MZW0013JRYHGE00@mmp2.samsung.com>; Fri, 24 Jan 2014 22:54:26 +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 v2] x86: dma-mapping: fix GFP_ATOMIC macro usage Date: Fri, 24 Jan 2014 14:53:10 +0100 Message-id: <1390571590-14410-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1389948399-26344-1-git-send-email-m.szyprowski@samsung.com> References: <1389948399-26344-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrALMWRmVeSWpSXmKPExsVy+t9jQd1JBY+CDNa+57D4sFbDYtpGcYvL u+awWaw9cpfd4tKBBUwWCzY+YrTYvGkqs8WPDY9ZHTg8ZjX0snlsWtXJ5vHu3Dl2j/f7rrJ5 9G1ZxejxeZOcx4mWL6wB7FFcNimpOZllqUX6dglcGb8/5hRc4qiY3vGZtYGxj72LkZNDQsBE YuuuH8wQtpjEhXvr2boYuTiEBKYzSvy+sY8Jwmllkvg6rZMVpIpNwFCi620XG4gtImAgsfTM JLAiZoGbjBI/9/WDFQkLOEjc2DcFzGYRUJVYsq2BEcTmFfCQ2DOvBaiBA2idgsScSTYgYU4B T4nZX36xgNhCQCXTDv5knsDIu4CRYRWjaGpBckFxUnquoV5xYm5xaV66XnJ+7iZGcLg9k9rB uLLB4hCjAAejEg/vjMCHQUKsiWXFlbmHGCU4mJVEeLcGPAoS4k1JrKxKLcqPLyrNSS0+xCjN waIkznug1TpQSCA9sSQ1OzW1ILUIJsvEwSnVwLghbcfih8tYfu/cdYAj5CXvv+MBVmHxk1zN bhyTYt+/2zT6+Q1JmddzFn3y+boiQKY+MWWDt35S5O9E3+y1ixKPv38cYzsliYExLnfv76gN h35Gn7ObqejAG8Bz6Wjxq26e2CdHpv3LXndQ7xz/VIvn+/eXbN55qavAlzVPxinJ9mlnyYEf GxSUWIozEg21mIuKEwGxL5KbMwIAAA== 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.128.176 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 anatomic 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 --- 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 allows 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)