Received: by 10.223.176.46 with SMTP id f43csp2114255wra; Sun, 21 Jan 2018 11:38:06 -0800 (PST) X-Google-Smtp-Source: AH8x227zHlvaQKWoVnP85acvRV1z7QYVNqusvUUaw3b5/JNKiSwWK15K2ke0MFVu4GwdyHEwZOiE X-Received: by 10.99.67.197 with SMTP id q188mr5045018pga.255.1516563486546; Sun, 21 Jan 2018 11:38:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516563486; cv=none; d=google.com; s=arc-20160816; b=ILzbcl8gcWBmo+u99fi8vC22soyH4SaTXcA9siP/FTQ8KTGXfG2c0yPGs+mhvQBJN9 nRo4ohTokoneWV96dPNk7ByMZ6nM0Qt9UtI6jWMZQ3Sb+GS3Vv922O/aCZVvIJb4GMpJ qBH2k6i/1864IabvuRTwKnhgaagz0WTwLIWSqxVsO2VXtHwFPAe35Ld+nqpsDn8Ry7xU xUwOBsA8v1wH96H040GO4zRzPaenro5SGJr/oI14f2uwGg+faXjbYPr1evK8J8Pz5ZSP GDo3rJB6HjhVrXBFJJPCCDrnRyF8DPAS8LwZ23jyMubH9l3HQ9qqxoxP2s29Ka+myjCB JXEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=mbm4wO7RCwRyGpYpwBXKBnHWsJ2SZkHo0WFNbVqyUxg=; b=maVvq2bnfLCQ3FMzwC1RgG+ux8bEpJfQmKblacYzN1kseo9GrI6ouDufF5j84ItkyG xKnQeq0BX9/0Cn8HfiyLiqJ5t9nQJ4AFs/Hyw1gsif2Pck95hR145jvPdyXPpDQM6r3j 5OSEt9Lt5f12fcOuIm6JhFnYV0hI14xGbkfBWNHiCRKOZqrAwFsk68eU3dOFARN2ZtrY AWpug70uF74QpwE1jg+xI6xvflmdEhrVgC8RgLQtQp76NfUBFsiasupzl/5dLWwcAyHe Bt/c6W9yzp/swZfZhm8nqsqESdOiovcfNBGQN2Ng3cAL8mO820njx5c2JsD8HysNl1Vn bljg== 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 u184si12284504pgd.675.2018.01.21.11.37.51; Sun, 21 Jan 2018 11:38:06 -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; 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 S1751347AbeAUTh2 (ORCPT + 99 others); Sun, 21 Jan 2018 14:37:28 -0500 Received: from smtprelay0105.hostedemail.com ([216.40.44.105]:39438 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750945AbeAUTh1 (ORCPT ); Sun, 21 Jan 2018 14:37:27 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 32D2119B2B; Sun, 21 Jan 2018 19:37:26 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:421:541:599:966:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:1981:2194:2196:2198:2199:2200:2201:2393:2553:2559:2562:2731:2828:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:4385:5007:6117:6119:7903:10004:10848:11026:11232:11473:11658:11914:12043:12296:12438:12555:12740:12895:13161:13229:13255:13439:13894:14096:14097:14181:14659:14721:21080:21212:21433:21627:30012:30029:30054:30070:30075:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: hour18_40bbfed6c7c31 X-Filterd-Recvd-Size: 5660 Received: from XPS-9350 (unknown [47.151.150.235]) (Authenticated sender: joe@perches.com) by omf05.hostedemail.com (Postfix) with ESMTPA; Sun, 21 Jan 2018 19:37:24 +0000 (UTC) Message-ID: <1516563443.24895.16.camel@perches.com> Subject: Re: [PATCH] Intel-IOMMU: Delete an error message for a failed memory allocation in init_dmars() From: Joe Perches To: =?ISO-8859-1?Q?J=F6rg_R=F6del?= Cc: SF Markus Elfring , iommu@lists.linux-foundation.org, David Woodhouse , LKML , kernel-janitors@vger.kernel.org Date: Sun, 21 Jan 2018 11:37:23 -0800 In-Reply-To: <20180121071903.GD28161@8bytes.org> References: <20180120133452.GB28161@8bytes.org> <6b452dfb-b2fc-2417-26b3-bbcdf11ed06f@users.sourceforge.net> <20180120194004.GC28161@8bytes.org> <1516498672.24895.2.camel@perches.com> <20180121071903.GD28161@8bytes.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2018-01-21 at 08:19 +0100, J?rg R?del wrote: > On Sat, Jan 20, 2018 at 05:37:52PM -0800, Joe Perches wrote: > > While Markus' commit messages are nearly universally terrible, > > is there really any signficant value in knowing when any > > particular OOM condition occurs other than the subsystem that > > became OOM? > > > > You're going to be hosed in any case. > > > > Why isn't the generic OOM stack dump good enough? > > Because if we know the exact allocation attempt that failed right away, > we can more easily check if we can rewrite it so that it is more likely > to succeed, e.g. rewriting one higher-order allocation to multiple > order-0 allocations. Up to you but I think that's pretty dubious as this is an init function and if it fails the system really is stuffed. Unrelated, there are some unnecessary casts of pointers to void * that could be removed to help make the code a bit more regular as some callers use the cast and some do not. --- drivers/iommu/intel-iommu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 4a2de34895ec..8d7ea76345ae 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -845,8 +845,8 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu if (!context) return NULL; - __iommu_flush_cache(iommu, (void *)context, CONTEXT_SIZE); - phy_addr = virt_to_phys((void *)context); + __iommu_flush_cache(iommu, context, CONTEXT_SIZE); + phy_addr = virt_to_phys(context); *entry = phy_addr | 1; __iommu_flush_cache(iommu, entry, sizeof(*entry)); } @@ -1298,7 +1298,7 @@ static int iommu_alloc_root_entry(struct intel_iommu *iommu) struct root_entry *root; unsigned long flags; - root = (struct root_entry *)alloc_pgtable_page(iommu->node); + root = alloc_pgtable_page(iommu->node); if (!root) { pr_err("Allocating root entry for %s failed\n", iommu->name); @@ -1978,7 +1978,7 @@ static int domain_init(struct dmar_domain *domain, struct intel_iommu *iommu, domain->nid = iommu->node; /* always allocate the top pgd */ - domain->pgd = (struct dma_pte *)alloc_pgtable_page(domain->nid); + domain->pgd = alloc_pgtable_page(domain->nid); if (!domain->pgd) return -ENOMEM; __iommu_flush_cache(iommu, domain->pgd, PAGE_SIZE); @@ -4168,7 +4168,7 @@ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) if (!rmrru->resv) goto free_rmrru; - rmrru->devices = dmar_alloc_dev_scope((void *)(rmrr + 1), + rmrru->devices = dmar_alloc_dev_scope(rmrr + 1, ((void *)rmrr) + rmrr->header.length, &rmrru->devices_cnt); if (rmrru->devices_cnt && rmrru->devices == NULL) @@ -4229,7 +4229,7 @@ int dmar_parse_one_atsr(struct acpi_dmar_header *hdr, void *arg) memcpy(atsru->hdr, hdr, hdr->length); atsru->include_all = atsr->flags & 0x1; if (!atsru->include_all) { - atsru->devices = dmar_alloc_dev_scope((void *)(atsr + 1), + atsru->devices = dmar_alloc_dev_scope(atsr + 1, (void *)atsr + atsr->header.length, &atsru->devices_cnt); if (atsru->devices_cnt && atsru->devices == NULL) { @@ -4465,7 +4465,7 @@ int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) rmrr = container_of(rmrru->hdr, struct acpi_dmar_reserved_memory, header); if (info->event == BUS_NOTIFY_ADD_DEVICE) { - ret = dmar_insert_dev_scope(info, (void *)(rmrr + 1), + ret = dmar_insert_dev_scope(info, rmrr + 1, ((void *)rmrr) + rmrr->header.length, rmrr->segment, rmrru->devices, rmrru->devices_cnt); @@ -4483,7 +4483,7 @@ int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) atsr = container_of(atsru->hdr, struct acpi_dmar_atsr, header); if (info->event == BUS_NOTIFY_ADD_DEVICE) { - ret = dmar_insert_dev_scope(info, (void *)(atsr + 1), + ret = dmar_insert_dev_scope(info, atsr + 1, (void *)atsr + atsr->header.length, atsr->segment, atsru->devices, atsru->devices_cnt); @@ -4920,7 +4920,7 @@ static int md_domain_init(struct dmar_domain *domain, int guest_width) domain->max_addr = 0; /* always allocate the top pgd */ - domain->pgd = (struct dma_pte *)alloc_pgtable_page(domain->nid); + domain->pgd = alloc_pgtable_page(domain->nid); if (!domain->pgd) return -ENOMEM; domain_flush_cache(domain, domain->pgd, PAGE_SIZE);