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 EE844C47089 for ; Wed, 7 Dec 2022 08:00:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 314808E0003; Wed, 7 Dec 2022 03:00:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 29C818E0001; Wed, 7 Dec 2022 03:00:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13FC58E0003; Wed, 7 Dec 2022 03:00:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 067018E0001 for ; Wed, 7 Dec 2022 03:00:36 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CC79D160C55 for ; Wed, 7 Dec 2022 08:00:35 +0000 (UTC) X-FDA: 80214763230.12.2F61E36 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf27.hostedemail.com (Postfix) with ESMTP id 4559E40015 for ; Wed, 7 Dec 2022 08:00:34 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=FztapfyX; dkim=pass header.d=linutronix.de header.s=2020e header.b="WOp/gj5l"; spf=pass (imf27.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670400034; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wKDkOx0HlWRonLHxoYKpkkIPzXELWNRGE8f2sh6dWn4=; b=Ky59BgOCKaoPJWL/kAc0gaVm28koWRXXfLtpQlq4oG6sjKgBOZ5uwRwWwN2/aavg73NefE ktHGctFtv42AOlG3V1HvIFUwqSx8yxAG2mWyehfXALIKgM/kpAYmCXN6umjw7onuSW2mh6 WKQWa4BWnljU85Vle2iGD0eSD+R/V1w= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=FztapfyX; dkim=pass header.d=linutronix.de header.s=2020e header.b="WOp/gj5l"; spf=pass (imf27.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670400034; a=rsa-sha256; cv=none; b=0+beCOcNbgPXBfOIjyJHrgkT6tq8M0q1Al4nMfgXhbasd+G36HDEeQgICB+OMLLo/6ftZb WnEYtPE6wvB+/buJrG/UD0HPjmn1oZcsvY+7XSSi2WxSpoRNieJskKnADyijdCUgRljNFk AwScXG1rudQX3SP7eFDQkTu9bAIoQE8= Date: Wed, 7 Dec 2022 09:00:29 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670400031; 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=wKDkOx0HlWRonLHxoYKpkkIPzXELWNRGE8f2sh6dWn4=; b=FztapfyXQvvcURZVkmrjRLVDpPa6ZPN5boUQdlMmLKFsX5vJkaY//PUztOqY92SrOo8G8B SLoVfXgVMXn85Liq5FCfNNcvNGUxsZENDigDzVxAtE9ZEM3+OMLhdo5B5qXaPdIqwZhK6v VctHFevjvTXT+KG58RvEZTEQ6cLm0kYCDGws7TzEyaDW8sJcZ5iLco8VvMNCBXYtnpZC8S es5zLl42QQF2G16cX2DeMzrKvD8jVejEfWrUmk0KVW9nFQ/KTiSy//6Ni8UNeI4XJKKczt 5Hyor+wia27pASnc2ganH+p9SQGGk3COCkshNY2wPyVv2W3Wu6le415qx5snng== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670400031; 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=wKDkOx0HlWRonLHxoYKpkkIPzXELWNRGE8f2sh6dWn4=; b=WOp/gj5libGx/W+qHdWiQ5H6ool2s1vfj8ByaK8sUZ+b8Oj5TjUZqg8s5hIQ5OizCW0yqO ZtraWhg4BVPe3vCw== From: Sebastian Andrzej Siewior To: "Fabio M. De Francesco" Cc: Jonathan Corbet , Andrew Morton , Ira Weiny , Mike Rapoport , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , Peter Zijlstra , Thomas Gleixner Subject: Re: [PATCH] mm/highmem: Add notes about conversions from kmap{,_atomic}() Message-ID: References: <20221206070029.7342-1-fmdefrancesco@gmail.com> <2093077.OBFZWjSADL@suse> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2093077.OBFZWjSADL@suse> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4559E40015 X-Stat-Signature: omgmnhnwcxre5pwm6imye63z5b9nr9jp X-Spamd-Result: default: False [-0.04 / 9.00]; SUBJECT_HAS_UNDERSCORES(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[linutronix.de,none]; R_DKIM_ALLOW(-0.20)[linutronix.de:s=2020,linutronix.de:s=2020e]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.04)[53.10%]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[11]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[linutronix.de:+]; TO_DN_SOME(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; ARC_NA(0.00)[] X-Rspam-User: X-HE-Tag: 1670400034-90966 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 2022-12-06 20:12:13 [+0100], Fabio M. De Francesco wrote: > > Furthermore, code between the kmap_atomic() and kunmap_atomic() > > functions may implicitly depended > > I suppose it should be "depend"? Shouldn't it? Ehm, yes, correct. > > on the side effects of kmap_atomic() > > namely disabling pagefaults or preemption or both. > > I agree with you for rephrasing, mainly because it is > written in poor English. > > However, I still have doubts about why you deleted "migration". > AFAIK, __kmap_local_pfn_prot() always takes care of disabling migration for > HIGHMEM enabled kernels. That is correct. Historically kmap_atomic() never had a migrate_disable() statement - only preempt_disable(). With disabled preemption the task migration is implicitly disabled. > How about !HIGHMEM, where kmap_local_page() is an indirect call to > page_address()? Did you mean that, if the code between kmap_atomic() and > kunmap_atomic() depended on migrate_disable() (in PREEMPT_RT) we should always > just stay safe and call preempt_disable() together with conversion to > kmap_local_page()? Even in the !HIGHMEM case it always uses preempt_disable(). With PREEMPT_RT it is different as it never disabled preemption and always did a migrate_disable() instead. If you talk about what needs to be considered while migrating away from kmap_atomic() then I wouldn't add the PREEMPT_RT bits to it since it was never in the picture while the code (using kmap_atomic()) was originally written. > If so, I understand and I again agree with you. If not, I'm missing something; > so please let me understand properly. > > Aside from the above, I'm not sure whether you deleted the last phrase before > your suggestion. What about making it to become "For the above-mentioned > cases, conversions should also explicitly disable page-faults and/or > preemption"? They need to disable preemption or page-faults or both if it is needed (not unconditionally) and where it is needed. This means not unconditionally over the whole kmap-ed section. > Thanks again for noticing my mistakes. > > Fabio Sebastian