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 0A313C352A1 for ; Tue, 6 Dec 2022 19:12:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6DA9D8E0003; Tue, 6 Dec 2022 14:12:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 63D0F8E0001; Tue, 6 Dec 2022 14:12:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 490A88E0003; Tue, 6 Dec 2022 14:12:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3A0878E0001 for ; Tue, 6 Dec 2022 14:12:18 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 06BF3408FD for ; Tue, 6 Dec 2022 19:12:18 +0000 (UTC) X-FDA: 80212827156.11.1CF980F Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by imf11.hostedemail.com (Postfix) with ESMTP id 903E440008 for ; Tue, 6 Dec 2022 19:12:17 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qkmf7XcS; spf=pass (imf11.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.128.50 as permitted sender) smtp.mailfrom=fmdefrancesco@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670353937; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=923JxRimLSxvO+7wwtbUsSa/9xr0Tkhke8ZWL9gS4y0=; b=kt9GU+lTFbR/PRAhtC6GQPIIZxoKuqHY/PSo05d2EMPXrBzcZDJtMP8tg8yDzY6jfUtFr6 E0W3BISujYW4LJattnt0PXEq0GzJyodPDnSz0H6ddPy5JA5VSpUPVv0CoYGX0Fq8xju6E7 LQUGMXsSQnNJ/yytLP/43Gq+XH3gQZg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qkmf7XcS; spf=pass (imf11.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.128.50 as permitted sender) smtp.mailfrom=fmdefrancesco@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670353937; a=rsa-sha256; cv=none; b=LtttugCjm8seZLe8WwGijNwjDYEmAjvdm3Nezl4pWeZLs/t/aG5asKBQNthQllVkJ1OeTs qFGTJvgtc9RT18dHKES8McrUcFz3vq01TJZb0NUKe/wcsjA0Jc9FeahrlOpmz3HhQ47nah ueV7+MCtuv5zf2jNG9qk0PQCybXWhjU= Received: by mail-wm1-f50.google.com with SMTP id v124-20020a1cac82000000b003cf7a4ea2caso15071247wme.5 for ; Tue, 06 Dec 2022 11:12:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=923JxRimLSxvO+7wwtbUsSa/9xr0Tkhke8ZWL9gS4y0=; b=qkmf7XcS+lo2DHkVGfkMsAoqlWRXmhRAFrPaVNfmHgrWIBF91HeI/yTV6jmCFiWgI9 V71wUFeZ8swmKSQVkwHLjkKxxLw3uqHm67uNc+S2mUJX3Q0c8ZytrkLwOELIaykdxU/P wvl+QDsoTy3PBdpW3Qx0oRBYNTjdITtW2diD7ul3JjtEHsjF7kwHGXIetxpVehTx6u54 p2DSNq90fFbkdQ7qReFxk/64bA/XXEulPK0AtfgHhqBIIjh/ABmLB3iFj9UbGKQZ4Qd7 /c5Bxt3ae54UusVC8h9bQOoZgQct2swQrkzwuhJHNuQi+FM8TL9DTfXsraCWMwa9/0Sx foAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=923JxRimLSxvO+7wwtbUsSa/9xr0Tkhke8ZWL9gS4y0=; b=cnrunqwoFl2rhjDi0bJnOOuNyGsR4Cr3eKrItK6ehG+H2SjLYyEYOPNLqVBX3J3eeo LHb0Xin/N7yn3d6F0bC5jwEPMaIV0rM+fZ1OV+zi6VayINGN8Fa3qZ8M1g+9IvEzJZTk T37Tu8k+Qgtkuo6wPypMYkCXgu5x4m26lcEpybc0SKqTtn+2XoKOyJtR6W+3Kj40A3XI nniVIjqGKMy1ZzRK93jh4SB0ZFHQlJP0mLj/mWNrC/sSBwoBMzBa2dcpGsUWrtUfWLCZ cNfJeWUPqY/grVT9KTTgp0FcoSYFzGZOoafIggRGpPmpDCimQSfA5Qmx9RnSMcTYsfn1 /HJg== X-Gm-Message-State: ANoB5pn0oevK5hex0TjR9w6VuuP0eISpqQXMANSxFPDDdTC6aWQy0wMI LLUZTPY4q+gVZKI0GB6rb7w= X-Google-Smtp-Source: AA0mqf5fWLlUpKtSyOQMHbSYFOFS7l2vnj7lsBXeHzKbKVvrd6Vkj4cwjW4Jzs+KUzY5WYcAYO3ymg== X-Received: by 2002:a05:600c:4e14:b0:3d0:7477:bc89 with SMTP id b20-20020a05600c4e1400b003d07477bc89mr395032wmq.22.1670353936143; Tue, 06 Dec 2022 11:12:16 -0800 (PST) Received: from suse.localnet (host-79-26-108-238.retail.telecomitalia.it. [79.26.108.238]) by smtp.gmail.com with ESMTPSA id n29-20020a05600c3b9d00b003c21ba7d7d6sm25725783wms.44.2022.12.06.11.12.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 11:12:15 -0800 (PST) From: "Fabio M. De Francesco" To: Sebastian Andrzej Siewior 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}() Date: Tue, 06 Dec 2022 20:12:13 +0100 Message-ID: <2093077.OBFZWjSADL@suse> In-Reply-To: References: <20221206070029.7342-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 903E440008 X-Rspam-User: X-Stat-Signature: zxjcpb5qbforaqhc3a68nmkfd5436d9c X-Spamd-Result: default: False [4.60 / 9.00]; SORBS_IRL_BL(3.00)[209.85.128.50:from]; SUBJECT_HAS_UNDERSCORES(1.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; BAD_REP_POLICIES(0.10)[]; BAYES_HAM(-0.00)[39.56%]; TO_DN_SOME(0.00)[]; R_DKIM_ALLOW(0.00)[gmail.com:s=20210112]; RCPT_COUNT_SEVEN(0.00)[11]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; DMARC_POLICY_ALLOW(0.00)[gmail.com,none]; DKIM_TRACE(0.00)[gmail.com:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:209.85.128.0/17:c]; PREVIOUSLY_DELIVERED(0.00)[linux-mm@kvack.org]; RCVD_COUNT_THREE(0.00)[3]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; ARC_NA(0.00)[] X-HE-Tag: 1670353937-339411 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 marted=EC 6 dicembre 2022 09:00:10 CET Sebastian Andrzej Siewior wrote: > On 2022-12-06 08:00:29 [+0100], Fabio M. De Francesco wrote: > > diff --git a/Documentation/mm/highmem.rst b/Documentation/mm/highmem.rst > > index 0f731d9196b0..9523e92299f6 100644 > > --- a/Documentation/mm/highmem.rst > > +++ b/Documentation/mm/highmem.rst > > @@ -100,10 +101,21 @@ list shows them in order of preference of use. > >=20 > > (included in the "Functions" section) for details on how to manage=20 nested > > mappings. > >=20 > > -* kmap_atomic(). This permits a very short duration mapping of a sing= le > > - page. Since the mapping is restricted to the CPU that issued it, it > > - performs well, but the issuing task is therefore required to stay on= =20 that > > - CPU until it has finished, lest some other task displace its mapping= s. > > +* kmap_atomic(). This function has been deprecated; use=20 kmap_local_page(). > > + > > + NOTE: Conversions to kmap_local_page() must take care to follow the > > mapping + restrictions imposed on kmap_local_page(). Furthermore, code > > between the + map/unmap operations may implicitly depended on the side > > effects of + kmap_atomic(), such as disabling pagefaults, migration, > > and/or preemption. + Such conversions should be changed to make explic= it > > calls for those + requirements. Sebastian, thanks for taking a look at my patch and replying. > Furthermore, code between the kmap_atomic() and kunmap_atomic() > functions may implicitly depended=20 I suppose it should be "depend"? Shouldn't it? > on the side effects of kmap_atomic() > namely disabling pagefaults or preemption or both. I agree with you for rephrasing, mainly because it is=20 written in poor English. However, I still have doubts about why you deleted "migration".=20 AFAIK, __kmap_local_pfn_prot() always takes care of disabling migration for= =20 HIGHMEM enabled kernels.=20 How about !HIGHMEM, where kmap_local_page() is an indirect call to=20 page_address()? Did you mean that, if the code between kmap_atomic() and=20 kunmap_atomic() depended on migrate_disable() (in PREEMPT_RT) we should alw= ays=20 just stay safe and call preempt_disable() together with conversion to=20 kmap_local_page()? If so, I understand and I again agree with you. If not, I'm missing somethi= ng;=20 so please let me understand properly. Aside from the above, I'm not sure whether you deleted the last phrase befo= re=20 your suggestion. What about making it to become "For the above-mentioned=20 cases, conversions should also explicitly disable page-faults and/or=20 preemption"?=20 Thanks again for noticing my mistakes. =46abio >=20 > > + [Legacy documentation] > > + > > + This permits a very short duration mapping of a single page. Since = the > > + mapping is restricted to the CPU that issued it, it performs well, b= ut > > + the issuing task is therefore required to stay on that CPU until it = has > > + finished, lest some other task displace its mappings. > >=20 > > kmap_atomic() may also be used by interrupt contexts, since it does = not > > sleep and the callers too may not sleep until after kunmap_atomic() = is >=20 > Sebastian