Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp322311lqp; Tue, 11 Jun 2024 05:54:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU01qXII9E0UhzfLen1WQIunk4kZ9lq2Ngomw1tp3eWelzzIkl8JPrSYED1O+8eWH71W1YrKnlGlWGs0+6HAqo8SJLytfl0vIaAyGitqQ== X-Google-Smtp-Source: AGHT+IGEdzJMXi4UWP8kgDnqmEo9yinSzsHba09d4RhlAIuqDMgq0ZxsU3mulaAUQPAyKfK6Ou5C X-Received: by 2002:a05:620a:2441:b0:795:758d:fba4 with SMTP id af79cd13be357-795758dfef8mr743564085a.46.1718110475711; Tue, 11 Jun 2024 05:54:35 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-797e20b9f93si102557785a.514.2024.06.11.05.54.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 05:54:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=DDHWSBmd; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-209882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CB7AF1C230D3 for ; Tue, 11 Jun 2024 12:54:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BB6817C7AF; Tue, 11 Jun 2024 12:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="DDHWSBmd" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2061.outbound.protection.outlook.com [40.107.255.61]) (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 59DBA17C213; Tue, 11 Jun 2024 12:54:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.61 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718110460; cv=fail; b=M43708CkbxZB4gWCAz7YHWO5THPaI4reXNL7djdi7U6af0oUfTulFwXABAzghZ3fe6T2DJXRhy5tXBX7It3A22/l0YXF12RKA2lShGuutd+W5lKiLsXkg+9EB2lpuzo5TI4GgBW8IRmj66qC61TcZ/tM9v/v6HpedVWllmUlikk= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718110460; c=relaxed/simple; bh=MT0aLWZWZMK4Q3fTv2oJ3dE783tdPeLB0CZuCEScoss=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=hr2wYOLjBlqZd0JPeaOw+7g+3Exclwqnqm40wkfIZtgA5wUq+EOE7GArU5t4nm+mkNouBpLJ6eSqw6jqg6ax9UWna3jnKhtZsam3Iq5QLcp55bjUOUY7FDslBTt3sksMI50sSE8n8+MDNk843Msvafe5CzZzGQNkchLaFzGuMTs= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=DDHWSBmd; arc=fail smtp.client-ip=40.107.255.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L+d9B/CNZczRDnIKFQe1W4obPNMeoM2ZMzAlfpE+HOKXYoqAF/mr4gIHjXVBDqFlc9sJlNONdu7OrgL/h+e8wbBUwnAs9cSCYEqe/bkoFDnYZT4TV6+rgFuYvJ6lgkrFY4P0ZTrH3jrDby2Tp1bWbYcQktoFQpdaCPsDoM28FluyiTEMiZ/upMr7PCbGrIZ6ycPWA2FoYMThb8fA1PSrB4C277NRjlVHyMfOHIhvx1ZtEVLgWfQABBV3v/9Q+MbRXiZbj05qCPT4YYVLkdYx2NaVdriF2vPHp59bGcXtL6XwT2WBixteZ26xuolyvNPqYWHnjJKFiS1DXSw9gta0ng== 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=84UITnNBTwdQBkTBVMzIVDlbKmO3MeP48m1K8C/hLqw=; b=BnEA+dXUGDyCQcLKMX2t/XzrEM+2eNmDfHdiCEjm/D1gzhE3wPWv7pInbb0taF1w9VE+01pmJHGyASOIu1vD45V+SNTttEysKD+OD6CY+OUtic33kvto8ZQiaMjSi23p3jdnFnW/mWcaJiZEiVX422kNQBh/sccf7k3WygtyDWfAUdWrL9ab4PbzoI97UoQx45ql1df9J7FTT+XPHpj2YEHEX7dKej+/PfBpJSLXmGJ++t3eu6wsxtbt2y3JEMjFV1nBVjGnqzapIRf+YL7V+pcZiCHPmqX7T1EwV3vBVrjrN/f2Nn7Joo5TkPFbqo5G/b8c5RtgZ2H6Oq1Yx2xCFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=84UITnNBTwdQBkTBVMzIVDlbKmO3MeP48m1K8C/hLqw=; b=DDHWSBmdRRIi0UxoUNUTxswtdDKs54KeqGePcP4Q8Atp8CFcQ5/+jJxWmruvKeopfQWIc9KwYHNFALBFaw160C5nJCzv5nviW+rqjtEmxaW8bVgqXNN+rUW3VuqJ2/B/Ke6oiVblg15kurvrgvOM3to87w8XV2k/+G2bQeEUGY28h1aRLBcYOUyEHVxaIAnjAzjylzB5ldasFRI18F4UsA8OXhLNUde+tUIvopnAN/rCV8xxV9/3NAqJGV5EKPsZCPTvmjWGRLca/3Sr77docO8XBqQKMpIwuuxkp8OqS/LvtZ2Er+1menSwt3afu5gg/cbbiJSWl70jHiLvMlN8tg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from KL1PR06MB7401.apcprd06.prod.outlook.com (2603:1096:820:146::12) by SEZPR06MB6816.apcprd06.prod.outlook.com (2603:1096:101:191::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Tue, 11 Jun 2024 12:53:53 +0000 Received: from KL1PR06MB7401.apcprd06.prod.outlook.com ([fe80::f4f:43c4:25e5:394e]) by KL1PR06MB7401.apcprd06.prod.outlook.com ([fe80::f4f:43c4:25e5:394e%4]) with mapi id 15.20.7633.036; Tue, 11 Jun 2024 12:53:49 +0000 Message-ID: Date: Tue, 11 Jun 2024 20:53:50 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] sbitmap: fix io hung due to race on sbitmap_word::cleared Content-Language: en-US To: Pavel Begunkov Cc: Jens Axboe , Andrew Morton , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, "yukuai (C)" , Yu Kuai , Ming Lei References: <20240604031124.2261-1-yang.yang@vivo.com> From: YangYang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2P153CA0013.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::12) To KL1PR06MB7401.apcprd06.prod.outlook.com (2603:1096:820:146::12) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR06MB7401:EE_|SEZPR06MB6816:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ea955ab-6560-4f28-ed0f-08dc8a1589ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|1800799015|366007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?YzZuUFdDa201b3lSRm9OZnM3aXgzN3IvK1RjYUZPZ1JsS21TK2dOZzllenBW?= =?utf-8?B?K201MVVCSk9JcjF4ZkJuR2pWb2xWQTZ3b3lVM1Rub1ZkMU5QTmc2SGk5YlNk?= =?utf-8?B?bVU4c2dCVFlBMlYxL09hM3B3TnhmNnJWdXBFaVpIbHlvSnRmaFQwQ01VeDJa?= =?utf-8?B?ajhrQW45NThwejgrT3lvOHB5QTVMWXJDd2R1M3hlTkRhSnVJeHpwWHJiQ01h?= =?utf-8?B?MUtsMVFnWFVvdWl1RkxUN1ZUcnh1eDJ1MGZoa2VHYzVUdnpNME9ZTSt6WnZP?= =?utf-8?B?MkMzL21MQlJ5NVJHVzVxaWk3MVFFRG5nUUY3amgxaFc5WWpFeFBXN3FzeGF3?= =?utf-8?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kRheG91cXRpdHNkanlX?= =?utf-8?B?WDVzWGdHUlMyRlJ2YTJhZTdBQ3JBV3JIa0lua2ZHUVdvbzlGK0NDcEkzVHZC?= =?utf-8?B?MWJaVVZvV05GT3hxV0RndytxKzhHSWZEL0RQVStjQnB5dW10QW1ZWXhxamRs?= =?utf-8?B?SHZmUC9VM3BkbVcvVUlib3oxVENpM3BpYmRPZmV6czJiNzFraW5OelRQam5v?= =?utf-8?B?OURkSnJVV0M1QW10VDdQejg1MzFHN1p5ODFhcW1TNVVrNjRSenNBaHVaNldP?= =?utf-8?B?OUUwQzNKU1JLNHFtc1F0WGRvWEtxejRKL2RYbUVna3RibEIvT3VBc0kyM0lF?= =?utf-8?B?b1hRbTMxbkQwKzljV0QyMWZUbkc5dXRSaGNGeGFGR09BU3Q1eDMwaG95ZDVQ?= =?utf-8?B?T3pDNUJyWnorejdicEZITzVGUllCQ29hUG1CNWVyRTFFT3Zxa3V1eHhNSTdp?= =?utf-8?B?Uy9rOWxOaU5VT2RZUWZLWXpUdDIxSWR3TCtIM3VjSXo4TlRaeStDb1RRR25k?= =?utf-8?Q?Mgdm36q/i8fA+JTw/yl5oEJbWsrMLhUDpjhtCxb?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:KL1PR06MB7401.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WHZmbWtPeHI2dkVRUlBMWkJhc0J4WWU4UlQzUURWTzE5SEd1MXJwd1ZVMHVW?= =?utf-8?B?dFUrcDd5SlVRUEJjUVJmNm5zckVZNkxhVk1vTUtWN2RCOEFibENkZnpTWWNt?= =?utf-8?B?VzBmendnVVEyYUpER2dQdEVqcnlWSnFzQWwxdXdoV015NG43eTd2UU1JV0xD?= =?ut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NBWWsrL3VFS0NFM0I4dGR5b25L?= =?utf-8?B?YVVHbFdTT2syWEx1L3ZiczE5QWxCWmtnZURUZlB4OFFzZFZxR1pFSFE4VW01?= =?utf-8?B?dS8vTmJ1Y0Z4ZGo0Tzk2OGZHOW1CSit3QnROWEFYTkttOTF4MmNpbGp0cWEz?= =?utf-8?Q?VpbZZAOLmjLii7URph2EoQRVn?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ea955ab-6560-4f28-ed0f-08dc8a1589ec X-MS-Exchange-CrossTenant-AuthSource: KL1PR06MB7401.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2024 12:53:49.3698 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jm8xgtdKRO0EqEkW7kQng/nsbbKiRxVaNVmBexHP49PrpQu2suEyf2mTieiUVcJctiL0ek5kduZ8bS/J5HY2JA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6816 On 2024/6/7 20:59, Pavel Begunkov wrote: > On 6/4/24 08:03, YangYang wrote: >> On 2024/6/4 14:12, Yu Kuai wrote: >>> Hi, >>> >>> 在 2024/06/04 11:25, Ming Lei 写道: >>>> On Tue, Jun 4, 2024 at 11:12 AM Yang Yang wrote: >>>>> >>>>> Configuration for sbq: >>>>>    depth=64, wake_batch=6, shift=6, map_nr=1 >>>>> >>>>> 1. There are 64 requests in progress: >>>>>    map->word = 0xFFFFFFFFFFFFFFFF >>>>> 2. After all the 64 requests complete, and no more requests come: >>>>>    map->word = 0xFFFFFFFFFFFFFFFF, map->cleared = 0xFFFFFFFFFFFFFFFF >>>>> 3. Now two tasks try to allocate requests: >>>>>    T1:                                       T2: >>>>>    __blk_mq_get_tag                          . >>>>>    __sbitmap_queue_get                       . >>>>>    sbitmap_get                               . >>>>>    sbitmap_find_bit                          . >>>>>    sbitmap_find_bit_in_word                  . >>>>>    __sbitmap_get_word  -> nr=-1              __blk_mq_get_tag >>>>>    sbitmap_deferred_clear                    __sbitmap_queue_get >>>>>    /* map->cleared=0xFFFFFFFFFFFFFFFF */     sbitmap_find_bit >>>>>      if (!READ_ONCE(map->cleared))           sbitmap_find_bit_in_word >>>>>        return false;                         __sbitmap_get_word -> nr=-1 >>>>>      mask = xchg(&map->cleared, 0)           sbitmap_deferred_clear >>>>>      atomic_long_andnot()                    /* map->cleared=0 */ >>>>>                                                if (!(map->cleared)) >>>>>                                                  return false; >>>>>                                       /* >>>>>                                        * map->cleared is cleared by T1 >>>>>                                        * T2 fail to acquire the tag >>>>>                                        */ >>>>> >>>>> 4. T2 is the sole tag waiter. When T1 puts the tag, T2 cannot be woken >>>>> up due to the wake_batch being set at 6. If no more requests come, T1 >>>>> will wait here indefinitely. >>>>> >>>>> To fix this issue, simply revert commit 661d4f55a794 ("sbitmap: >>>>> remove swap_lock"), which causes this issue. >>>> >>>> I'd suggest to add the following words in commit log: >>>> >>>> Check on ->cleared and update on both ->cleared and ->word need to be >>>> done atomically, and using spinlock could be the simplest solution. >>>> >>>> Otherwise, the patch looks fine for me. >>> >>> Maybe I'm noob, but I'm confused how can this fix the problem, looks >>> like the race condition doesn't change. >>> >>> In sbitmap_find_bit_in_word: >>> >>> 1) __sbitmap_get_word read word; >>> 2) sbitmap_deferred_clear clear cleared; >>> 3) sbitmap_deferred_clear update word; >>> >>> 2) and 3) are done atomically while 1) can still concurrent with 3): >>> >>> t1: >>> sbitmap_find_bit_in_word >>>   __sbitmap_get_word >>>   -> read old word, return -1 >          t2: >>>          sbitmap_find_bit_in_word >>>           __sbitmap_get_word >>>           -> read old word, return -1 >>>   sbitmap_deferred_clear >>>   -> clear cleared and update word >>>          sbitmap_deferred_clear >>>          -> cleared is cleared, fail >> >> Yes, you are right, this patch cannot fix this issue. > > One other alternative is to kill ->cleared. It's not > immediately clear how important it is. Do we have any > numbers? Sorry, I can't get it. Are you suggesting to remove ->cleared from struct sbitmap_word entirely? Thanks. > >>> BYW, I still think it's fine to fix this problem by trying the >>> __sbitmap_get_word() at least one more time if __sbitmap_get_word() >>> failed. >> >> Err, after trying one more time __sbitmap_get_word() may still fail. >