Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp774794lqt; Thu, 6 Jun 2024 19:45:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1JVqVht6AqhcXv+G9dnUZCizGIcTRss7SWp4MvvFVmCkr52o76TWl7yFlAjUeku8TNwjzCXkLr+i1XxV7f0mxncl8kUVxm3crJQDqmg== X-Google-Smtp-Source: AGHT+IG7W8nwySpQoQyzHoIIB/EqkmE+Ngh9I1IkW8QujR3qKpiOYEObZU3Rvy5ZspoWB80awx9/ X-Received: by 2002:a17:907:603:b0:a69:edd:332c with SMTP id a640c23a62f3a-a6cdaa10bf6mr86493766b.47.1717728339371; Thu, 06 Jun 2024 19:45:39 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c80596465si133683566b.21.2024.06.06.19.45.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 19:45:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=SYu4T3Yl; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-205258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205258-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E237D1F23C7E for ; Fri, 7 Jun 2024 02:45:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FD4317BA0; Fri, 7 Jun 2024 02:45:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=microsoft.com header.i=@microsoft.com header.b="SYu4T3Yl" Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazon11020002.outbound.protection.outlook.com [52.101.193.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3C48DDD9; Fri, 7 Jun 2024 02:45:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.193.2 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717728327; cv=fail; b=rlIhRjaPQag+WcNLUkGLkE9YN9rJs2MZsC7C2S+tzZYj8LSUtwyFqfbuqgNheO+dlZq/CYxC+pVg/5p1LsI4kqLyJih5cUuqmpPi8nXYJjsOmiHwNlTmLll3bo1m4slbewErMU4IdlrBYM4LJHL/VohhKzBaPfgpLCHvqoK2zDg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717728327; c=relaxed/simple; bh=3ji9RkEY5ev1vB2a3Z3XOiGFccjBh9KjDBV07l9iyC8=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=aAJg4H0WAnev2EcG4XsT25sK7ZdTErJrpo4tCXW9Tg9SA1ZaAoRMJfzJRqpJXcVmGDpkrdhvlMTH/qqx05sGcTdHQ0AIMlWaAEpFfQ6cjNjsBh8tK1HhWpZuFZCmxAYLaHkv0WS//W5ajtP33tMTL0x8e/JqFxeux7vlRVBLm10= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com; spf=pass smtp.mailfrom=microsoft.com; dkim=pass (1024-bit key) header.d=microsoft.com header.i=@microsoft.com header.b=SYu4T3Yl; arc=fail smtp.client-ip=52.101.193.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microsoft.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L5o1MXr9/OEShvg31BzXEcFecmXDNWJlCaJZh7wfyiQqUEcdX50uoNKlBiLU8ipfLii50agOvoFhQSR8xD9P6avhptPgnrhUcl+Aw3xvsHAz9psvfvkTR8psYB7/kHdebGbN0nHSy9CQkwj+tKOvoGFu+XZmUnulDTgLPV5dUTUWfVXsgfGDlnstRE5e/lmWRF0zps5OwDAUV0xFcwz7FKv/H4HvM4hVZgQNTW/2drtsmkt3m1Ftp45H74U87x8oVRvOhO2nzd3vAjs1wFHY+W6veji5anUrUv19PO094cY6X/jVdxywkh/VPahed7xUHEsWgUhIrTEGneDyM9ZPgQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cb8V+x6RWGhNugxzYz12yJj1wMoLmsVHQIoqXa/QM60=; b=mVTrJGQKdbDkjz6zn/V8sylZI/jXLARO9iFoyokIjvujH9LGwiFtAt3ZK+UIESygQAjFl1MmNvOWnqoizj4xJE2X3DJMgRmAo+Z/aP3VSid3+ek8VhbGLmFtWU3uz0vecEne1D24o3vQZkQcSa+DLkerNbmHLPQgacV13q2jB/Y9Zv89SamFRhZee4jihapNUUbaAl4ALSzRrM783uFIkip3r1GKc3xs7zgUK8vLKRak5GLPLXKlIb4vcSbzw5sDBcUgELzDtDbUjfIu2hVg1+NrUauV7BeyArqaVr/BNFd5pHHObzJhqtlFSYSGIdZpICyY4c05CPb4htpbx0hmEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cb8V+x6RWGhNugxzYz12yJj1wMoLmsVHQIoqXa/QM60=; b=SYu4T3YlNCTZVYaV0JpqL++igEgGu5cCJ2SqbsNzgSqyjTxlndQKamAffQalEoeWI2uq5ROQRQxDgknNYFDFJawLL/wUknph4TJKKtaGJ25aHk8P0Mi4qyEpDpKA3QIg+TH42fyvucQqKzOutkBKvewOJMwWpH3jL57qd5UwEMc= Received: from PH7PR21MB3071.namprd21.prod.outlook.com (2603:10b6:510:1d0::12) by MN2PR21MB1520.namprd21.prod.outlook.com (2603:10b6:208:209::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.7; Fri, 7 Jun 2024 02:45:21 +0000 Received: from PH7PR21MB3071.namprd21.prod.outlook.com ([fe80::204c:c88b:65d2:7d3a]) by PH7PR21MB3071.namprd21.prod.outlook.com ([fe80::204c:c88b:65d2:7d3a%3]) with mapi id 15.20.7677.001; Fri, 7 Jun 2024 02:45:19 +0000 From: Long Li To: Konstantin Taranov , Konstantin Taranov , Wei Hu , "sharmaajay@microsoft.com" , "jgg@ziepe.ca" , "leon@kernel.org" CC: "linux-rdma@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH rdma-next 1/1] RDMA/mana_ib: process QP error events Thread-Topic: [PATCH rdma-next 1/1] RDMA/mana_ib: process QP error events Thread-Index: AQHatnNn3cy/Ic0fek2xJdoL70MjcrG5wS7ggACu0oCAASrhEA== Date: Fri, 7 Jun 2024 02:45:19 +0000 Message-ID: References: <1717500963-1108-1-git-send-email-kotaranov@linux.microsoft.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=7b9f9122-27a4-4ad5-b04b-3479404d893d;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2024-06-05T22:23:51Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR21MB3071:EE_|MN2PR21MB1520:EE_ x-ms-office365-filtering-correlation-id: 825a2630-76c8-4fdd-5b60-08dc869bdedf x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?OcWQ8hLriAi38EO70blTcGalF1jUM5WHJzAl92/IG/y0cCCLpldgLIGn5Os4?= =?us-ascii?Q?PkowyqGVIzX5dWNi/RRKWfP1HNSWVaXoom4wAom42QtPEtxX7yPIkYt4Yfbe?= =?us-ascii?Q?4tEOuYyP51SvjIAMwk1xSfJ62EMrPZjUOy9KX5PuSik52+10Hqv4HFc/46as?= =?us-ascii?Q?W1mgYEW4cjhl3AVv3s2qxFREe4Hjp9fm/B31CnzGm9WPuCrZBe6tyxwhkZSK?= =?us-ascii?Q?xUay/dWq6334nJiGh79dJVDdzZbSmOwHvh5c9TBZzhWUJDvLwvfHUc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SewNP+r7hNL4Ls7fuzMx2EOxQno9j56DNxAqu?= =?us-ascii?Q?lZGYOibWje81SPUGXWjHYc736OMI1cxBD8M1fekF4dqEJOoQPIfo1/zkMHWh?= =?us-ascii?Q?EtMpxL1Q20wGNwJA9IhJI4PZ2eyVg5HI800QcsbUGb6G/jYKzYitrosaBFXh?= =?us-ascii?Q?eUTdDrFDu8uO/lPcDkgOGsoiepBZ341gSbF6Wm3/hRZL5AY1ImuMR1DT2Te0?= =?us-ascii?Q?1WeQrbI=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR21MB3071.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(366007)(1800799015)(38070700009);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?s0xJlwvmK1xmvqW78Mq0QbP8LRIKn798kd5pEzS1eDs7yjZoOSZqWoxlMb7B?= =?us-ascii?Q?lrYa0KVeVg3+Rm/Dzba7iwJxZSGIOHt63LqQjkZ4TB5eiXv6G7XoFO7L9Z7q?= =?us-ascii?Q?MiRlSl0MgJxP3O+op3ADxLZ4f5uxKQJ7sOGsH2Hf8ycHV5XaZ9bylbbe27b5?= =?us-ascii?Q?HT7O6APIpRZeBsjQWT6SE+IFB6PzGWf8ZwdXvHWt1wUgO6UB5CjM3qVapCkX?= =?us-ascii?Q?GcvJfyzZ3uorDBHzC07MBB4BTvaqOEmauwEmyA7xfATpI0MrGOogE1CsIjBG?= =?us-ascii?Q?AtJopK0YYxxujnPa63G9+TFvBL7zOl9Wl9+yMfwrJ1QgFZS8PYJJxJQD2VrM?= =?us-ascii?Q?ac3TqTXWeuusQWusq66lcBryN/UEqqsSfWfGIb2vJSBC+iAoeSw7bfQ72fuU?= =?us-ascii?Q?u3UGEE525XNypaUc45usmaRTE4C7AxTTdlAAGf+upm0VwoA19/VFhV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8I481l9iphbBtUyAEGcB2TE3Zm3XM5tCHV?= =?us-ascii?Q?Fpc60+lnhHZWecU4miPRdC+9troD22/43l2K+f39z47Dy5oPCKKnpA3e6plU?= =?us-ascii?Q?oVbdp/nd8IE01K9L/JAvteTAI0wXnFQ9RO+vXIEXmiPwIJubT/C0w9ZCvza2?= =?us-ascii?Q?pDqnCcV546CvFoAjXkKwIU47q5nECq2S3EAqVRQIv/zvXM5JRGnbKDmpXZBg?= =?us-ascii?Q?W4B5IsLrqR6DpnWoMrf/PiNLQF/5Tf6bT/xJgUUk?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR21MB3071.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 825a2630-76c8-4fdd-5b60-08dc869bdedf X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2024 02:45:19.6592 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: juNtBGZ2WB6aJv7jEcUg6ZBDrYevark3hQWYdmIOVjsopPB6G0g59qnnU2lIA20C/v84M+sHcMdn7Ws0gFp5PA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR21MB1520 > > Strange logic. Why not do: > > if (!refcount_dec_and_test(&qp->refcount)) > > wait_for_completion(&qp->free); > > >=20 > It might work, but the logic will be even stranger and it will prevent so= me > debugging. > With the proposed change, qp->free may not be completed even though the > counter is 0. Why this is a problem? mana_ib_destroy_rc_qp() is the only one waiting on i= t? > As a result, the change makes an incorrect state to be an expected state,= thereby > making bugs with that side effect undetectable. > E.g., we have a bug "use after free" and then we try to trace whether qp = was in > use. I don't get it. Can you explain why? > Plus, it is a good practice deinit everything that was inited. With the p= roposed > change it is violated. You shouldn't call wait_for_completion if it's not needed. This is not a "d= einit".