Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1828124pxb; Mon, 23 Aug 2021 05:47:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaFvGd6I1Zi9ctlWJ+myXJuIl1VIUlW8mteAM7jPI04xSyP83yDBJeIQj2Iqyww4uVctO6 X-Received: by 2002:a6b:7106:: with SMTP id q6mr26262098iog.174.1629722826316; Mon, 23 Aug 2021 05:47:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1629722826; cv=pass; d=google.com; s=arc-20160816; b=VQVt1e2naSO+VMTxHEGAsC6b3Tt5OgblEKlh871z/0ThRe1i0y91k9oeXZSwQhqal7 40NcIp5b6RBY8bImtKwREIUPwXT0WAhXa7460M6MgZJ8Yulx3XkN/BXfjpjF7xE3/BHL 9CBL0vF7paEO26CrWaBB9aPC1kh9qGYiGq9tSqIz0BdB1+xE2Lgnu99P57Dl2pDVqefw i4IbX2sD4coc24UYTHVX8mkB7on6Lxyq+ajUPPsBYvccT32QC6C9ctOcVc0+mXqyVJHS Y5fH9llK5I/tDabNVFyzVQJJMF8TioBQdIlSHX5z4bJLSAMXqD7Me/v9K/YPrvJyPbZt 4hMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BVwzn8Qcpc0vuGrgA1qW/gP3vhZqdejICKXVwPf2N5I=; b=OmnwEMzqi0oVjBKKA75zagbp/yrt2273IDqZDeq2mgSEwab2Hzp9xyfrHBNktjLsLS EQnPRuxntkBMRciO9WPhpCYbfmuBJCJB/at6zVYTkZM2xSlKvkDqr1oLCwdlZtdlvJ45 u4mpG0GgUeF/OwjqNhzV2R/JkUylkCQJeiPIMhxgHBZLNTx7wL+0w3BS6l6+BfPfY6A7 97Q6wckPD9YCzuuaQgQ9FMz85iT4Cjg8yjI5mL27ZRgp87Ael71ssj9CyHFlF6T36csA iH96VaUYqMsndI+AWJ/T7REaLfZXn/jIiT6pIjyTL83MjrVkOColUgGsoWY0g0Dx9xrq Lu+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=LMyoJscT; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y12si14963214jai.84.2021.08.23.05.46.53; Mon, 23 Aug 2021 05:47:06 -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=@Nvidia.com header.s=selector2 header.b=LMyoJscT; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236574AbhHWMq3 (ORCPT + 99 others); Mon, 23 Aug 2021 08:46:29 -0400 Received: from mail-dm6nam12on2063.outbound.protection.outlook.com ([40.107.243.63]:39265 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235954AbhHWMq3 (ORCPT ); Mon, 23 Aug 2021 08:46:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PyK1KsLM6qzF2ITk6gI9sSwzogfLwXDHi66GVxnuU9udMMTuPQX8VrLX6YrqCQAPbZhKCJtgV3mHRYgLp18MxBlxd1CIKN09qvPccxvna+DRfK5Aiyx4va4SCZj8GXlHyw/+iO2a2YyXVQTQNagn6kQaMpOEv11EBN+CTutmJ0fx+k3tQTnsCzFDieG47vhE6GlftBjSfdy8M4D2RXm+WWJBB0Rx38zki1HCgKNxQBKJenpzYSsA7JTEGUon6PcrT9wGEzpXiVFqpnlEVBhGPsxrnu/ftvQe9FXDMJQpfDj+BH8azo4rVKkvSyNn4n9dUGyfXekxuCTQnEL8Ph+4KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BVwzn8Qcpc0vuGrgA1qW/gP3vhZqdejICKXVwPf2N5I=; b=BVyp3J84NEKs3Qk3LZJUS8sIIzHsFpPU+BqBd3s77dePR4UeKD0r1F8Vg7VApKOvuFCGC4lebh3a1ULgOTKy7OQamC5C/6h4KaePilhMXWPegje+kNP7WWumunegxZi5My14vH0QF1wPc2em9QFM26q0//ZNybLi2sUKZtQuGJ7iRU0PkFcovG0uMfh7wy3ZfLPT6XyDMgx0tcm1XkfFW3SkGFYuisQezzgYmVTp0SStZlroyb94pKd97TBsB5ltF9Roak608/pDueMHSvTlBsFYppaQBktSol5j/K1t3kAH9lexGOTZWr1s+g67oLrwWTDmGJz3kSlN4RC0ElABLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BVwzn8Qcpc0vuGrgA1qW/gP3vhZqdejICKXVwPf2N5I=; b=LMyoJscTZmyIOruvdUC1g3TbYDKpvNVbNSMXf4mWuMI9TFCdFLPRkfR9Vdf17vZwjlMFMRMSmChkMFAqWQkxSnXoz/yij7+vylL9GM0Nr7UnDFZvbqJ1o/uPSP5E503VGrTCCUjmHjIGq5DyFXgU6dcOxPos2VWCqhU0MVMo6rlZ+iRDslh+tww0a/E1dsjrCe34Xe0D77boSfgvfqvsdlO7RWyROu4s+8021eB0PAJ/x37Ehd3FBw+av0o09G9kLIwXY5F2wNkmTqrPAzPCIC1lzgG8K8gUUGSvCF0jwa6JNVi9mJzeZmjzDlz8sz+7fx3BLNQqsDk5dLX+QvcEVg== Authentication-Results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5112.namprd12.prod.outlook.com (2603:10b6:208:316::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Mon, 23 Aug 2021 12:45:43 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::1de1:52a9:cf66:f336]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::1de1:52a9:cf66:f336%8]) with mapi id 15.20.4436.024; Mon, 23 Aug 2021 12:45:43 +0000 Date: Mon, 23 Aug 2021 09:45:41 -0300 From: Jason Gunthorpe To: Maor Gottlieb Cc: Leon Romanovsky , Doug Ledford , Christoph Hellwig , Ariel Elior , Daniel Vetter , David Airlie , Dennis Dalessandro , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michal Kalderon , Mike Marciniszyn , Mustafa Ismail , Rodrigo Vivi , Roland Scheidegger , Shiraz Saleem , Thomas Zimmermann , VMware Graphics , Weihang Li , Wenpeng Liang , Yishai Hadas , Zack Rusin , Zhu Yanjun Subject: Re: [PATCH rdma-next v3 2/3] lib/scatterlist: Fix wrong update of orig_nents Message-ID: <20210823124541.GM1721383@nvidia.com> References: <460ae18dd1bbd6c1175e75f5d4e51ddb449acf8d.1627551226.git.leonro@nvidia.com> <20210820155425.GA530861@nvidia.com> <85542c97-c7e0-3db3-baa8-2413c00f75a4@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <85542c97-c7e0-3db3-baa8-2413c00f75a4@nvidia.com> X-ClientProxiedBy: BL0PR1501CA0025.namprd15.prod.outlook.com (2603:10b6:207:17::38) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.162.113.129) by BL0PR1501CA0025.namprd15.prod.outlook.com (2603:10b6:207:17::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Mon, 23 Aug 2021 12:45:42 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mI9Kf-003Fxc-TX; Mon, 23 Aug 2021 09:45:41 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5b510070-c456-418c-316e-08d96633eb78 X-MS-TrafficTypeDiagnostic: BL1PR12MB5112: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +kWCAL4uJpS/mx/glilhlYookhPPGda3/rlIWHPiMVnLEoKDvqGsIzBY5OWa2hT1top5A3DGeFhPsyoQgYZLrkKTZ68BX2J8Hd9UaeVtLXnGTKHeEZoN34q85ghNsIRw+idggXvO50UTlfYb3gP4LRY05JHz9LFMfVxVzs9Z7w0Medoo/cuR8QoPej8PZjoZ0F50lkBKmTW5iEZGmPZQXM7SDpkE4+Nt1X8CGDaGrjtGA1v1Q51gM01SCAY7fbVMKPe18xl0KlJKPCTOdFCWInYSfhGtL6DzalwHL1xt2eVjVsy0x16RGTR9/VGuRB15Kw7PNi50Y7M98UEnoRTsFTMLb/BHwI3fyNPoK8H56xQtALg5XdH7ZBNOHJwhDZDKthhYGEkvA9yB51XGmKCSkU26aZgYdMZ+cA+K87OTRvEb8OZAlG2zz5h5fsSwTOI8N58NdvBXVHVJ7Arm6pPKyvlgrJsNMtEZLBLXVO4fj/DJz6qhY0NcxaABlRfH7tYX7Rxgnfk+x0nLP//XAlfyNfqSb+UkvB+l2fhYc9VsBxhL30reFVF8jEN9Rnb/4TA33KyO35YCmB7ObwvW0N1nxZVNftRXlXV5A4nrWhC/CDOW94vpmXInv2YzqAwWucWlu/uCWNrDfjsTzDO+9WK3dQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5506.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(38100700002)(508600001)(36756003)(316002)(66476007)(9746002)(426003)(9786002)(26005)(8676002)(8936002)(53546011)(33656002)(2616005)(86362001)(1076003)(6862004)(6636002)(186003)(5660300002)(66946007)(54906003)(7416002)(2906002)(4326008)(66556008)(37006003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?t4mQSwyUKDc7j9WVHekJxghYyR44ujhEHjgh8o1jpyVz2m7xX6Ua3Qi3G8bA?= =?us-ascii?Q?pPHQFM35woVUFaCV6kVZjz08JOrrXhsck5bTEmTYs41rW/QD7RCBieLY535k?= =?us-ascii?Q?6dIapmrNCQ55Dr6eCNp/v6CAqHtF+eOvJl4qt8ZRtwWpr+bNBDoV/Kgc5vtj?= =?us-ascii?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rPyufaonwga9?= =?us-ascii?Q?rg1ruMAZpOYQF4ysTFkvN5cP7kL+bL9nibSArfkj/3FAZK9Mjq3xg23VnLgE?= =?us-ascii?Q?nvTPT9Ye1xP/PcuPv8zuOh0dk5IEgFwfM7jCJkYa98vf3TINK9Akjp1xp6F5?= =?us-ascii?Q?ouWJOFG6NlPFfyJmgJX/KPFsGwncYKUZoZQ9y4Jd/D4D8cj5S5+C1P7wgAza?= =?us-ascii?Q?BCKqFXuD0sPuNuyg59icS2E1YY9g+yhUdKuZlxFJro7QGKmIpx5Q+tVWu0XB?= =?us-ascii?Q?/UiePkibXSVjryH4JQzZ5GzH?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b510070-c456-418c-316e-08d96633eb78 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2021 12:45:43.1893 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NQ3rA7XOZwwcI8NrLIYc5aIuHdCKGJb9WB+Hh6eG1B/aeet1MCBN5lZ59zzFcDyg X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5112 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 23, 2021 at 02:09:37PM +0300, Maor Gottlieb wrote: > > On 8/20/2021 6:54 PM, Jason Gunthorpe wrote: > > On Thu, Jul 29, 2021 at 12:39:12PM +0300, Leon Romanovsky wrote: > > > > > +/** > > > + * __sg_free_table - Free a previously mapped sg table > > > + * @table: The sg table header to use > > > + * @max_ents: The maximum number of entries per single scatterlist > > > + * @total_ents: The total number of entries in the table > > > + * @nents_first_chunk: Number of entries int the (preallocated) first > > > + * scatterlist chunk, 0 means no such preallocated > > > + * first chunk > > > + * @free_fn: Free function > > > + * > > > + * Description: > > > + * Free an sg table previously allocated and setup with > > > + * __sg_alloc_table(). The @max_ents value must be identical to > > > + * that previously used with __sg_alloc_table(). > > > + * > > > + **/ > > > +void __sg_free_table(struct sg_table *table, unsigned int max_ents, > > > + unsigned int nents_first_chunk, sg_free_fn *free_fn) > > > +{ > > > + sg_free_table_entries(table, max_ents, nents_first_chunk, free_fn, > > > + table->orig_nents); > > > +} > > > EXPORT_SYMBOL(__sg_free_table); > > This is getting a bit indirect, there is only one caller of > > __sg_free_table() in sg_pool.c, so may as well just export > > sg_free_table_entries have have it use that directly. > > So I can just extend __sg_free_table to get number of entries. What do you > think? Isn't the point here that different paths to __sg_free_table require different entries? What do you mean? Jason