From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 126D9E8FDAF for ; Tue, 3 Oct 2023 20:12:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 763D96B016B; Tue, 3 Oct 2023 16:12:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 713A76B016D; Tue, 3 Oct 2023 16:12:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58DDA6B016F; Tue, 3 Oct 2023 16:12:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 43A5C6B016B for ; Tue, 3 Oct 2023 16:12:41 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 155AC40440 for ; Tue, 3 Oct 2023 20:12:41 +0000 (UTC) X-FDA: 81305248122.02.CFEC564 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by imf22.hostedemail.com (Postfix) with ESMTP id D876EC000D for ; Tue, 3 Oct 2023 20:12:36 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=b7wJT2lQ; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=mOLmS3Ey; dmarc=pass (policy=none) header.from=alu.unizg.hr; spf=pass (imf22.hostedemail.com: domain of mirsad.todorovac@alu.unizg.hr designates 161.53.235.3 as permitted sender) smtp.mailfrom=mirsad.todorovac@alu.unizg.hr ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696363959; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pxSZGmmjNVXQJSnzeq0G7a7BTzv04odKA1GngTIRTAo=; b=Yoc4xEc+tpg8BRkxWttFX2BOsuQIAydPsC0uV9woLYfR5jQbhAkBrzogU4c32mVrh7Fjb9 sRQ/y5StP3jJPr7DtmCNoQacL28SHwEpGSrDlwEuxRMQHiZxw84C/as3/81HXsb+ymQKIn D6CUfnnucO1cbQZcYFdw78HRWF4+wwA= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=b7wJT2lQ; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=mOLmS3Ey; dmarc=pass (policy=none) header.from=alu.unizg.hr; spf=pass (imf22.hostedemail.com: domain of mirsad.todorovac@alu.unizg.hr designates 161.53.235.3 as permitted sender) smtp.mailfrom=mirsad.todorovac@alu.unizg.hr ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696363959; a=rsa-sha256; cv=none; b=J4l/ZuCu3N1iHQuc+OqiXPYo9mceLlpujYCnsNjokArWQV58RZsKQKBwRypyECA4bDiNz4 Wc0ojkCGLZ37tg1rp3Y9bjGO7IhhYoGUXrYBHQ+C0GRPpmIIrDO0xTym4JzfloKsqixUCb nxn+h+6bZH2my46etnEmMSiup0uibcg= Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id 37B5360173; Tue, 3 Oct 2023 22:12:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1696363954; bh=3amMaq29morJQRBmN64tOmRcaqhD62RaH1xvx+cR1e0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=b7wJT2lQaOePEHifofzZV4vw7ihkuu9WfSDvCIfMaTAHwyaAP1yZvEuJQYwrdr0EV S4324oclvyMrQ+HMr8g8wDXW++BMOymZoTu4Cj865Q6J3tsEGCZKtnDWoaWwd5CzE6 AQkUAaFiqWKtabtiZFaS4oZ2OiPdcF5FAGMUemqAw0vTMtdSa3Vg+nWDx4WslAX23q Jc8/wv6nrpugFYDP7OWVyoMk/jroBqZvRVLoOpMbAAVZNu7OkCLiA0CqBWeOUyVVXJ ZFM2Qq7ycfzYYrEWOd4kAVFs0dNS3Q4pb05oKlTF9rY8DD0CUklHxe2vNawHT1snjH HCtfeVIa9XxnA== X-Virus-Scanned: Debian amavisd-new at domac.alu.hr Received: from domac.alu.hr ([127.0.0.1]) by localhost (domac.alu.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hTZSUGvs4RVA; Tue, 3 Oct 2023 22:12:32 +0200 (CEST) Received: from [192.168.1.6] (78-3-40-17.adsl.net.t-com.hr [78.3.40.17]) by domac.alu.hr (Postfix) with ESMTPSA id 9D98F6016E; Tue, 3 Oct 2023 22:12:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1696363952; bh=3amMaq29morJQRBmN64tOmRcaqhD62RaH1xvx+cR1e0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=mOLmS3EywplYJ7mYRpFqCh3womwAu8/RGYwouma+OP4IVjJIss7Ug5n1WqZDjQuIB pEcBfv6PDsWEXF2/7eku6xfABnSgkxxeVPXbVrxxgv+w7j1xcu2deIOI+dax/tGbSr IYkfGO8jrv4SB9oaf3Gg1/M6cnLOim98N+dUnDPqmRJlKIPLRzvB0V8bGo0qakCLpK Sq/pEtpa6hdgKamh4K+1ZHai7LPLIH37twRn6JZZ/YWDZKftKzaV+UpbWpASuYdWJ8 ucnagf4Pwfbb1rJxF6c+TRoPeB8PW4D/UE8im0n8o+fwphF/N+rT28DG+o6UNb1/gl flLSLXJhycC5g== Message-ID: Date: Tue, 3 Oct 2023 22:12:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG: KCSAN: data-race in folio_batch_move_lru / mpage_read_end_io Content-Language: en-US To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, Andrew Morton , linux-mm@kvack.org, Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org References: <22a42774-ebe1-081a-c9b9-e11f4d74bc3a@alu.unizg.hr> From: Mirsad Todorovac In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: D876EC000D X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: rqetqt5nicnoyg5baq5omrucroz15qrf X-HE-Tag: 1696363956-553378 X-HE-Meta: U2FsdGVkX18eXcC4FXLpj1kY/i4o8ysTJsW90kRVo3NT2pD9Pt+FNvuasaXiWdCR4zGWi6uf2BhYwyNqA6nnyFCoNot1piElH6zwtlmJZO0WUFtoTkmIn3RJwfeIqOSKEQ0khfLm3x4gZMvyTqB7l5AZ4GaOkoI69uBbcUvX5KRXdB9eI4E4f6ZF2gGtEWh0ir4UDDrrcCkc+9LIfUOF0Z9CltX1cAqv9Xtbz6MhOX5EnUcaGykI3vLhi9YLXwwAMqNdfU22/i1uvaTSsHdTEGu/P7l3TTx1xVCdmqKkurhjSPZQCDXRk1uDrgjFrSaqIwNrev42g80vV2kIjsOclyfAlvJ8FFMGwnww952Grv61HbELbjyNjakEwnsteP3DcNXjU8HqW/1ugpOKTwRg7efoSwQCqcLwWykOmrC3x4OXIj6KsKyGhhxkaNOSE+JHyLLIh95fuGifGGh3IxxsT5RfPYOFjEDcI0RsPJ6ybRqBJG60SywuDsrA0Q4h29Viu8O+3nvfARd8ZvGZsT6Fe3hc1pQZdgMEbVxZ1+Dq13SyN8JyZVoIfTPtZZWBOOBEFJ45SeVqAWx5Mm9OA/H1qFpeOO6PzjsTXdPLPql3SqT/SaRQotBmVUGmICAZ2ldqpms54/OPET4MctY1p6CPgug7AuWdWe5RacDYDXQJtC3YC6l9XGItHbfN5zUCpx3MYsiM4RC8bJKpywlFC7hxJH2RuNF7G4xS+R7cEC07u43xOupZ+wpMW2UAWr8DStmzMy24mV8KB32PC+qLg1FijdtFsFsmAXh+LPOC6QR1d0ua6B1/KszZnjtNfkhDGU6wuFZAwhqwM2/3pza+bSzNr3RR+j101w8mrFAePkemtW+RCV7QR7Wt1JM2jDyAvBgqaPJfIEPWeVNUSz+0tl0dk5h4Ze2gKz5dNaHP4ZqCYAkkyg1UWqrp7ISCWgRjf+b2eFzWZ9sgAzCodtT60VA fWgVezOf bgYjFheBQIdyxp0ElhlanooZm16lk+Uf7VuncRKEJKL6oXFn6joOOy/c9iHP2xtt2rE/QWGljJmBDT6t9EB7DUGf+svxx8sbL4+xVmXF2P1f3oyODHhDigd9sva6yRTmuh3+hn/1ckcx0FaHPUmAFkGclLnVHC6ZZQ6qwEOigP8OpYlyUgNsZ0KiJkw1UN1tARRWURyZLX+lP9RUdqhABzQAKGWO37/l2yMn0jDnmfMIrpIno+Tt2ioH61D+hiy4F8vhh X-Bogosity: Ham, tests=bogofilter, spamicity=0.000056, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 9/18/23 16:53, Matthew Wilcox wrote: > On Mon, Sep 18, 2023 at 02:15:05PM +0200, Mirsad Todorovac wrote: >>> This is what I'm currently running with, and it doesn't trigger. >>> I'd expect it to if we were going to hit the KCSAN bug. >>> >>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >>> index 0c5be12f9336..d22e8798c326 100644 >>> --- a/mm/page_alloc.c >>> +++ b/mm/page_alloc.c >>> @@ -4439,6 +4439,7 @@ struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid, >>> page = __alloc_pages_slowpath(alloc_gfp, order, &ac); >>> out: >>> + VM_BUG_ON_PAGE(page && (page->flags & (PAGE_FLAGS_CHECK_AT_PREP &~ (1 << PG_head))), page); >>> if (memcg_kmem_online() && (gfp & __GFP_ACCOUNT) && page && >>> unlikely(__memcg_kmem_charge_page(page, gfp, order) != 0)) { >>> __free_pages(page, order); >> >> Hi, >> >> Caught another instance of this bug involving folio_batch_move_lru: I don't seem that I can make it >> happen reliably by the nature of the data racing conditions if I understood them well. > > Were you running with this patch at the time, or was this actually > vanilla? The problem is that, if my diagnosis is correct, both of the > tasks mentioned are victims; we have a prematurely freed page. While > btrfs is clearly a user, it may not be btrfs's fault that the > page was also allocated as an anon page. > > I'm trying to gather more data, and running with this patch will give > us more -- because it'll dump the entire struct page instead of just > the page->flags, like KCSAN is currently doing. As my learning curve adapts, I seem to be more aware of what you are talking about. I still have to learn to cope with patches, diffs, fixes and pulls all together and consistent. Sometimes I feel like in the BORG maturation chamber when I try to learn the Linux kernel, and I wonder if this is the Author of my story trying to make up "for the years that locust had eaten". Or is it that I am just losing the plot. I learn that I was conceited and not respecting the work you guys have done in thirty years I wasted for one reason or another: objective difficulties and personal weaknesses. Forgive me this moment of truth. I certainly feel more motivated to catch the real culprit, rather than just the symptoms. I will rebuild with your patch again and try to reproduce the problem. Best regards Mirsad Todorovac