Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2084644imu; Thu, 24 Jan 2019 07:01:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN7052yFNZWhbrcZs0UMNUMpWCENu5BL2RfJarFLRCj4r2OkOAMgjUK7d4gyphoRzSf1KAYj X-Received: by 2002:a17:902:aa8c:: with SMTP id d12mr6987735plr.25.1548342084656; Thu, 24 Jan 2019 07:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548342084; cv=none; d=google.com; s=arc-20160816; b=jn88YzmlGFjIq13UG+J3U30Hyu+PoEiaj1I5uQ97RWHIg4a9cb+E+uu9SCF9ivcITb PM0Yc2zkXqq40R2uvQBlciByXFLzfCQZNy3EOOyczeQsEW8XFkgNrvYtnUx4B5ooqcPE X7X6GzmmjA1pesh/yeBdeNnYAsR9PMhkAEGTcvmIEclFTIK3nCTXa7hP7M2MO66zoTOp /VJeQG99oOh4MMFEfZnYVfRP661vM/G4kGz7Web/FAMfOTAsCm3lHeWgO/SlYPuvJSDn faisT3C+cAZ4mGlIyeXRp2Z4Np8KXiJbkP+63/qVco6MZqGVaYnqYet5d4WRUcB/j3ob SinQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6gtL1TOK4oDSWTCL/K+f7+eEek+g80ZEG/wQfP1OD6I=; b=oBpZddZqQoQHd1n7v5rY8jmXV6p2HFGzkfCQJNfebdcZNE+Xw6jN24foLWSDqIkOVr TJZ77txT9BjuvsuVRp84arnhqXSTXFgXFaNwHucl/4GzIhYc2H6kET7ZoyvtKXkoe6Vj es+WNh8NbdQMqrIGKwSFm86UPobVCje3WLELMQ/4533cSc57rc0pIdp0DPoa2kYjCrG0 lY/XvCb+4A7+Hnn4t1HrlrTJWXWoFiEh5c8VmyssQzrqexzDk52JYd1qB1EneNJJJ3tS mriU6kMomh2BzRUSSnqOCgxTfhnsG7daIE+garFpK014MW8c6kxWUub7hlzS0gLQUudc pLMw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si23238635pge.124.2019.01.24.07.01.05; Thu, 24 Jan 2019 07:01:24 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728485AbfAXPAC (ORCPT + 99 others); Thu, 24 Jan 2019 10:00:02 -0500 Received: from 8bytes.org ([81.169.241.247]:59616 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728203AbfAXPAC (ORCPT ); Thu, 24 Jan 2019 10:00:02 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 1A641269; Thu, 24 Jan 2019 16:00:00 +0100 (CET) Date: Thu, 24 Jan 2019 16:00:00 +0100 From: Joerg Roedel To: Christoph Hellwig Cc: "Michael S . Tsirkin" , Jason Wang , Konrad Rzeszutek Wilk , Jens Axboe , virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, jfehlig@suse.com, jon.grimm@amd.com, brijesh.singh@amd.com, jroedel@suse.de Subject: Re: [PATCH 2/5] swiotlb: Add is_swiotlb_active() function Message-ID: <20190124150000.GN32526@8bytes.org> References: <20190123163049.24863-1-joro@8bytes.org> <20190123163049.24863-3-joro@8bytes.org> <20190123212755.GA9032@lst.de> <20190124082923.GI32526@8bytes.org> <20190124084107.GA19441@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190124084107.GA19441@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 24, 2019 at 09:41:07AM +0100, Christoph Hellwig wrote: > On Thu, Jan 24, 2019 at 09:29:23AM +0100, Joerg Roedel wrote: > > > As I've just introduced and fixed a bug in this area in the current > > > cycle - I don't think no_iotlb_memory is what your want (and maybe > > > not useful at all): if the arch valls swiotlb_exit after previously > > > initializing a buffer it won't be set. You probably want to check > > > for non-zero io_tlb_start and/or io_tlb_end. > > > > Okay, but that requires that I also set io_tlb_start and friends back to > > zero in the failure path of swiotlb_init(). Otherwise it could be left > > non-zero in case swiotlb_init_with_tbl() returns an error. > > Indeed, and we'll need to do that anyway as otherwise the dma mapping > path might cause problems similar to the one when swiotlb_exit is > called that I fixed. Turns out the the error path in swiotlb_init() is redundant because it will never be executed. If the function returns it will always return 0 because in case of failure it will just panic (through memblock_alloc). I'll clean that up in a separate patch-set. There are more users of that function and all of them panic when the function fails. Joerg