Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp33890lqh; Thu, 30 May 2024 13:05:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJgHpCPG9Zyeh6J8ODeTkGzVk5ITdls/+RdeuClJy4al5N7cjRbFPwNaBAgaQ1SkAY7pNkWCuPWKrZz2dk5pwOB3u+S2DMaGEMoJPjfQ== X-Google-Smtp-Source: AGHT+IGpp60k9SzcdzTxgZRMBCZCpvDbbkzdpI83qf4sZd8FtYfjnfqHS9vcxAxJN0tB8oTAWkbM X-Received: by 2002:a05:620a:4094:b0:792:bcc4:23de with SMTP id af79cd13be357-794e9dc031dmr432086785a.36.1717099549077; Thu, 30 May 2024 13:05:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717099549; cv=pass; d=google.com; s=arc-20160816; b=RDgGS9/YXjHQmX7DwHgcH6ri+e996OtsGJ2NeGafIF/+dFC47e0cdbkgMvZTnFrq0I OPrXlNjYWs6Tx4UyLco37vHJv9oYmtKO3aEIILturbCF5wU/LgKvyvBP0c20H1rm+pUZ MKNFZrWp6yn4socoDM91fp6xhJx93gCpoUiPqJzGloOeW6FGZH3ZYG1aK02GBJ4Z7Ar5 ZrFcQfVorXobGRAlincHNH3ka+42bLeh4kAdngwoqtVGwQvZ+mnT4dbhVmWN9I1t7Ycv 6JoG97sISe2bHSqXt4Yxv7Ct+OEo8e4U2dA3T1b1hJNrUybMECT4bFSUqbbwJ4cb0Dwd WkkA== 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 :subject:cc:to:from:date:dkim-signature; bh=8LAtmFegHwyHiShddEqtFydMRSngBCshlNojH0W+UyQ=; fh=4ZFbxgadT7ro7jB+v/5epOGSXF+73Vq0vlRf01PvljM=; b=mMjsUOB2rCryDANfqkrBarm4cwgNVpiw3fYioczWyyp+z139mr+w78wDDuK4tTYv6j 9bhE7UHv0Vme0E4fhZQJ6m3BbRIyO8bjkqvluge1Byb9aOL9vUf93ApWu2W68hxbIkH2 rAT0MRrm5SO2qIVIW537KoRy+CBpbJV9l4lq8xZGegoD3/4T8vkx7AMBGHh/Ys6HOnzj 1tDhbPxTiM+zSKEzYLie/ONEwy+joPcd6VWsn+vPBoIM0n0w6NDhadJl1LGTkB+cggnZ appnTAxDxKaWHYtHLvZKsittx8au45nB7GtUk2DOi4d728o8CEqQGjcPeLhTu403xhwK /sEQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=ButqOVXN; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-195852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195852-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794f32a73basi29856285a.654.2024.05.30.13.05.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 13:05:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=ButqOVXN; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-195852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195852-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C8B041C244FE for ; Thu, 30 May 2024 20:05:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1918A5589B; Thu, 30 May 2024 20:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="ButqOVXN" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3FD6418641 for ; Thu, 30 May 2024 20:05:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717099543; cv=none; b=A8lf9/PqZ8gFylb8UPC0I9JKlcK4K7WeT6fE6PotxZzCmSVizpvrNOhmhr0YXETwBsFeULdAwi4NjCXhlWi3+qAgm8wkTfOeUap/45BDUpItLUMCDoOGjU3565bluc+4vCpU3fRbUlAKsfiMW5mBrjbgCJZXFPCF+90xK3unMs4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717099543; c=relaxed/simple; bh=kRBwLlYCuKNk3Fl0J0lD/a6vXcmLqtYeu1cqzVACock=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=KmS/SSwJJjxU9C2jejiQfc9AM53Cry7i7mj0Uc3VHnWEvrQ9oiK08iIKmWy7m/qbES8satk7R1zj8t4G/M4Pf45pg41T8+Tdnd2kBC3TcqMSNLs3qXMGxEK2bu+egD4MDzdNmamN9kZyjkACtQMFlM4tWOAR9dsW6/a4YsKtdAk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=ButqOVXN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44CCAC2BBFC; Thu, 30 May 2024 20:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1717099542; bh=kRBwLlYCuKNk3Fl0J0lD/a6vXcmLqtYeu1cqzVACock=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ButqOVXNDS+TCCelEMmoNeITCkjmvKoaPnVCR1oqMNKRNyy/ojaP70KejUyYhVR5L oKgk0iKAshkcBnZeSMx2bLClJgskdhV22Jluwx6Z/GD9ykQferXI6Gr5borcBHpUK5 XWh5m37/X/nJIDKsQ9uu1OVUbgvb5O0MSlex87LA= Date: Thu, 30 May 2024 13:05:41 -0700 From: Andrew Morton To: Cc: , , , <21cnbao@gmail.com>, , , , , , "Hailong . Liu" Subject: Re: [RFC PATCH] mm/vmalloc: fix vbq->free breakage Message-Id: <20240530130541.c615fcfc1e6f211199315e13@linux-foundation.org> In-Reply-To: <20240530093108.4512-1-hailong.liu@oppo.com> References: <20240530093108.4512-1-hailong.liu@oppo.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 30 May 2024 17:31:08 +0800 wrote: > From: "hailong.liu" > > The function xa_for_each() in _vm_unmap_aliases() loops through all > vbs. However, since commit 062eacf57ad9 ("mm: vmalloc: remove a global > vmap_blocks xarray") the vb from xarray may not be on the corresponding > CPU vmap_block_queue. Consequently, purge_fragmented_block() might > use the wrong vbq->lock to protect the free list, leading to vbq->free > breakage. > > ... > > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -2269,10 +2269,9 @@ static void _vm_unmap_aliases(unsigned long start, unsigned long end, int flush) > for_each_possible_cpu(cpu) { > struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu); > struct vmap_block *vb; > - unsigned long idx; > > rcu_read_lock(); > - xa_for_each(&vbq->vmap_blocks, idx, vb) { > + list_for_each_entry_rcu(vb, &vbq->free, free_list) { > spin_lock(&vb->lock); > > /* > --- > https://lore.kernel.org/all/20240530025144.1570865-1-zhaoyang.huang@unisoc.com/ > BTW, zhangyang also encounter the same issue, maybe revert commit not a > better solution. we need a map to get vbq from vb. I borrowed the Fixes: from that patch and added cc:stable, pending confirmation that the runtime effects are significant.