Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp257735lqp; Mon, 10 Jun 2024 03:15:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQFK/Drwaz5R/gg2+3ncfHgbJG5eZ2SG7g443Ukfhlqp57hGwMYdz+o8sAqUlpcHzrxVoT8S2Gq67wJO0bmvBk+CIwKU8xbYmgmz8HyA== X-Google-Smtp-Source: AGHT+IEGA03t1Ug8QWnZCL9wravSaDDXilqIgNLbGygodzpQdDpoUNWa5IIyGoNfg7UUVBudHdMS X-Received: by 2002:aa7:8890:0:b0:702:2749:6096 with SMTP id d2e1a72fcca58-7040c63824fmr9108450b3a.11.1718014518324; Mon, 10 Jun 2024 03:15:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718014518; cv=pass; d=google.com; s=arc-20160816; b=vSWGWj/r2IRDO3FJsc+WDGvprzdWTYiTVpSHDXsa7nQ3yyeZWYqx8rFYgb6LnvvwQP vmh2MtnY7+/HZsOKsA5tcQWiyo3Z/9clTT9BPpHgu0aVYnJ7YSi7wnlnLIOu+T5oT4ip 0wHQNtuVLDIhUUYhvsRtm1WvGOnpkBbHSk82qF2sOKwNEPnSJ00aOEbn7lYQOB5yOWWV c+B6abkOH2dxrBE0ON01l3ZuKwhh6D3U1yufm7DyCkiHtyGLCFCSPoaAWm8K19nG+j8m q0Fm1EZcVDRh8lRJELm2/OtxyFmA15lZqQ7HneLH67DF7eSj5nFWVDRnkmgw8uNRTAi4 kTlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=K9SAkSrE3zzak5OnWnfEIMtwqLWcD8Osrm8qqk7cBLs=; fh=/2xGxBF51UMRwj2/fzc64FHD5WB28q0B6qaUWdIoSJA=; b=gPh1tmQqS2JrDUfc5/PcXknnKr7y4NCTZcIp9/MWQ1+D/aFQHyPX3fJcpalzEcd+tK +jAif4mf3vSBB/fbVVeZ9zQF0fIQOFOYa0240UHKZg8kFk7n2COpXh69cc6Sg7M3Qtx8 V8AqmKuH4jG/joowssjejIQydfYikL5wFyMygB0DniP24u1AJnGBVx2F9V1iZvaAURVl PC3Z5LCYSOR5ufFkJzRMAi5KQxJ74poC4bB1yKxVVyJMyVXoLRYmvlyq5Yx7Vd/XlNGW /c7hq8dLBJySDJ38+WLv6fqYsb5ARnMaCcMCE1PF2xTTfQnhGZs+8BhyFPen5mB7h8LY ec1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-207959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207959-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de297dcb41si7230060a12.732.2024.06.10.03.15.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 03:15:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-207959-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207959-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E21DCB24537 for ; Mon, 10 Jun 2024 09:44:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADEFF757E3; Mon, 10 Jun 2024 09:43:52 +0000 (UTC) Received: from mail115-24.sinamail.sina.com.cn (mail115-24.sinamail.sina.com.cn [218.30.115.24]) (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 3EF517406A for ; Mon, 10 Jun 2024 09:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.24 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718012632; cv=none; b=mKMkiVnMClM5AxMcJ1EPGbUzhMcQT9+T9Qv/WLtjnqjJVvoAMqgKYbZrI26vJGq+oNy01/R/KjxF1woarsJw/ZSba516TPuQ6OpuSj46MVTqE7i2qGPYIzbgymSkeNpn7iHj4dSUog7o//+c4LTDpuOg8EOs6mvhBzaYCFJY8p8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718012632; c=relaxed/simple; bh=VDzE3RSwnrxU/yC/vUrKtkweZzQ3kekLxfWWailNru4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ii2VuU3mIy4CNJBDkXC9KeBDGO7DHGGgFSMx190yYa8KZNZKEQXpicSCMhCubyEK1Qc7BHXQKoFPVkX7Xb/t3ForVEb5FL4IkEzj0Ljorsn7dLULDDe4pZO0CwCabVBDvMDTm985AkT6o8Wlggco8gfguhWyMJu0M26SOmkl3NE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.88.51.173]) by sina.com (10.75.12.45) with ESMTP id 6666CAC600006219; Mon, 10 Jun 2024 17:43:37 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 40054931457759 X-SMAIL-UIID: 3FB5AC4B5CAB4E03AA8A8F19874F619D-20240610-174337-1 From: Hillf Danton To: Venkat Rao Bagalkote Cc: kbusch@kernel.org, sagi@grimberg.me, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, sachinp@linux.vnet.com Subject: Re: Kernel OOPS while creating a NVMe Namespace Date: Mon, 10 Jun 2024 17:43:25 +0800 Message-Id: <20240610094325.2156-1-hdanton@sina.com> In-Reply-To: <2312e6c3-a069-4388-a863-df7e261b9d70@linux.vnet.ibm.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Mon, 10 Jun 2024 13:21:00 +0530 Venkat Rao Bagalkote wrote: > Greetings!!! > > Observing Kernel OOPS, while creating namespace on a NVMe device. > > [ 140.209777] BUG: Unable to handle kernel data access at > 0x18d7003065646fee > [ 140.209792] Faulting instruction address: 0xc00000000023b45c > [ 140.209798] Oops: Kernel access of bad area, sig: 11 [#1] > [ 140.209802] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=8192 NUMA pSeries > [ 140.209809] Modules linked in: rpadlpar_io rpaphp xsk_diag > nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet > nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat > bonding nf_conntrack tls nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set > nf_tables nfnetlink vmx_crypto pseries_rng binfmt_misc fuse xfs > libcrc32c sd_mod sg ibmvscsi scsi_transport_srp ibmveth nvme nvme_core > t10_pi crc64_rocksoft_generic crc64_rocksoft crc64 > [ 140.209864] CPU: 2 PID: 129 Comm: kworker/u65:3 Kdump: loaded Not > tainted 6.10.0-rc3 #2 > [ 140.209870] Hardware name: IBM,9009-42A POWER9 (raw) 0x4e0202 > 0xf000005 of:IBM,FW950.A0 (VL950_141) hv:phyp pSeries > [ 140.209876] Workqueue: nvme-wq nvme_scan_work [nvme_core] > [ 140.209889] NIP: c00000000023b45c LR: c008000006a96b20 CTR: > c00000000023b42c > [ 140.209894] REGS: c0000000506078a0 TRAP: 0380 Not tainted (6.10.0-rc3) > [ 140.209899] MSR: 800000000280b033 > CR: 24000244 XER: 00000000 > [ 140.209915] CFAR: c008000006aa80ac IRQMASK: 0 > [ 140.209915] GPR00: c008000006a96b20 c000000050607b40 c000000001573700 > c000000004291ee0 > [ 140.209915] GPR04: 0000000000000000 c000000006150080 00000000c0080005 > fffffffffffe0000 > [ 140.209915] GPR08: 0000000000000000 18d7003065646f6e 0000000000000000 > c008000006aa8098 > [ 140.209915] GPR12: c00000000023b42c c00000000f7cdf00 c0000000001a151c > c000000004f2be80 > [ 140.209915] GPR16: 0000000000000000 0000000000000000 0000000000000000 > 0000000000000000 > [ 140.209915] GPR20: c000000004dbcc00 0000000000000006 0000000000000002 > c000000004911270 > [ 140.209915] GPR24: 0000000000000000 0000000000000000 c0000000ee254ffc > c0000000049111f0 > [ 140.209915] GPR28: 0000000000000000 c000000004911260 c000000004291ee0 > c000000004911260 > [ 140.209975] NIP [c00000000023b45c] synchronize_srcu+0x30/0x1c0 > [ 140.209984] LR [c008000006a96b20] nvme_ns_remove+0x80/0x2d8 [nvme_core] > [ 140.209994] Call Trace: > [ 140.209997] [c000000050607b90] [c008000006a96b20] > nvme_ns_remove+0x80/0x2d8 [nvme_core] > [ 140.210008] [c000000050607bd0] [c008000006a972b4] > nvme_remove_invalid_namespaces+0x144/0x1ac [nvme_core] > [ 140.210020] [c000000050607c60] [c008000006a9dbd4] > nvme_scan_ns_list+0x19c/0x370 [nvme_core] > [ 140.210032] [c000000050607d70] [c008000006a9dfc8] > nvme_scan_work+0xc8/0x278 [nvme_core] > [ 140.210043] [c000000050607e40] [c00000000019414c] > process_one_work+0x20c/0x4f4 > [ 140.210051] [c000000050607ef0] [c0000000001950cc] > worker_thread+0x378/0x544 > [ 140.210058] [c000000050607f90] [c0000000001a164c] kthread+0x138/0x140 > [ 140.210065] [c000000050607fe0] [c00000000000df98] > start_kernel_thread+0x14/0x18 > [ 140.210072] Code: 3c4c0134 384282d4 7c0802a6 60000000 7c0802a6 > fbc1fff0 fba1ffe8 fbe1fff8 7c7e1b78 f8010010 f821ffb1 e9230010 > 7c2004ac 71290003 41820008 > [ 140.210093] ---[ end trace 0000000000000000 ]--- > > > Issue is introduced by the patch: be647e2c76b27f409cdd520f66c95be888b553a3. > > Reverting it, issue is not seen. See if refcnt leak existed before be647e2c76b2 --- x/drivers/nvme/host/core.c +++ y/drivers/nvme/host/core.c @@ -4078,6 +4078,7 @@ static void nvme_scan_work(struct work_s return; } + nvme_get_ctrl(ctrl); if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) { dev_info(ctrl->device, "rescanning namespaces.\n"); nvme_clear_changed_ns_log(ctrl); @@ -4097,6 +4098,7 @@ static void nvme_scan_work(struct work_s nvme_scan_ns_sequential(ctrl); } mutex_unlock(&ctrl->scan_lock); + nvme_put_ctrl(ctrl); } /* --