Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1729375imu; Thu, 24 Jan 2019 00:30:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN6agoBqbpkjbSP8LD66d1F78RTo6WFqnmRxRAU/kR+7gidrG9XVNQSgaNiCvzJ2xbueDJZx X-Received: by 2002:a17:902:9b87:: with SMTP id y7mr5711713plp.336.1548318619368; Thu, 24 Jan 2019 00:30:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548318619; cv=none; d=google.com; s=arc-20160816; b=wrAgpoNoT3UIk9gdn7ffTBlivFuKCRaGsc+5sOf354Pssrkjxs8uMz6CgrhIzOoNQU rTPMGXmSc/LESMEfrnFMcBW9HJx+2c+P7vsBPo3UzRESHbWp0eII0tIa/VegkBFrdFoj oeRmkhUn4YwR6VtkIXYHS9rRJsADXljdJXxuwYh8uDHTf2cKRbBeTklf8OX7S3zi75UA ulldYKnmjC+OUSHKyO9f94irho/Vg6Zg16ps6h91rA6jLyzlzHfOFJypJ3Ankba63JU2 AdCwPLx8Rk4JtkGJZm3jwm4wWk6/sjiadTHc4g0XLo1DXc0InxVC1Vwels34SwORkeK4 ya8g== 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=oreHzO8o//yGkcx6+KEfnqZ6F4LyHFQuBHfBjON9UGY=; b=hYPeI1s3Z5eyein86LDVZzhXgC02DfYduUysrkl/5xBM6oPWmaiUPzgxW1VfzZjO88 lSRPWC43c8d6jDO8SGzX+/2VmgXNMH8wanrjKrplEW8D7p/Dr2J6KyrYZxOIBY7unqlZ 8d7w6XSex9LIbj/bf/0Ajfm+9p3BfiV/Unwg+y9lstil+UZ7HZpSQk8O6K+GF+u1CmWb ntJxMlMF1AgjRv7cpg7PdkE0ITUfvlSeZlhrL+Uyrn0TnUl8LZBA3lThDSJQwU5bdM/T f0B3iVQZmsRlTGF+uLEAQ3waJrtNt96f+AKmK9yYVFD96oUBpM8iz+CPpDXRNZXO5aVt 7V3A== 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 a2si20082353pgv.33.2019.01.24.00.30.04; Thu, 24 Jan 2019 00:30:19 -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 S1727128AbfAXI30 (ORCPT + 99 others); Thu, 24 Jan 2019 03:29:26 -0500 Received: from 8bytes.org ([81.169.241.247]:59454 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbfAXI3Z (ORCPT ); Thu, 24 Jan 2019 03:29:25 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id E945A3C8; Thu, 24 Jan 2019 09:29:23 +0100 (CET) Date: Thu, 24 Jan 2019 09:29:23 +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: <20190124082923.GI32526@8bytes.org> References: <20190123163049.24863-1-joro@8bytes.org> <20190123163049.24863-3-joro@8bytes.org> <20190123212755.GA9032@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190123212755.GA9032@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 Wed, Jan 23, 2019 at 10:27:55PM +0100, Christoph Hellwig wrote: > On Wed, Jan 23, 2019 at 05:30:46PM +0100, Joerg Roedel wrote: > > +bool is_swiotlb_active(void) > > +{ > > + return !no_iotlb_memory; > > +} > > 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. Regards, Joerg