Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp248311lqt; Thu, 6 Jun 2024 02:21:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVhZnL0nBxgbdRVoxNBXMDtMvIfgnH2Dd67KISOAuKkO5/waSTUE2z5JerbXGMf1iRFjpaltZjC08Ofj5TIWAZNVmximWD0auE29oXpCg== X-Google-Smtp-Source: AGHT+IFyKEBkEn1TwGxEDHQCLV0YIr05XiYTS6PELHKTLLEWmWz7eG30UsYf77/InaswhQHJaGvj X-Received: by 2002:a05:620a:4694:b0:794:fb8f:5495 with SMTP id af79cd13be357-7952f12023cmr415436385a.26.1717665719053; Thu, 06 Jun 2024 02:21:59 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79532888d96si100055585a.172.2024.06.06.02.21.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:21:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=C+KlBAlx; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-203975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203975-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 B0EC61C237BE for ; Thu, 6 Jun 2024 09:21:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B326714EC6E; Thu, 6 Jun 2024 09:20:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="C+KlBAlx" Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010001.outbound.protection.outlook.com [52.101.128.1]) (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 7472B13C833; Thu, 6 Jun 2024 09:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.1 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717665630; cv=fail; b=uKshnO8fIeYdT8opPeSVzSvdUdKAyEP85f/WZqmth9+YUJ6VLozmGoeYVri3hWCF6bH72Koqex2bOsSwXOHf8OBaTHG0cT/KtkJuRnTQDCfYbAy8ntztU1XY9WiHwlRbEqfW6ARv6n207TnzKeogMt5lWWp2xeqU+gvYS6lwJYI= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717665630; c=relaxed/simple; bh=ruOesDVo3AawTtihxisJnxS6qG9ZBLHGoP5I5hSvong=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=ozslZ2dXa+LgrlDNJ74YU+6F/c70o5i5Z/+YhKA48WvmXHVyPofnodS3mssc91MISzcMHtBl4bgwyRxb47ItmMRmhOVG1Ey1inQfsAzgyKxcQXZ7TZ9mNu72kxVWVoFqenrLQ3CySvMdzqRVTedZBSVBEpJcSamrCGNdqDGBrPc= 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=C+KlBAlx; arc=fail smtp.client-ip=52.101.128.1 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=dvEje3Lp5ckZ1Sesevw9VCnl4kQL73si3xOMr//Wc+8qrwh2qVWErb1SFb4WcWWLgYmtmOcyt2QEMzoa+a+ae1uR4bKVrKrMK3nx5xm8MStczFY1odtgGDrLnb9lkiVn70HPvi5NM0zN4VX05xTmaf7GRG07ofOY1r6IHW6/OyDl9spoHpTm3jDL1wpaDr+zB3fWfPbDT1FhJgmMZaPxSp8vCGgtw4ilBSZYmxOinhXJ+SP2Az0K+erhRfNaTY3IvnHJdoJR5d7UK7J4WxUM3PEc1hIVi+FTLbZop3npyFIvTvgh3VAZcq+S7MzY5mn/NFs91VUVwPpcrWEHsicimw== 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=4uDRc+VNKJ7yXgFmYT1HDOtdAFkbe/1qIOX/z69UTok=; b=FDWdGbnwv9cxDW/kke8Tt1Tf5OWkMpPZUabtdOCIfdUuzAHoVqLVZSuzk2QlFlKpKYP2PHGha9kB+SHevO8BiM6non6vmqTwXIC6nUT3s+pcXDR3AsI66bWMwLqXwgHbKjbGWzDA7JBC2+ympdFMgYy16oLOSfdabKhCjME5rxjdby0AtzPmHYPt8yTcKz6RhUIFMdcbABC0EeCfCiJ3YR/n1nGekUcG6Rc3jDnYKxZpJTHPTpaIWelAqFtYNy7TiSr2cj040+hRgpvi6uTdV8nFgfUmd9Si8n0SEmNIdy175N1B01z/QGHqFrBa8YPZsaXAU4GaijBkGh5H7UzQAw== 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=4uDRc+VNKJ7yXgFmYT1HDOtdAFkbe/1qIOX/z69UTok=; b=C+KlBAlx0ZQVDJouX9oe9dKHd9gum1uqHcedwJRb8Od0o3MiEc5r1RybgPJ0mG8YQUBSfvBK76qLFZX+DqgVV7M0YRMcmlgUVa95AUoeOe9altF7OdvO4isfYsdz6rV+8im/dBgfqlQ9Y9Qj/GBDQZ0hXjWHaS+Ut8CbT92imwASWbXW3gzH3+HnuikB7SGTXmXrwlsK/q5R6a4K0gmtNYitrncfL2VNivcPPkre54btU2+ueCm5/TircqhKqOHWq/T4fW+3gWo+to6AWYfuE70uJj4gA9vRjW0jqPar2fs21mAeUdpgWf5EjOpmjweHoAj9KMsqisuGVbUu72g8eg== 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 TYZPR06MB7172.apcprd06.prod.outlook.com (2603:1096:405:b3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.33; Thu, 6 Jun 2024 09:20:24 +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.033; Thu, 6 Jun 2024 09:20:24 +0000 Message-ID: <477a2cb7-bd93-4f1c-a10e-ae7585425a02@vivo.com> Date: Thu, 6 Jun 2024 17:20:19 +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: Ming Lei Cc: Jens Axboe , Andrew Morton , Pavel Begunkov , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, "yukuai (C)" , Yu Kuai 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: TYCPR01CA0127.jpnprd01.prod.outlook.com (2603:1096:400:26d::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_|TYZPR06MB7172:EE_ X-MS-Office365-Filtering-Correlation-Id: 14f1aaa2-0114-41b8-20f3-08dc8609e545 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: =?utf-8?B?eURJbmdzK09qM3BVOEtnbjdoQlFWcTVVdExKYjdRUDNMdDM3M0I2dGpRMkxZ?= =?utf-8?B?QVZFQ1BENEx6Z0tsVzFyVkZyRERRcFMvVWpMamlwOVpKTDhDdWZGelVEZVpt?= =?utf-8?B?NkNUaDVGYU1weVhWeUJKZmNSRzRjcFg4NytXVHRiQ2FOQ0xtYis1bm5hRVUy?= =?utf-8?B?L3ZXYng5eU5YeXFiSXFwcnduSDk2L2FYM1dINzgvaHBVbFJ2dkllRU1JTzFq?= =?utf-8?B?bWhmbHlMOWYrNmFQTFNSOXdSQjkzNCszQ0ZUd3NBaUJEaFk4Z0dvc2JVVksr?= =?utf-8?B?c0hmN0FBRHgyT21GdUVUQTAzLzFPQW8wdWZuZ0J3RHVoemMxSXdDVFlESElY?= =?utf-8?B?SGpoVXZodU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ODdyQndYbmRTMC8xTlpoS0w0YkVtOTU4M2NjbXNWZkMwTG5XVjVId3Jw?= =?utf-8?B?Tm1GdFV3VnlUV01vRDVxZjBDeUVmQlU2aXlORzJjTmZzY2ZTUWFOMmY2elN2?= =?utf-8?B?c3hrQzdlcVZYOUZ4QjR5eTdWaVdRZEs4Q3VuSGVJZGYzalkvSS8yMnp3YXlT?= =?utf-8?B?VGI1Q29oSTlDU216eDhzc2lKM3B0VWVwZG0yaWlCRXIwbU82MFQ3L2UvVis5?= =?utf-8?B?SW15Z0ZXdC9iUFQzVGh5NitMVU00TFZpQ3NwOXFhc2ZjVE1HREMwc3ZpYTBo?= =?utf-8?B?My9USFpicWNjZXBDTnlnRTR2QVF5L0FPSU9SQi9ETllWa1pJMGM2Mk1tZXJC?= =?utf-8?B?SThoMG1HZldtcnFUWEJzWUVlWW8rbnRwTnpZS25CMVZNdDdNWlYwVGdCZ3kz?= =?utf-8?B?bkg0QjJ6NHRFMlRVRFlpcUFWMnFuUHh2eUp4OE41aWdtdklTcUN4SUhOMkxt?= =?utf-8?Q?tfV1p/6SsgqZ5TCjcxVxNtMybPQDh4iaXJkZwUL?= 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)(366007)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Ny81Uk1PdlVHT0RSVDlyMGJMenJvcU50M3BZMk1HVGRwTTVyd0RvaWpHT2U1?= =?utf-8?B?SEdBZ0hKcW9jeEwxbGxtaVNYMzZuMWRGUmRseXlDcUJ5cFBTNlEyc3FCYXlz?= =?utf-8?B?S2tDQnlaS2VNVjExQXVNNVdHdFY5Q2wrOVNKMFpXUW4xTTZFNHZhQ0xiNGlG?= =?utf-8?B?c1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JMXZMUlVqb281Ulpi?= =?utf-8?B?bmNwUXpzVjRRY2FzNTFmaGluRW1xMk9vaXdpNk4ycmFiWmh3R09qRzQzQy84?= =?utf-8?B?aGFQaVJhaWtmL3Y2bWxXUFVoZVp2OGJpWUU0dGVEMElrM3RHbzN6RkJSOS9s?= =?utf-8?Q?UhmUF23MYAJ1va01U4qFDfnNw?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14f1aaa2-0114-41b8-20f3-08dc8609e545 X-MS-Exchange-CrossTenant-AuthSource: KL1PR06MB7401.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 09:20:24.0502 (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: 8l5Qt6w6QYqwraRK45yc+oYcbybpPnLWamplaHBXVkeXWl0cAfqEFEQYRNL5wi7I0tI5Hh4MN53MkcIvKqD/UA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB7172 On 2024/6/6 17:02, Ming Lei wrote: > On Thu, Jun 06, 2024 at 03:21:38PM +0800, YangYang wrote: >> On 2024/6/6 11:12, Ming Lei wrote: >>> On Tue, Jun 04, 2024 at 02:12:22PM +0800, 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): >>> >>> After 1) fails, sbitmap_deferred_clear() is called with spinlock, >>> then it is pretty easy to solve the race, such as, the following patch >>> against the revert patch. >>> >>> >>> diff --git a/lib/sbitmap.c b/lib/sbitmap.c >>> index dee02a0266a6..c015ecd8e10e 100644 >>> --- a/lib/sbitmap.c >>> +++ b/lib/sbitmap.c >>> @@ -63,13 +63,15 @@ static inline void update_alloc_hint_after_get(struct sbitmap *sb, >>> static inline bool sbitmap_deferred_clear(struct sbitmap_word *map) >>> { >>> unsigned long mask; >>> - bool ret = false; >>> unsigned long flags; >>> + bool ret; >>> spin_lock_irqsave(&map->swap_lock, flags); >>> - if (!map->cleared) >>> + if (!map->cleared) { >>> + ret = !!map->word; >> >> After atomic_long_andnot(mask, (atomic_long_t *)&map->word), map->word >> may be 0 if all requests have completed, or not 0 if some requests are >> still in flight. > > setting ->word is lockless, but zeroing ->word is serialized with ->swap_lock. > >> Therefore, using !!map->word to determine the >> availability of free tags is inaccurate. > > The check should be changed to decide if any free bit is available in > map->word instead of !!map->word, and 'shift' need to be passed in > sbitmap_deferred_clear(). > > Just be curious, do you have reproducer for this issue? It's hard to reproduce, but it's reproducible. We've encountered this issue several times. Thanks > > Thanks, > Ming >