Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp702733ybb; Wed, 1 Apr 2020 08:07:58 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvjNit5HgC+MZTNjDgKjr/NiCmMgqSvn9B6Dxm3WjtAVwliEA1tVFTv4Ad8pySgDoy79cQ+ X-Received: by 2002:a4a:940e:: with SMTP id h14mr7162671ooi.26.1585753677994; Wed, 01 Apr 2020 08:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585753677; cv=none; d=google.com; s=arc-20160816; b=V14XeilPT552A2GzdriBg/unpkTRamlOfiZ/cfZALpha1OmRM62K9KhzdV+17ouV7/ FFpPcaUn52oy276XOSMINRoMqNjktVXCmUbf8G4Uv+IHGWABhpOAJ+OA+lon9mm19PaK ri7wAxMXxM/tBb8afOt508qWgMBBFs4+0z2tcPfjyI7mqzl1YudtF6UnhwLi+EydbIOk lSwZWO/1NXPmBK9urT0tgFsXxHnXwjnxMkUwIQC8Ag79Ce8kYtgf1C1DUV1vGG0eccdw 62kwtvAgl/xVVCzwuP3OouStzLH7+ZE1mJ3ckhWM7JoMaqD/B1Bh1jsGYsenuM/nHq6Q 72hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=BokcsbFHdrrz/l4PyjTUoW+8uB/MqRMjCTweSlnNCdg=; b=Gq7+RHocfzV+6pXQrqwf+mxJiwLhJIeSGulSXR38ifl0yFgk6dY/eAcP8todEuZQJA CrUrmOD/xFB9yR+0dYUYvnZjfHghtvM+7xvQfEDOC4P5GEW/q7vaOUxDRkZjimghIfmK 5RI35JwIyiaLZq2FIrJoGkYtXHFP4OeLnSrJAaE29QELjcgb1aXWOv1a6+03yh7vFSji 6m9Bx+Z4MBJsaTgF/uEBsFoSCklkcfbkmsXQwvRfWeEvpUCQBMY9rNxx090ST8/TH25L nOYktN0Qv22ytnZHX9PkzQNeJFnlHdaMq8/xlbshmLgxZA7zQtTZkyx2hpaK1wB8vDvo 5wkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hcyn6fKH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si970956otc.12.2020.04.01.08.07.32; Wed, 01 Apr 2020 08:07:57 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Hcyn6fKH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732812AbgDANzg (ORCPT + 99 others); Wed, 1 Apr 2020 09:55:36 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35959 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732774AbgDANzf (ORCPT ); Wed, 1 Apr 2020 09:55:35 -0400 Received: by mail-wr1-f68.google.com with SMTP id 31so160046wrs.3 for ; Wed, 01 Apr 2020 06:55:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BokcsbFHdrrz/l4PyjTUoW+8uB/MqRMjCTweSlnNCdg=; b=Hcyn6fKHUAWfyXHU0AQI42LD9l04dXQT2av71U4PkGbjP1d8X5ejQCIr6m6I8zply1 y8ng/jzsrvOEIlv8YqJZzMFhcwDwbkuyqlz2yvuRbQVyaqUGswaO9CNCy9IrzGWiN8hT cFE+955zBtH6yc/aEP2P52gHsEhgURQjFPIZpzhw3Hze/Fc5q/uyfnDn8FSctAt65FG9 9kM1BSabVwbx+rvRSKTrXaLxMRAyfQNDJ23fZKm86OfAiSB69A6ywoCoKMJHavK0GPO/ y6FOyxUw98OPpXYcbhlSDeKwSp23hkf8OsdgmqtEUQoqQguBvFBe70cMzXxajkFcMHGT w23g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BokcsbFHdrrz/l4PyjTUoW+8uB/MqRMjCTweSlnNCdg=; b=cyxkIVmAaep5EyXQuNGSFbjVZMRM+Zhe7jOZuuASwu2xsAxGL7diZTSAkp5AjUWZ3W djf45GAgNYMT/ynKAEYfQYXE9Fq87felyPUq5zpL4QhpxsgMjjoNggGMyNSk+NVHtsYG 6L/Xpy+lZjEDzBmJ9wOmQvA5KJy/l3KSZ3Um5SUvryUBPTpseIW3p5JDv4S5LcJ+e0pe fFd270HxBXuTikEIthYPWnQFoRKn9uUAyi+fC5VNzQekr/2ynqw5QfJiLxPIb84gyYmC oj9IpEDawjEV4yM0CH6tPIe/v48sf8AZAUaUA15eEmwysJ+dLbu7tVjxG9p6lm1FIu2s VDyA== X-Gm-Message-State: ANhLgQ19+rTrfHykspME2VtJOOVI4HecZUvL9ONDu4GKCayP1LiHmmW6 pbS5UjeVs2f8it9SVPribSsQXA== X-Received: by 2002:adf:bc4a:: with SMTP id a10mr25721435wrh.7.1585749333948; Wed, 01 Apr 2020 06:55:33 -0700 (PDT) Received: from myrica ([2001:171b:226b:54a0:6097:1406:6470:33b5]) by smtp.gmail.com with ESMTPSA id c189sm2853560wmd.12.2020.04.01.06.55.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 06:55:33 -0700 (PDT) Date: Wed, 1 Apr 2020 15:55:25 +0200 From: Jean-Philippe Brucker To: Jacob Pan Cc: Joerg Roedel , Alex Williamson , Lu Baolu , iommu@lists.linux-foundation.org, LKML , David Woodhouse , Jean-Philippe Brucker , Yi Liu , "Tian, Kevin" , Raj Ashok , Christoph Hellwig , Jonathan Cameron , Eric Auger Subject: Re: [PATCH 06/10] iommu/ioasid: Convert to set aware allocations Message-ID: <20200401135525.GG882512@myrica> References: <1585158931-1825-1-git-send-email-jacob.jun.pan@linux.intel.com> <1585158931-1825-7-git-send-email-jacob.jun.pan@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1585158931-1825-7-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 25, 2020 at 10:55:27AM -0700, Jacob Pan wrote: > The current ioasid_alloc function takes a token/ioasid_set then record it > on the IOASID being allocated. There is no alloc/free on the ioasid_set. > > With the IOASID set APIs, callers must allocate an ioasid_set before > allocate IOASIDs within the set. Quota and other ioasid_set level > activities can then be enforced. > > This patch converts existing API to the new ioasid_set model. > > Signed-off-by: Liu Yi L > Signed-off-by: Jacob Pan [...] > @@ -379,6 +391,9 @@ ioasid_t ioasid_alloc(struct ioasid_set *set, ioasid_t min, ioasid_t max, > } > data->id = id; > > + /* Store IOASID in the per set data */ > + xa_store(&sdata->xa, id, data, GFP_KERNEL); I couldn't figure out why you're maintaining an additional xarray for each set. We're already storing that data in active_allocator->xa, why the duplication? If it's for the gPASID -> hPASID translation mentioned by the cover letter, maybe you could add this xa when introducing that change? Thanks, Jean