Received: by 10.213.65.68 with SMTP id h4csp566822imn; Wed, 28 Mar 2018 08:41:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+GRyWXzU/kR0chyNnPhS3bNiyaf5IF92YFvQl1sBx4v6XIKrEGy73fe02AIxkwvwpJ8ZbB X-Received: by 10.101.66.6 with SMTP id c6mr2951157pgq.35.1522251706491; Wed, 28 Mar 2018 08:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522251706; cv=none; d=google.com; s=arc-20160816; b=XHkX+Aoojm87uA6tOvsOkFlImCMNzhpnT8sbDBGdaburAOELKDlpUq3IYcPh786XDv DVxd2HiWzheGJAotmzm4i1ZaSj7AMI2f/WR7IXoKD9v65owv97E4i0OENvaXSmeg5M+O qpm2bW6SmPmYlOh8+vun4z5nw4pIooxVQQ1KGtpLG84yxDZYbBbSCyGXWXZJvUQAKERI fHEC6kf8ltBqiG3NjTJZw2CzVy4ZruajIEkgqrVLsK+sG0ZaZKYWzn+jUZzWzzveMASm fJmB1mAAZgIxhr4Ji4gezBaaI+bun0Kpd6grfk7FN1Prvz2f3OBKDY3nCPl47VnkHcst qelQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=a+ieUqOZWIPvhOKs9FCKfrEgz/AISHxcc0+U/zHFgoM=; b=aqy3pK9MK1Tl3IgfP7vjcNL0RqUr86+Wok5wXVjKsFdnXKmuPAr7sS5oB20aSxl3dD HOAW4kVp5hUZS7z1PI8lqzuXJGZPU2x+UdC+nNhjyqjxvYLJezQEAOOehUb1dTKeg0i0 YXxD4EV0kIVv2dOoflauhqBdYQdzczyl0jSkCyeA5Od4iDesyKnppKC1e8GzqUR/I72z wzAUreQKwMArtMRa/5nym0OlTq6oj0a0LtFw5u8u1DeuJtd/R0VmmvPv6lYDE6yh5NI6 nN5nOpVbtbz+7h0IgIru+BT1EfmYFAM94k4QCKueQxZ12eXSAjo+TjrcCarGAjOlF9GG mdpQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9-v6si3770311pll.27.2018.03.28.08.41.31; Wed, 28 Mar 2018 08:41:46 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753970AbeC1Pk1 (ORCPT + 99 others); Wed, 28 Mar 2018 11:40:27 -0400 Received: from terminus.zytor.com ([198.137.202.136]:54371 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753710AbeC1Pk0 (ORCPT ); Wed, 28 Mar 2018 11:40:26 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2SFeCUL1106017; Wed, 28 Mar 2018 08:40:12 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2SFeCgR1106014; Wed, 28 Mar 2018 08:40:12 -0700 Date: Wed, 28 Mar 2018 08:40:12 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Christoph Hellwig Message-ID: Cc: sebott@linux.vnet.ibm.com, tglx@linutronix.de, hch@lst.de, mingo@kernel.org, Evgeniy.Didin@synopsys.com, linux-kernel@vger.kernel.org, hpa@zytor.com Reply-To: linux-kernel@vger.kernel.org, hpa@zytor.com, Evgeniy.Didin@synopsys.com, mingo@kernel.org, hch@lst.de, sebott@linux.vnet.ibm.com, tglx@linutronix.de In-Reply-To: <20180328133535.17302-2-hch@lst.de> References: <20180328133535.17302-2-hch@lst.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/dma] dma-mapping: Don't clear GFP_ZERO in dma_alloc_attrs Git-Commit-ID: e89f5b37015309a8bdf0b21d08007580b92f92a4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e89f5b37015309a8bdf0b21d08007580b92f92a4 Gitweb: https://git.kernel.org/tip/e89f5b37015309a8bdf0b21d08007580b92f92a4 Author: Christoph Hellwig AuthorDate: Wed, 28 Mar 2018 15:35:35 +0200 Committer: Thomas Gleixner CommitDate: Wed, 28 Mar 2018 17:34:23 +0200 dma-mapping: Don't clear GFP_ZERO in dma_alloc_attrs Revert the clearing of __GFP_ZERO in dma_alloc_attrs and move it to dma_direct_alloc for now. While most common architectures always zero dma cohereny allocations (and x86 did so since day one) this is not documented and at least arc and s390 do not zero without the explicit __GFP_ZERO argument. Fixes: 57bf5a8963f8 ("dma-mapping: clear harmful GFP_* flags in common code") Reported-by: Evgeniy Didin Reported-by: Sebastian Ott Signed-off-by: Christoph Hellwig Signed-off-by: Thomas Gleixner Tested-by: Evgeniy Didin Cc: iommu@lists.linux-foundation.org Link: https://lkml.kernel.org/r/20180328133535.17302-2-hch@lst.de --- include/linux/dma-mapping.h | 8 ++------ lib/dma-direct.c | 3 +++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index eb9eab4ecd6d..12fedcba9a9a 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -518,12 +518,8 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) return cpu_addr; - /* - * Let the implementation decide on the zone to allocate from, and - * decide on the way of zeroing the memory given that the memory - * returned should always be zeroed. - */ - flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO); + /* let the implementation decide on the zone to allocate from: */ + flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM); if (!arch_dma_alloc_attrs(&dev, &flag)) return NULL; diff --git a/lib/dma-direct.c b/lib/dma-direct.c index 1277d293d4da..c0bba30fef0a 100644 --- a/lib/dma-direct.c +++ b/lib/dma-direct.c @@ -59,6 +59,9 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, struct page *page = NULL; void *ret; + /* we always manually zero the memory once we are done: */ + gfp &= ~__GFP_ZERO; + /* GFP_DMA32 and GFP_DMA are no ops without the corresponding zones: */ if (dev->coherent_dma_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS)) gfp |= GFP_DMA;