Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp734095pxa; Thu, 27 Aug 2020 14:26:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYsxwZeeP/GT6MXNr3EXbggEwolQDb0MwDT7o2q3oDZ+AXzbIIqwXI/3Nud8N7yruWpQ2a X-Received: by 2002:aa7:da9a:: with SMTP id q26mr22316134eds.163.1598563567414; Thu, 27 Aug 2020 14:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598563567; cv=none; d=google.com; s=arc-20160816; b=Mh0ffRfOLzvV2Qgnoc1Q7Y3BsrB9K40whH/YL7x6fOmPKUGU0GbHUSdW92HNPzJAfD Y/EXyPfdEYtQykqX34vVBFBV+z/bGgYkLxOnqxNvtUAYJbsOBs3yiNryrqpffSR9RyNI 3YBYFBEux+vRMpAC2TGXHtg6p/7IPMeeQGpwYecdWqdNMjT+ZjKvEqxHy//4crlMgW7R ST0bVbdBzPHgou7SAv6EDq6LXtGEpAxYaWHpEtXT62/eNgQSq246Lud5oTzubmj85S8b 9EZ2uDDSQqzwPX3YzcP7+2o1ZUHCMc6MX5cb13if6zy9kKysnZoiUWtIFo+f/dupSRAq /9cw== 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 :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=MVC75WhA7d+0oDQazfX2DGa6cSUtXkIL8si5LFw8QKo=; b=HSI+WYCsXsGiBkn6Vdj253SeawLP85iCbVOQctlkDQ5tTFB68ElAdnDChk9gwSqxrl 9K9+5pnAoYjNtB4nlGa7TkXG14+Kkve7qTblrbV2En+5tDxuM2ONPKkZAESKRvyOE7pq GmKHEujIjdOVY2ctp7Wsfi0Eb/dPxeTsZR51HCWD3C8lKDGCSpR4ettLnpnfsoE3fW4i fAXD7VJt8D0+9DfVRZRhIudBrwQaC+lbQWHBmujqe7coYOS9m4qH7vDD4s/lfgQ9EcXu kziWySDlQ/ddmJw9/J18C9HuDg09i1iGSXMNRvKrgU9oWZjyvbXHGsdxu6cuQ+7pR+f7 O+8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nE4no8bO; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a19si2187538edn.223.2020.08.27.14.25.43; Thu, 27 Aug 2020 14:26:07 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nE4no8bO; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726236AbgH0VYJ (ORCPT + 99 others); Thu, 27 Aug 2020 17:24:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbgH0VYI (ORCPT ); Thu, 27 Aug 2020 17:24:08 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB50C061264 for ; Thu, 27 Aug 2020 14:24:08 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id z2so1804318qtv.12 for ; Thu, 27 Aug 2020 14:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :organization:user-agent:mime-version:content-transfer-encoding; bh=MVC75WhA7d+0oDQazfX2DGa6cSUtXkIL8si5LFw8QKo=; b=nE4no8bOYuNaI5l9TjJ+/StsPJHYNmB5V/L+olDFa1PVPA7CS6C3e0hRxqk8ekmyf2 wM+xTgli8KOZ7u4BtEI/0+bMj2IEG6DOUpfI9ixOqMmH2Z7j3d8M8zSBU/6brb6Yc9ck DeVirLgs0ikpFF+uYb326kItTsvAUTWiHOjNKXB9y+vwfo+ik4N16fAQ74H4RfcT5DJ4 ry45RgjADUO7zljmmW743bRbLkCjlE8nZBpDYkzEGXrHJy6bTrCwaGCrfKTCJPoENv8t rvzm8S2d+o5mIyNPpHScJAS9ASCyi+voRmangDBQgBMftLlNoNeZOpAgNMP56BcEAoni c6Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:organization:user-agent:mime-version :content-transfer-encoding; bh=MVC75WhA7d+0oDQazfX2DGa6cSUtXkIL8si5LFw8QKo=; b=eTqAiiZSqQ6ohRkESKHN/fTnWsY/+QGmrJW+ddzqJRa7QDOxdWXoMGb3qdxz0et8oC cBry8I6q1ErmP4vVeYR3bT9s7IvIAw3ItwPFn+xN6v9NiatjKN1jmLqJQ3KSFLSUIa+5 240Pvd1Pg0xqRmm6J6hlRWJfbL5uofEBd9SgOICWS7473xOF0TWucEFquINWoPv7M89S oAtPkrN2hwgQaN+ggcarXg5F/Zl16GYE7K/tV612R43WnkyceHQy+O1R0Bvzz8Nox1U0 qtCL/2776GaAYuZaYjWDJmC/TNYAb1t8LlsgPlz1yA5ibML/q+XYRy1zk/AMAkscPvMj uLyg== X-Gm-Message-State: AOAM532Tq2X2iRGBv58BR/WxE7n43/B99AD/lXALStKbgSWiVXT8MP9k nU0uzqy2lL2DjOT6oG3iTXM= X-Received: by 2002:ac8:66d3:: with SMTP id m19mr21062282qtp.276.1598563447427; Thu, 27 Aug 2020 14:24:07 -0700 (PDT) Received: from LeoBras ([2804:14d:8084:8e41:9b0d:571e:a65:b5d8]) by smtp.gmail.com with ESMTPSA id u41sm3022336qth.42.2020.08.27.14.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 14:24:06 -0700 (PDT) Message-ID: Subject: Re: [PATCH v1 05/10] powerpc/pseries/iommu: Add iommu_pseries_alloc_table() helper From: Leonardo Bras To: Alexey Kardashevskiy , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Christophe Leroy , Joel Stanley , Thiago Jung Bauermann , Ram Pai , Brian King , Murilo Fossa Vicentini , David Dai Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Date: Thu, 27 Aug 2020 18:23:59 -0300 In-Reply-To: References: <20200817234033.442511-1-leobras.c@gmail.com> <20200817234033.442511-6-leobras.c@gmail.com> Organization: IBM Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-08-24 at 10:38 +1000, Alexey Kardashevskiy wrote: > > On 18/08/2020 09:40, Leonardo Bras wrote: > > Creates a helper to allow allocating a new iommu_table without the need > > to reallocate the iommu_group. > > > > This will be helpful for replacing the iommu_table for the new DMA window, > > after we remove the old one with iommu_tce_table_put(). > > > > Signed-off-by: Leonardo Bras > > --- > > arch/powerpc/platforms/pseries/iommu.c | 25 ++++++++++++++----------- > > 1 file changed, 14 insertions(+), 11 deletions(-) > > > > diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c > > index 8fe23b7dff3a..39617ce0ec83 100644 > > --- a/arch/powerpc/platforms/pseries/iommu.c > > +++ b/arch/powerpc/platforms/pseries/iommu.c > > @@ -53,28 +53,31 @@ enum { > > DDW_EXT_QUERY_OUT_SIZE = 2 > > }; > > > > -static struct iommu_table_group *iommu_pseries_alloc_group(int node) > > +static struct iommu_table *iommu_pseries_alloc_table(int node) > > { > > - struct iommu_table_group *table_group; > > struct iommu_table *tbl; > > > > - table_group = kzalloc_node(sizeof(struct iommu_table_group), GFP_KERNEL, > > - node); > > - if (!table_group) > > - return NULL; > > - > > tbl = kzalloc_node(sizeof(struct iommu_table), GFP_KERNEL, node); > > if (!tbl) > > - goto free_group; > > + return NULL; > > > > INIT_LIST_HEAD_RCU(&tbl->it_group_list); > > kref_init(&tbl->it_kref); > > + return tbl; > > +} > > > > - table_group->tables[0] = tbl; > > +static struct iommu_table_group *iommu_pseries_alloc_group(int node) > > +{ > > + struct iommu_table_group *table_group; > > + > > + table_group = kzalloc_node(sizeof(*table_group), GFP_KERNEL, node); > > I'd prefer you did not make unrelated changes (sizeof(struct > iommu_table_group) -> sizeof(*table_group)) so the diff stays shorter > and easier to follow. You changed sizeof(struct iommu_table_group) but > not sizeof(struct iommu_table) and this confused me enough to spend more > time than this straight forward change deserves. Sorry, I will keep this in mind for future patches. Thank you for the tip! > > Not important in this case though so > > Reviewed-by: Alexey Kardashevskiy Thank you!