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 5FEA2CDB47E for ; Wed, 18 Oct 2023 07:52:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0071F8D013E; Wed, 18 Oct 2023 03:52:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF9418D0016; Wed, 18 Oct 2023 03:52:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D24E58D013E; Wed, 18 Oct 2023 03:52:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C016B8D0016 for ; Wed, 18 Oct 2023 03:52:10 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7E16EC014B for ; Wed, 18 Oct 2023 07:52:10 +0000 (UTC) X-FDA: 81357814020.16.702821C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 2D8294001D for ; Wed, 18 Oct 2023 07:52:07 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=b7+pqYhv; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697615528; 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=RHU5Hd39FUrVAV5loRQ1RiePBE82/byfLGhIqj8tiII=; b=0TZQjo4NKmk9koYPOq5wPiGN4fjJ+h36o/7tdh8ZVFiKsGrKnS3AzI8bdw5rIDBz8Gt9Ib iK1M2FOEGanm9lTmVLxvQoX+TkeVhjy0XSy12wDbBsbNXd+pH9JCqm8v5S8OkTnxWQE0M8 /Na6ZQsPydybPtgdMunZCBTkixcLJjk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=b7+pqYhv; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697615528; a=rsa-sha256; cv=none; b=2mSaa7wVMeyv21aMtb9Ca3OsDzRqJpji14s8MTEX/cELQi463vUxAAnggXobR3hDAu3wX9 R+EjBQSMSpeqpaSt6pafhCL+gRE3OGfds8w/BS1NrLzXlFZNTTE53YvGR+Vsz2ym4l1QGd o7LBDvY5RaxO7/W9e/OXW544zjFInB0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697615527; h=from:from: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:autocrypt:autocrypt; bh=RHU5Hd39FUrVAV5loRQ1RiePBE82/byfLGhIqj8tiII=; b=b7+pqYhvqbLisqItcn5tyjs12Ug9UXQucYwVC8X2NkMVPKzOqsSphqemLXaxRKAKailVhx a8UjAP9rs++YMveImQeNmCmNPlX9s+Fe189pd1dDDr3gRSWs8JBNJbYd/cbc2b0NGewG95 Gvl0QvqczuspCB5JxOMLC294Jn/9rU4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-npBObPVVMJK8lmfH8Ol9zA-1; Wed, 18 Oct 2023 03:52:04 -0400 X-MC-Unique: npBObPVVMJK8lmfH8Ol9zA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-32da7983d20so1805634f8f.1 for ; Wed, 18 Oct 2023 00:52:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697615523; x=1698220323; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RHU5Hd39FUrVAV5loRQ1RiePBE82/byfLGhIqj8tiII=; b=f5QojxOwYOvXLOXWit4h3uwntSPcZUa7YlNWwMQLaW3EbBeQVF+mhiC0gN+VdjnIBz 4I/zel/JQdn+H6towPXRO0Rs37jzokHIMo3e3xQP7soiSaaL+iyR14faQlxSfV8O3iat YCKPFtKSk9E0oQlG4gIZVjewv0H4cL2rYTNZbASdxlLR5paEiQ4xcnW0uKup3xXEy0L/ OICW+PZrSceYH2aGnyxoRQANhGxlQ23HU0TDPBVAfCgLUdFZ4jcVFjTQCO4AKfXhdumm 0xxeD3+uzHnFldib3rBYFhSeUw/Ffc/0EyOtQt6jinV84zpyGVqj2TUxtRpIJrRaLACU 1PmQ== X-Gm-Message-State: AOJu0Yx6p/kHycn2QHqBe6dbxlzW8nz9pLFchznWMfxmwqq9lX6q+GDk XWdodxMd1qoGACBZOHDukRLUiRR1gklCWCpGqeciK0rC7WavSnbGSIucyFvOSN3iHYZ6wWC4Vd3 FeTqi/pVDtVI= X-Received: by 2002:a05:6000:b90:b0:32d:c76f:299e with SMTP id dl16-20020a0560000b9000b0032dc76f299emr3762793wrb.19.1697615522869; Wed, 18 Oct 2023 00:52:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQkhmtCUMSZwDH9L0u+eMmT0hnvuPZIJdkFV3319moRmx057s+D42w02GTuO9Exs8Q8EZUCw== X-Received: by 2002:a05:6000:b90:b0:32d:c76f:299e with SMTP id dl16-20020a0560000b9000b0032dc76f299emr3762765wrb.19.1697615522319; Wed, 18 Oct 2023 00:52:02 -0700 (PDT) Received: from ?IPV6:2003:cb:c70a:d300:5c7b:51ce:e3ef:6e01? (p200300cbc70ad3005c7b51cee3ef6e01.dip0.t-ipconnect.de. [2003:cb:c70a:d300:5c7b:51ce:e3ef:6e01]) by smtp.gmail.com with ESMTPSA id h17-20020a05600c499100b0040772138bb7sm939078wmp.2.2023.10.18.00.52.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Oct 2023 00:52:01 -0700 (PDT) Message-ID: Date: Wed, 18 Oct 2023 09:52:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm/sparsemem: fix race in accessing memory_section->usage To: Charan Teja Kalla , Andrew Morton Cc: osalvador@suse.de, dan.j.williams@intel.com, vbabka@suse.cz, mgorman@techsingularity.net, aneesh.kumar@linux.ibm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1697202267-23600-1-git-send-email-quic_charante@quicinc.com> <20231014152532.5f3dca7838c2567a1a9ca9c6@linux-foundation.org> <994410bb-89aa-d987-1f50-f514903c55aa@quicinc.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jt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C1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <994410bb-89aa-d987-1f50-f514903c55aa@quicinc.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2D8294001D X-Stat-Signature: a139bren15gwaecw5sciz47kiq4637dm X-HE-Tag: 1697615527-396915 X-HE-Meta: U2FsdGVkX184rLptu+rYdZhYvi1vBHLdRCHXf1TpT79P/67f0YS/yc4Rm+MYve5iX1Sca2oKldHKrGGPltrwIDJGqSeObDiX4yrvIJ6adUyRJiyPt9+ROWQidOhmwlTV318qj6cFwRcAcc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snBntPBeOJZ6ksXOvRtwhhAtXbsiMQxsLhLTHO5LS+JC41rDyAAntyjpUkJBRpAPtTC8y7seONJmKbW1/y93CkWrTg7ODcvSVMSI3CAeNJO4JcoziM3WGMMapKenShhpIIy9eS+kZWQ9n3BP9kDREZT3eKtSkHuH9tnmgDDUrPP8aZ5qu8jsNPCf0apjw3mHjF4njBzajenV3VVjD4Fd979/hwZQv1bYukV6NFK+jd5QEP7ILKLwaWM1Kg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 16.10.23 15:38, Charan Teja Kalla wrote: > Thanks Andrew/David, > > On 10/16/2023 1:53 PM, David Hildenbrand wrote: >>>> The below race is observed on a PFN which falls into the device memory >>>> region with the system memory configuration where PFN's are such that >>>> [ZONE_NORMAL ZONE_DEVICE  ZONE_NORMAL]. Since normal zone start and >>>> end pfn contains the device memory PFN's as well, the compaction >>>> triggered will try on the device memory PFN's too though they end up in >>>> NOP(because pfn_to_online_page() returns NULL for ZONE_DEVICE memory >>>> sections). When from other core, the section mappings are being removed >>>> for the ZONE_DEVICE region, that the PFN in question belongs to, >>>> on which compaction is currently being operated is resulting into the >>>> kernel crash with CONFIG_SPASEMEM_VMEMAP enabled. >>> >>> Seems this bug is four years old, yes?  It must be quite hard to hit. >> >> From the description, it's not quite clear to me if this was actually >> hit -- usually people include the dmesg bug/crash info. > > On Snapdragon SoC, with the mentioned memory configuration of PFN's as > [ZONE_NORMAL ZONE_DEVICE ZONE_NORMAL], we are able to see bunch of > issues daily while testing on a device farm. > > I note that from next time on wards will send the demsg bug/crash info > for these type of issues. For this particular issue below is the log. > Though the below log is not directly pointing to the > pfn_section_valid(){ ms->usage;}, when we loaded this dump on T32 > lauterbach tool, it is pointing. > > [ 540.578056] Unable to handle kernel NULL pointer dereference at > virtual address 0000000000000000 > [ 540.578068] Mem abort info: > [ 540.578070] ESR = 0x0000000096000005 > [ 540.578073] EC = 0x25: DABT (current EL), IL = 32 bits > [ 540.578077] SET = 0, FnV = 0 > [ 540.578080] EA = 0, S1PTW = 0 > [ 540.578082] FSC = 0x05: level 1 translation fault > [ 540.578085] Data abort info: > [ 540.578086] ISV = 0, ISS = 0x00000005 > [ 540.578088] CM = 0, WnR = 0 > [ 540.579431] pstate: 82400005 (Nzcv daif +PAN -UAO +TCO -DIT -SSBS > BTYPE=--) > [ 540.579436] pc : __pageblock_pfn_to_page+0x6c/0x14c > [ 540.579454] lr : compact_zone+0x994/0x1058 > [ 540.579460] sp : ffffffc03579b510 > [ 540.579463] x29: ffffffc03579b510 x28: 0000000000235800 x27: > 000000000000000c > [ 540.579470] x26: 0000000000235c00 x25: 0000000000000068 x24: > ffffffc03579b640 > [ 540.579477] x23: 0000000000000001 x22: ffffffc03579b660 x21: > 0000000000000000 > [ 540.579483] x20: 0000000000235bff x19: ffffffdebf7e3940 x18: > ffffffdebf66d140 > [ 540.579489] x17: 00000000739ba063 x16: 00000000739ba063 x15: > 00000000009f4bff > [ 540.579495] x14: 0000008000000000 x13: 0000000000000000 x12: > 0000000000000001 > [ 540.579501] x11: 0000000000000000 x10: 0000000000000000 x9 : > ffffff897d2cd440 > [ 540.579507] x8 : 0000000000000000 x7 : 0000000000000000 x6 : > ffffffc03579b5b4 > [ 540.579512] x5 : 0000000000027f25 x4 : ffffffc03579b5b8 x3 : > 0000000000000001 > [ 540.579518] x2 : ffffffdebf7e3940 x1 : 0000000000235c00 x0 : > 0000000000235800 > [ 540.579524] Call trace: > [ 540.579527] __pageblock_pfn_to_page+0x6c/0x14c > [ 540.579533] compact_zone+0x994/0x1058 > [ 540.579536] try_to_compact_pages+0x128/0x378 > [ 540.579540] __alloc_pages_direct_compact+0x80/0x2b0 > [ 540.579544] __alloc_pages_slowpath+0x5c0/0xe10 > [ 540.579547] __alloc_pages+0x250/0x2d0 > [ 540.579550] __iommu_dma_alloc_noncontiguous+0x13c/0x3fc > [ 540.579561] iommu_dma_alloc+0xa0/0x320 > [ 540.579565] dma_alloc_attrs+0xd4/0x108 > >>>> Fix this issue by the below steps: >>>> a) Clear SECTION_HAS_MEM_MAP before freeing the ->usage. >>>> b) RCU protected read side critical section will either return NULL when >>>> SECTION_HAS_MEM_MAP is cleared or can successfully access ->usage. >>>> c) Synchronize the rcu on the write side and free the ->usage. No >>>> attempt will be made to access ->usage after this as the >>>> SECTION_HAS_MEM_MAP is cleared thus valid_section() return false. >> >> >> This affects any kind of memory hotunplug. When hotunplugging memory we >> will end up calling synchronize_rcu() for each and every memory section, >> which sounds extremely wasteful. >> >> Can't we find a way to kfree_rcu() that thing and read/write the pointer >> using READ?ONCE?WRITE_ONCE instead? > > I am inspired to use the synchronize_rcu() because of [1] where we did > use it in offline_page_ext(). And my limited understanding is that, a > user can trigger the offline operation more often than the unplug operation. In theory yes. In practice there are not many use cases where we do that. Further, page_ext is already not used that frequently (page owner, young, idle tracking only), especially in most production (!debug) environments. > > I agree here that there is a scope to use kfree_rcu() unlike in [1]. Let > me check for a way to use it. Exactly, if we could use that, it would be ideal. -- Cheers, David / dhildenb