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 AB814C433F5 for ; Mon, 4 Apr 2022 15:12:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DD3E6B0074; Mon, 4 Apr 2022 11:12:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 38BF76B0075; Mon, 4 Apr 2022 11:12:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 205FB6B0078; Mon, 4 Apr 2022 11:12:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id 132A06B0074 for ; Mon, 4 Apr 2022 11:12:15 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CD96C18289591 for ; Mon, 4 Apr 2022 15:12:04 +0000 (UTC) X-FDA: 79319536968.20.1D7D383 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf17.hostedemail.com (Postfix) with ESMTP id 250B34002E for ; Mon, 4 Apr 2022 15:12:03 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649085121; 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: in-reply-to:in-reply-to:references:references; bh=g4qpBtfBpRV9+sYYTLKcPsW2aHhtZIHLbdXJYuan7xs=; b=FF+ghTrcFh7nCF26TMHsl6eQ8yDsB84O8NcRizr7XGSzHSrJnoi9aDYKx8M21VMUhYKEwn RjIC4vRzNmMeEJZ2SPWYikZu5ZPAeZEQ3Vz1MlEl4vp6OWgcjFX09PKidrEuZPbcoZO8vY wLw/vCcK4xropcX1kudGVe/io8rrukx6kdKyUc/bpioxDbiXfco8FCAqwbmwxTbWaqXgcT QNP6SZ6WhMilKodw2G87HI3OMG0rQipQNEbZEny0b4a64TuoEuexm3+hDdtq/CwYyLIOIp gsc95VZHMN+t8zQpbhlxoKYDGcPgzOwPwYVtMWnCr+1r4/WZLRJxkOn7cuWHcQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649085121; 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: in-reply-to:in-reply-to:references:references; bh=g4qpBtfBpRV9+sYYTLKcPsW2aHhtZIHLbdXJYuan7xs=; b=Xp6zglkLekmbbzNgaazqdz5IJ0Q4woe8gnmHLB3ZOuQPDnMup/r7ezqo9inSN6d+jv7s46 2CVJ8Dv0FThB4FBA== To: Max Filippov Cc: "Peter Zijlstra (Intel)" , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Max Filippov Subject: Re: [PATCH] highmem: fix checks in __kmap_local_sched_{in,out} In-Reply-To: <20220403235159.3498065-1-jcmvbkbc@gmail.com> References: <20220403235159.3498065-1-jcmvbkbc@gmail.com> Date: Mon, 04 Apr 2022 17:12:01 +0200 Message-ID: <878rskj326.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=FF+ghTrc; dkim=pass header.d=linutronix.de header.s=2020e header.b=Xp6zglkL; spf=pass (imf17.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-Stat-Signature: 6kwmw981bdn74gxkba6wbp9ine53ddby X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 250B34002E X-HE-Tag: 1649085123-628886 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 Sun, Apr 03 2022 at 16:51, Max Filippov wrote: > When CONFIG_DEBUG_KMAP_LOCAL is enabled __kmap_local_sched_{in,out} > check that even slots in the tsk->kmap_ctrl.pteval are unmapped. The > slots are initialized with 0 value, but the check is done with pte_none. > 0 pte however does not necessarily mean that pte_none will return true. > e.g. on xtensa it returns false, resulting in the following runtime > warnings: > > WARNING: CPU: 0 PID: 101 at mm/highmem.c:627 __kmap_local_sched_out+0x51/0x108 > CPU: 0 PID: 101 Comm: touch Not tainted 5.17.0-rc7-00010-gd3a1cdde80d2-dirty #13 > Call Trace: > dump_stack+0xc/0x40 > __warn+0x8f/0x174 > warn_slowpath_fmt+0x48/0xac > __kmap_local_sched_out+0x51/0x108 > __schedule+0x71a/0x9c4 > preempt_schedule_irq+0xa0/0xe0 > common_exception_return+0x5c/0x93 > do_wp_page+0x30e/0x330 > handle_mm_fault+0xa70/0xc3c > do_page_fault+0x1d8/0x3c4 > common_exception+0x7f/0x7f > > WARNING: CPU: 0 PID: 101 at mm/highmem.c:664 __kmap_local_sched_in+0x50/0xe0 > CPU: 0 PID: 101 Comm: touch Tainted: G W 5.17.0-rc7-00010-gd3a1cdde80d2-dirty #13 > Call Trace: > dump_stack+0xc/0x40 > __warn+0x8f/0x174 > warn_slowpath_fmt+0x48/0xac > __kmap_local_sched_in+0x50/0xe0 > finish_task_switch$isra$0+0x1ce/0x2f8 > __schedule+0x86e/0x9c4 > preempt_schedule_irq+0xa0/0xe0 > common_exception_return+0x5c/0x93 > do_wp_page+0x30e/0x330 > handle_mm_fault+0xa70/0xc3c > do_page_fault+0x1d8/0x3c4 > common_exception+0x7f/0x7f > > Fix it by replacing !pte_none(pteval) with pte_val(pteval) != 0. Oops. Sorry. > Fixes: 5fbda3ecd14a ("sched: highmem: Store local kmaps in task struct") > Signed-off-by: Max Filippov Reviewed-by: Thomas Gleixner