Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp405983lqr; Wed, 5 Jun 2024 09:17:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYNLYKL4ah2bQFtD2clGB+wd7t6HXOl0LB/RURSvIqdzjvDWx+P/3vQm9ApwxjNux9nRln+VKh38c+XzQaiPnbH+gqUch6t2gZzmZjGA== X-Google-Smtp-Source: AGHT+IHvGAQSEuevrarYBn4AyiCw+W0RLl0xKBdtGGNyJmsViUo7UCCzp2f29gGaB+Q5Cw91wYgW X-Received: by 2002:a05:6512:4d9:b0:52b:2c64:1db0 with SMTP id 2adb3069b0e04-52bab4ea8bbmr2024131e87.40.1717604257961; Wed, 05 Jun 2024 09:17:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717604257; cv=pass; d=google.com; s=arc-20160816; b=S1yqY6QuvHmcVMKqBh0O6F0xBbZ0EAtF4z8pMZh3NGt56RgUSBtjIFjQ9o8gosp/2o Ew9lCxlwmnPkiJ74+fG1QUNRzXO2a/HiDRK8Ju3oBw42xJo9GuyyctuaOQKrGkCqP8XV gf/EawYpT8IOa+neMw2VHultza3gSnvdblFsm5TwMEewLulAFb6AG/6nUkNUPG/rnA18 8dXoPpUwDuHnhHest7/jEK2IfGyIHr3tzYD8yFiEzTUGM8CVqT38AO8Y4gwK8vH4Iuh6 JB9pIPr81pYGUpsyAZE7jDE9QCDxUqSC/YQvPg/J2/sZWrVDEODKdQUQDQgtU0wMxqmB F4TQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=cWV8Lo8WLzhgwKW8jLwqp32oyRHSZADB4Op3hCnu5O4=; fh=A5R+RJ8xGJ9o5SQyytGehusYuTWTEsvFH0nsrTyXce0=; b=KVvjQz1w2Rkl5eC2nAhsM9F724tZEvNFx7HeSoXnAVcbVYJSqeXqYXwlYRnS1+uP97 3ls9oEGDPxJj3D1SjSYEk+R5vzCDI34oDkX753gnDV3HyhXmuX4zxahzWDQvaCNusPJ7 2YNociNwm8+6RdtfCTKO9VoaJgMnSEIrAbe1u785b47MxlguRxxryvT/R93KcvXL10pH 2l3OnpipoPQj7aPYQ571zn0Uve1sJleWpt3z8hRljFwIbQae2/wk2tTSAoSZMIEjPlq0 IRLLXKhXsEQfId0P5ExxGM4m5SsuBfE5y+IDIVeRzr8WzHOwQvQKQCfQtulbnlVbnY2G zIdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UVdcynoV; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-202902-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202902-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31b8f4f1si6320769a12.132.2024.06.05.09.17.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 09:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202902-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=@redhat.com header.s=mimecast20190719 header.b=UVdcynoV; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-202902-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202902-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 7F5411F2868B for ; Wed, 5 Jun 2024 16:17:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05A891527B5; Wed, 5 Jun 2024 16:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UVdcynoV" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 C2FB819D899 for ; Wed, 5 Jun 2024 16:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717604248; cv=none; b=fi/5Zf28LVPyhIlVsFIP7Djmq4Jkz/UBhF2/8WQn1zcEmApA2UzGtvatKAqdsfbQC4ymwQFij8SiMjHh7q8rdgLVMNt17nKF51WBlX/OU5s/EgIjm1GbyFRzT2X5e4VfOa0C9hpNA5MSFGz0Ooihf8Pgm0eDTJsNkfZM1i/TW90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717604248; c=relaxed/simple; bh=XCKqjztYR9+IKBnfTAp3qkdWxzvX3tjFJRwRcXyy0wU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bAtm5CRnlFbylHtzVSaS3NqWdz6UeWrZMYu5awhTSrRmK6we2yc+7mqlsUvqHtr/fRGMbvjjOgXZnXdDKE1hYaFKIGtlhM3xg03p1qfhCKAdz1PSH7HcvCT2z6GvgyMzqHncR34588buNsTFEK3L0Fqw/m1OJqwFnGVZvr6RhYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UVdcynoV; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717604245; 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=cWV8Lo8WLzhgwKW8jLwqp32oyRHSZADB4Op3hCnu5O4=; b=UVdcynoVSUeS5TQd1QHm1TQVEARh3bDuNHf7zMphRJREYRMlItRHl17mR84scWRsem5zXs lLYiz99oXCcEvKYy1+oPMvACgNC9woUqrP+YK4B3/zCss6OtL4xu1Xz0t/U0rpQRb9aBZA Wvv2/INyv0940L7Nh+0+ZJaBztPdJyE= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-PkGIgM6YMnitWy1f_yomnQ-1; Wed, 05 Jun 2024 12:17:15 -0400 X-MC-Unique: PkGIgM6YMnitWy1f_yomnQ-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2eaaae3e600so59971fa.0 for ; Wed, 05 Jun 2024 09:17:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717604231; x=1718209031; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=cWV8Lo8WLzhgwKW8jLwqp32oyRHSZADB4Op3hCnu5O4=; b=oB/pIdxVJNd+jR0roVYYGcrVRGOnyp/oQx9HnKYkuWzE9xGk+1CF94qM73h9KMPCB+ wpikevVfRb/vw+w2PidvKUmueS/dhlyTppwPqnIP1o1C2P/4NKinPnkH3EI216OmWmHY psUOaxspFpQNmbNA26wAL3BPdlhROqC1txv6sUrNcmujWD+emJVs+un0NZXkrZ8F8VZY u4L+XR8Jwzu2h/iyt5TLPgsvjTBo+fNt49cMiGipMF687NViSNDsMKQ6NCT3reG8bwYU fBr47ULmhYM8A2au786XUcBNfEx9Jdi41j9/veBREuYa601Eo5yV44g2fj1NDLMPx+/g O7Ow== X-Forwarded-Encrypted: i=1; AJvYcCUO8JOcacBztsYI5X9o2CJi7NKuegRdtW7rvVGPyxtR/7sUSQhIatOkb/P4azzNiH6dgLIM8VzVPkcXDgV5awJugNXGmT+AqLUuVj/t X-Gm-Message-State: AOJu0YzXKZlAaU/GjbX0VyuQE7AQyIqm908o8ROXKQPDW4jomNxabqOK iqWX2u49xxHMpTb1uG7yLgejs9xsSKI4f99N6kYcY65dzgLPmyU5GLBPAjbfIDfrLBaB5u6w7rO IvdGpZOAn+N2sSfr2qFWqUqSY9yYdlIoMiyecnR4q5QGqjvsjpCOzI4zcKt0ddg== X-Received: by 2002:a2e:9015:0:b0:2e2:a85f:f222 with SMTP id 38308e7fff4ca-2eac79bffd6mr21905211fa.10.1717604231459; Wed, 05 Jun 2024 09:17:11 -0700 (PDT) X-Received: by 2002:a2e:9015:0:b0:2e2:a85f:f222 with SMTP id 38308e7fff4ca-2eac79bffd6mr21904871fa.10.1717604230954; Wed, 05 Jun 2024 09:17:10 -0700 (PDT) Received: from ?IPV6:2003:cb:c706:3100:19a8:d898:8e69:6aff? (p200300cbc706310019a8d8988e696aff.dip0.t-ipconnect.de. [2003:cb:c706:3100:19a8:d898:8e69:6aff]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42158148f91sm28767755e9.30.2024.06.05.09.17.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Jun 2024 09:17:10 -0700 (PDT) Message-ID: <6089ccc4-1fb7-4934-b119-253aa246a2dd@redhat.com> Date: Wed, 5 Jun 2024 18:17:09 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] mm: page_ref: remove folio_try_get_rcu() To: Yang Shi , Peter Xu Cc: oliver.sang@intel.com, paulmck@kernel.org, willy@infradead.org, riel@surriel.com, vivek.kasireddy@intel.com, cl@linux.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20240604234858.948986-1-yang@os.amperecomputing.com> <58f249cf-c2a9-429b-871d-15584ed37956@os.amperecomputing.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/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OKAb5eOS8h+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: <58f249cf-c2a9-429b-871d-15584ed37956@os.amperecomputing.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 05.06.24 18:16, Yang Shi wrote: > > > On 6/5/24 8:25 AM, Peter Xu wrote: >> On Tue, Jun 04, 2024 at 04:48:57PM -0700, Yang Shi wrote: >>> The below bug was reported on a non-SMP kernel: >>> >>> [ 275.267158][ T4335] ------------[ cut here ]------------ >>> [ 275.267949][ T4335] kernel BUG at include/linux/page_ref.h:275! >>> [ 275.268526][ T4335] invalid opcode: 0000 [#1] KASAN PTI >>> [ 275.269001][ T4335] CPU: 0 PID: 4335 Comm: trinity-c3 Not tainted 6.7.0-rc4-00061-gefa7df3e3bb5 #1 >>> [ 275.269787][ T4335] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 >>> [ 275.270679][ T4335] RIP: 0010:try_get_folio (include/linux/page_ref.h:275 (discriminator 3) mm/gup.c:79 (discriminator 3)) >>> [ 275.272813][ T4335] RSP: 0018:ffffc90005dcf650 EFLAGS: 00010202 >>> [ 275.273346][ T4335] RAX: 0000000000000246 RBX: ffffea00066e0000 RCX: 0000000000000000 >>> [ 275.274032][ T4335] RDX: fffff94000cdc007 RSI: 0000000000000004 RDI: ffffea00066e0034 >>> [ 275.274719][ T4335] RBP: ffffea00066e0000 R08: 0000000000000000 R09: fffff94000cdc006 >>> [ 275.275404][ T4335] R10: ffffea00066e0037 R11: 0000000000000000 R12: 0000000000000136 >>> [ 275.276106][ T4335] R13: ffffea00066e0034 R14: dffffc0000000000 R15: ffffea00066e0008 >>> [ 275.276790][ T4335] FS: 00007fa2f9b61740(0000) GS:ffffffff89d0d000(0000) knlGS:0000000000000000 >>> [ 275.277570][ T4335] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 >>> [ 275.278143][ T4335] CR2: 00007fa2f6c00000 CR3: 0000000134b04000 CR4: 00000000000406f0 >>> [ 275.278833][ T4335] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 >>> [ 275.279521][ T4335] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 >>> [ 275.280201][ T4335] Call Trace: >>> [ 275.280499][ T4335] >>> [ 275.280751][ T4335] ? die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434 arch/x86/kernel/dumpstack.c:447) >>> [ 275.281087][ T4335] ? do_trap (arch/x86/kernel/traps.c:112 arch/x86/kernel/traps.c:153) >>> [ 275.281463][ T4335] ? try_get_folio (include/linux/page_ref.h:275 (discriminator 3) mm/gup.c:79 (discriminator 3)) >>> [ 275.281884][ T4335] ? try_get_folio (include/linux/page_ref.h:275 (discriminator 3) mm/gup.c:79 (discriminator 3)) >>> [ 275.282300][ T4335] ? do_error_trap (arch/x86/kernel/traps.c:174) >>> [ 275.282711][ T4335] ? try_get_folio (include/linux/page_ref.h:275 (discriminator 3) mm/gup.c:79 (discriminator 3)) >>> [ 275.283129][ T4335] ? handle_invalid_op (arch/x86/kernel/traps.c:212) >>> [ 275.283561][ T4335] ? try_get_folio (include/linux/page_ref.h:275 (discriminator 3) mm/gup.c:79 (discriminator 3)) >>> [ 275.283990][ T4335] ? exc_invalid_op (arch/x86/kernel/traps.c:264) >>> [ 275.284415][ T4335] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:568) >>> [ 275.284859][ T4335] ? try_get_folio (include/linux/page_ref.h:275 (discriminator 3) mm/gup.c:79 (discriminator 3)) >>> [ 275.285278][ T4335] try_grab_folio (mm/gup.c:148) >>> [ 275.285684][ T4335] __get_user_pages (mm/gup.c:1297 (discriminator 1)) >>> [ 275.286111][ T4335] ? __pfx___get_user_pages (mm/gup.c:1188) >>> [ 275.286579][ T4335] ? __pfx_validate_chain (kernel/locking/lockdep.c:3825) >>> [ 275.287034][ T4335] ? mark_lock (kernel/locking/lockdep.c:4656 (discriminator 1)) >>> [ 275.287416][ T4335] __gup_longterm_locked (mm/gup.c:1509 mm/gup.c:2209) >>> [ 275.288192][ T4335] ? __pfx___gup_longterm_locked (mm/gup.c:2204) >>> [ 275.288697][ T4335] ? __pfx_lock_acquire (kernel/locking/lockdep.c:5722) >>> [ 275.289135][ T4335] ? __pfx___might_resched (kernel/sched/core.c:10106) >>> [ 275.289595][ T4335] pin_user_pages_remote (mm/gup.c:3350) >>> [ 275.290041][ T4335] ? __pfx_pin_user_pages_remote (mm/gup.c:3350) >>> [ 275.290545][ T4335] ? find_held_lock (kernel/locking/lockdep.c:5244 (discriminator 1)) >>> [ 275.290961][ T4335] ? mm_access (kernel/fork.c:1573) >>> [ 275.291353][ T4335] process_vm_rw_single_vec+0x142/0x360 >>> [ 275.291900][ T4335] ? __pfx_process_vm_rw_single_vec+0x10/0x10 >>> [ 275.292471][ T4335] ? mm_access (kernel/fork.c:1573) >>> [ 275.292859][ T4335] process_vm_rw_core+0x272/0x4e0 >>> [ 275.293384][ T4335] ? hlock_class (arch/x86/include/asm/bitops.h:227 arch/x86/include/asm/bitops.h:239 include/asm-generic/bitops/instrumented-non-atomic.h:142 kernel/locking/lockdep.c:228) >>> [ 275.293780][ T4335] ? __pfx_process_vm_rw_core+0x10/0x10 >>> [ 275.294350][ T4335] process_vm_rw (mm/process_vm_access.c:284) >>> [ 275.294748][ T4335] ? __pfx_process_vm_rw (mm/process_vm_access.c:259) >>> [ 275.295197][ T4335] ? __task_pid_nr_ns (include/linux/rcupdate.h:306 (discriminator 1) include/linux/rcupdate.h:780 (discriminator 1) kernel/pid.c:504 (discriminator 1)) >>> [ 275.295634][ T4335] __x64_sys_process_vm_readv (mm/process_vm_access.c:291) >>> [ 275.296139][ T4335] ? syscall_enter_from_user_mode (kernel/entry/common.c:94 kernel/entry/common.c:112) >>> [ 275.296642][ T4335] do_syscall_64 (arch/x86/entry/common.c:51 (discriminator 1) arch/x86/entry/common.c:82 (discriminator 1)) >>> [ 275.297032][ T4335] ? __task_pid_nr_ns (include/linux/rcupdate.h:306 (discriminator 1) include/linux/rcupdate.h:780 (discriminator 1) kernel/pid.c:504 (discriminator 1)) >>> [ 275.297470][ T4335] ? lockdep_hardirqs_on_prepare (kernel/locking/lockdep.c:4300 kernel/locking/lockdep.c:4359) >>> [ 275.297988][ T4335] ? do_syscall_64 (arch/x86/include/asm/cpufeature.h:171 arch/x86/entry/common.c:97) >>> [ 275.298389][ T4335] ? lockdep_hardirqs_on_prepare (kernel/locking/lockdep.c:4300 kernel/locking/lockdep.c:4359) >>> [ 275.298906][ T4335] ? do_syscall_64 (arch/x86/include/asm/cpufeature.h:171 arch/x86/entry/common.c:97) >>> [ 275.299304][ T4335] ? do_syscall_64 (arch/x86/include/asm/cpufeature.h:171 arch/x86/entry/common.c:97) >>> [ 275.299703][ T4335] ? do_syscall_64 (arch/x86/include/asm/cpufeature.h:171 arch/x86/entry/common.c:97) >>> [ 275.300115][ T4335] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:129) >>> >>> This BUG is the VM_BUG_ON(!in_atomic() && !irqs_disabled()) assertion in >>> folio_ref_try_add_rcu() for non-SMP kernel. >>> >>> The process_vm_readv() calls GUP to pin the THP. An optimization for >>> pinning THP instroduced by commit 57edfcfd3419 ("mm/gup: accelerate thp >>> gup even for "pages != NULL"") calls try_grab_folio() to pin the THP, >>> but try_grab_folio() is supposed to be called in atomic context for >>> non-SMP kernel, for example, irq disabled or preemption disabled, due to >>> the optimization introduced by commit e286781d5f2e ("mm: speculative >>> page references"). >>> >>> The commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP >>> boundaries") is not actually the root cause although it was bisected to. >>> It just makes the problem exposed more likely. >>> >>> The follow up discussion suggested the optimization for non-SMP kernel >>> may be out-dated and not worth it anymore [1]. So removing the >>> optimization to silence the BUG. >>> >>> However calling try_grab_folio() in GUP slow path actually is >>> unnecessary, so the following patch will clean this up. >>> >>> [1] https://lore.kernel.org/linux-mm/821cf1d6-92b9-4ac4-bacc-d8f2364ac14f@paulmck-laptop/ >>> Fixes: 57edfcfd3419 ("mm/gup: accelerate thp gup even for "pages != NULL"") >>> Reported-by: kernel test robot >>> Cc: linux-stable v6.6+ >>> Signed-off-by: Yang Shi >> Just to mention, IMHO it'll still be nicer if we keep the 1st fix patch >> only have the folio_ref_try_add_rcu() changes, it'll be easier for >> backport. >> >> Now this patch contains not only that but also logically a cleanup patch >> that replaces old rcu calls to folio_try_get(). But squashing these may >> mean we need explicit backport to 6.6 depending on whether those lines >> changed, meanwhile the cleanup part may not be justfied to be backported in >> the first place. I'll leave that to you to decide, no strong feelings here. > > Neither do I. But I slightly prefer have the patch as is for mainline > since removing the #ifdef and the clean up lead by it seems > self-contained and naturally integral. If it can not be applied to > stable tree without conflict, I can generate a separate patch for stable > tree with the removing #ifdef part. The effort should be trivial. Agreed Acked-by: David Hildenbrand -- Cheers, David / dhildenb