Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1214310pxk; Fri, 18 Sep 2020 06:54:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3TPt8WOp9PH0kjdSCewDdjC4+ebF6dUJ51uXz90eMGycy3RDfBpPprVptZ9xwjjVDxrdh X-Received: by 2002:a17:906:f9d3:: with SMTP id lj19mr35722089ejb.346.1600437282914; Fri, 18 Sep 2020 06:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600437282; cv=none; d=google.com; s=arc-20160816; b=oG7X+5wYdqDPc8eU+UIvVicLV835K4GScOtiQ2VieZgfo4x9Gt0/hLSGB00PjT/LeP kg84Kj1mm/fSJuVN14YrzRQFD5diMczBIoeIQ7U/QL3POxZheY6E2uOuGmxxXx2lWuh2 bYVjmreUysQ/Fv7N5Dp7JtVpWkFTezGpwqr+mda5c18pwA5t6Ya1DP7zzK/UI+xWRAgh 7FqD/uQ3qR8j8c1MqRX5U0lEcnEcg7SeRcd5bWsNF6hwcJM+QHD1q3kFWStYX5IWahWw rQUc9h53D3Aj2uhI59XuJnkehLNYUF9N9n0EvWw2SWsFGcKvZJFmDn41EeGu77AnEIZp +GTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=7noMKMbDZheDfRqktcO5+RC9QlKQaBqbmZB2/JPJb6o=; b=XNLVxKh1a47Bb2AbJofOHprpZhI/eCvaGY9AeTqRos6CENYxZ7Lhc00dtzH3cWQm8D QPvMfxxiPqkEG6U3Dkfg4MHPLaX67AAo4jEbta8WEZr3m9n2jhwF+OFARFaG/TRmTCA7 Dh/r5F8sLyg5D3EGlLU5W2NSctr9m7H6y374kxWMYGmAMN57Zg7NxDT+9EVdiDfCC1aR zROwcKtzuljxMTpTHBz91Jk+7dlkE3ff54L/a8mob11nnalBh9D/4WHRoAiemNBek0Ec 7XjLNh4efiFl8JfLllzglIRbD1gBld9cRuZy3OrfXtKmgnG2reeV4FDRDqlXSek06bP3 XxWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jo4si2155458ejb.681.2020.09.18.06.54.19; Fri, 18 Sep 2020 06:54:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726192AbgIRNvf (ORCPT + 99 others); Fri, 18 Sep 2020 09:51:35 -0400 Received: from foss.arm.com ([217.140.110.172]:42942 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbgIRNve (ORCPT ); Fri, 18 Sep 2020 09:51:34 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3797330E; Fri, 18 Sep 2020 06:51:34 -0700 (PDT) Received: from [10.57.47.84] (unknown [10.57.47.84]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 603C83F718; Fri, 18 Sep 2020 06:51:33 -0700 (PDT) Subject: Re: [PATCH] Handle init_iova_flush_queue failure in dma-iommu path To: Joerg Roedel , Tom Murphy Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <20200910122539.3662-1-murphyt7@tcd.ie> <20200918085501.GJ31590@8bytes.org> From: Robin Murphy Message-ID: <82d5f9c9-1001-3ed3-05f2-1a3b87ca023d@arm.com> Date: Fri, 18 Sep 2020 14:51:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20200918085501.GJ31590@8bytes.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-09-18 09:55, Joerg Roedel wrote: > On Thu, Sep 10, 2020 at 01:25:38PM +0100, Tom Murphy wrote: >> init_iova_flush_queue can fail if we run out of memory. Fall back to noflush >> queue if it fails. >> >> Signed-off-by: Tom Murphy >> --- >> drivers/iommu/dma-iommu.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c >> index 4959f5df21bd..5f69126f3e91 100644 >> --- a/drivers/iommu/dma-iommu.c >> +++ b/drivers/iommu/dma-iommu.c >> @@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base, >> >> if (!cookie->fq_domain && !iommu_domain_get_attr(domain, >> DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) { >> - cookie->fq_domain = domain; >> - init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL); >> + if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, >> + NULL)) >> + pr_warn("iova flush queue initialization failed\n"); >> + else >> + cookie->fq_domain = domain; >> } >> >> if (!dev) > > Looks good to me, but Robin should also have a look. Yup, seems reasonable, thanks Tom! Reviewed-by: Robin Murphy