From nobody Fri Dec 19 06:19:17 2025 Received: from h3cspam02-ex.h3c.com (smtp.h3c.com [60.191.123.50]) (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 4D5DD15E88 for ; Mon, 1 Jul 2024 02:49:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.191.123.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719802183; cv=none; b=NDC5DhxSUcV/Fl/xq+ZI1iS1nBGSoAKBFfWCakRkdRVCiKFikf3fKvWMMYvhOIpTBfSK4outSsrZOzEkmnMcgz+Q3UXNrmN5Dd5n34C8dQGeEjjWRMOx8IWkdZbUJFfWvyXPHqT5Q8wnjlyHLNmKwrGFWUw7t4wEywK2WcGvOGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719802183; c=relaxed/simple; bh=K+txfgIBDiC5EBu9Tyu6qcr21MebyAoTXTIWB1FfFmA=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=AgOTgmCPrn5rO129XIfNFE7EZsWi7taEf3KJQTCdEOoleRv/gUDzYGfCmbWR+udZ9vdzhnLRdNV0eK2/jJkzadKbLc/zqPe03lZb9bjyEW8SCsHPZl1jZm+8jf3WNKkrRNhcY1zARhGvwMCvM4ZJJzWuDb3xIGVNxhX7QTK7sWA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=h3c.com; spf=pass smtp.mailfrom=h3c.com; arc=none smtp.client-ip=60.191.123.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=h3c.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=h3c.com Received: from h3cspam02-ex.h3c.com (localhost [127.0.0.2] (may be forged)) by h3cspam02-ex.h3c.com with ESMTP id 4611lFwP029898 for ; Mon, 1 Jul 2024 09:47:15 +0800 (GMT-8) (envelope-from zhang.chunA@h3c.com) Received: from mail.maildlp.com ([172.25.15.154]) by h3cspam02-ex.h3c.com with ESMTP id 4611jvHJ024589; Mon, 1 Jul 2024 09:45:57 +0800 (GMT-8) (envelope-from zhang.chunA@h3c.com) Received: from DAG6EX11-BJD.srv.huawei-3com.com (unknown [10.153.34.13]) by mail.maildlp.com (Postfix) with ESMTP id 07A032004BBD; Mon, 1 Jul 2024 09:49:59 +0800 (CST) Received: from DAG6EX09-BJD.srv.huawei-3com.com (10.153.34.11) by DAG6EX11-BJD.srv.huawei-3com.com (10.153.34.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.27; Mon, 1 Jul 2024 09:45:58 +0800 Received: from DAG6EX09-BJD.srv.huawei-3com.com ([fe80::bdc5:ad7:2347:12a5]) by DAG6EX09-BJD.srv.huawei-3com.com ([fe80::bdc5:ad7:2347:12a5%4]) with mapi id 15.02.1258.027; Mon, 1 Jul 2024 09:45:58 +0800 From: Zhangchun To: "shaohaojize@126.com" , "akpm@linux-foundation.org" , "linux-mm@kvack.org" CC: "linux-kernel@vger.kernel.org" , Jiaoxupo , Bailin , Zhangzhansheng , "linux-mm@kvack.org" , wangyu Subject: [PATCH] mm: fix kmap_high deadlock Thread-Topic: [PATCH] mm: fix kmap_high deadlock Thread-Index: AdrLWGWcTXIJ41leRoK9JQLjgSju3w== Date: Mon, 1 Jul 2024 01:45:57 +0000 Message-ID: <079f7b0b129f4fbc86d5f5ee8795fd1b@h3c.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-sender-location: DAG2 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: h3cspam02-ex.h3c.com 4611lFwP029898 From: "zhang.chun" I work with zhangzhansheng(from h3c) find that some situation may casue dea= dlock when we use kmap_highand kmap_XXX or kumap_xxx between differt cores= at the same time.kmap_high->map_new_virtual-> flush_all_zero_pkmaps->flush= _tlb_kernel_range->on_each_cpu, On this condition, kmap_high hold the kmap_lock=EF=BC=8C wait the other cores ack. But the others may di= sable irq and wait kmap_lock=EF=BC=8C this is some deadlock condition. I think it's necessary to give kmap_lock before call flush_tlb_kernel_range. Like this: spin_unlock(&kmap_lock); flush_tlb_kernel_range(xxx); spin_lock(&kmap_lock); Signed-off-by: zhang.chun --- mm/highmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/highmem.c b/mm/highmem.c index bd48ba445dd4..12d20e551579 1= 00644 --- a/mm/highmem.c +++ b/mm/highmem.c @@ -221,7 +221,9 @@ static void flush_all_zero_pkmaps(void) need_flush =3D 1; } if (need_flush) +spin_unlock(&kmap_lock); flush_tlb_kernel_range(PKMAP_ADDR(0), PKMAP_ADDR(LAST_PKMAP)); +spin_lock(&kmap_lock); } void __kmap_flush_unused(void) -- 2.34.1 ---------------------------------------------------------------------------= ---------------------------------------------------------- =E6=9C=AC=E9=82=AE=E4=BB=B6=E5=8F=8A=E5=85=B6=E9=99=84=E4=BB=B6=E5=90=AB=E6= =9C=89=E6=96=B0=E5=8D=8E=E4=B8=89=E9=9B=86=E5=9B=A2=E7=9A=84=E4=BF=9D=E5=AF= =86=E4=BF=A1=E6=81=AF=EF=BC=8C=E4=BB=85=E9=99=90=E4=BA=8E=E5=8F=91=E9=80=81= =E7=BB=99=E4=B8=8A=E9=9D=A2=E5=9C=B0=E5=9D=80=E4=B8=AD=E5=88=97=E5=87=BA =E7=9A=84=E4=B8=AA=E4=BA=BA=E6=88=96=E7=BE=A4=E7=BB=84=E3=80=82=E7=A6=81=E6= =AD=A2=E4=BB=BB=E4=BD=95=E5=85=B6=E4=BB=96=E4=BA=BA=E4=BB=A5=E4=BB=BB=E4=BD= =95=E5=BD=A2=E5=BC=8F=E4=BD=BF=E7=94=A8=EF=BC=88=E5=8C=85=E6=8B=AC=E4=BD=86= =E4=B8=8D=E9=99=90=E4=BA=8E=E5=85=A8=E9=83=A8=E6=88=96=E9=83=A8=E5=88=86=E5= =9C=B0=E6=B3=84=E9=9C=B2=E3=80=81=E5=A4=8D=E5=88=B6=E3=80=81 =E6=88=96=E6=95=A3=E5=8F=91=EF=BC=89=E6=9C=AC=E9=82=AE=E4=BB=B6=E4=B8=AD=E7= =9A=84=E4=BF=A1=E6=81=AF=E3=80=82=E5=A6=82=E6=9E=9C=E6=82=A8=E9=94=99=E6=94= =B6=E4=BA=86=E6=9C=AC=E9=82=AE=E4=BB=B6=EF=BC=8C=E8=AF=B7=E6=82=A8=E7=AB=8B= =E5=8D=B3=E7=94=B5=E8=AF=9D=E6=88=96=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5=E5= =8F=91=E4=BB=B6=E4=BA=BA=E5=B9=B6=E5=88=A0=E9=99=A4=E6=9C=AC =E9=82=AE=E4=BB=B6=EF=BC=81 This e-mail and its attachments contain confidential information from New H= 3C, which is intended only for the person or entity whose address is listed above. Any u= se of the information contained herein in any way (including, but not limited to, tot= al or partial disclosure, reproduction, or dissemination) by persons other than the inten= ded recipient(s) is prohibited. If you receive this e-mail in error, please not= ify the sender by phone or email immediately and delete it!