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 37ACDC001B2 for ; Thu, 8 Dec 2022 20:06:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A55288E0003; Thu, 8 Dec 2022 15:06:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A019F8E0001; Thu, 8 Dec 2022 15:06:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C9148E0003; Thu, 8 Dec 2022 15:06:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 797A88E0001 for ; Thu, 8 Dec 2022 15:06:02 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2A200C0C84 for ; Thu, 8 Dec 2022 20:06:02 +0000 (UTC) X-FDA: 80220220164.18.71B1895 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by imf30.hostedemail.com (Postfix) with ESMTP id 591128001A for ; Thu, 8 Dec 2022 20:05:59 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JFXQzVZh; spf=pass (imf30.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.128.47 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=1670529960; 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=5HJzctfs0A7+67wrWEyjqiiApDxFj7bBAuqDA0docR8=; b=o3sfeKGluCTBs9ii2f+CXDfp9OblhXr5Z3/3B89tkLoN5nidsqL04pHAdkycuY/nu3T0u5 2Ix35VR5Acq2rmsmQFa21nxyc7Fe+PELwoL3w/pSCD9Ko8qAPIhzxuSLY1SJIQtbc9sERG 3IISI72H1kZOHTTenuT3Ixp0r//CnoI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JFXQzVZh; spf=pass (imf30.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.128.47 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=1670529960; a=rsa-sha256; cv=none; b=MTsgEH69UJ+QZnGcWWR6tO4jbOhHHpsLgvO2jShX9s2pkYkIiyszoM9Fg1sJBGzaJKTGok vbc4hrR+riJGA9RIv5JoKRfGkDuAvfEoH84Vz7ycwP92cdPFHFgynjXUONGISXdX8YbACM TSR4JPC89RmglrDLg/Ee3OcPJmUqys4= Received: by mail-wm1-f47.google.com with SMTP id p13-20020a05600c468d00b003cf8859ed1bso1906543wmo.1 for ; Thu, 08 Dec 2022 12:05:59 -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=5HJzctfs0A7+67wrWEyjqiiApDxFj7bBAuqDA0docR8=; b=JFXQzVZhIytYnODAFNYIoJhU3fu85Q0qDIXPnks2LUwHobMp1Qfh9ik/oOO9ZeC7SS G60FU533BawspTAQ91j0mrt+c1qedmr+Szh4qB0pJjQpwc2G5KYy5QM1nv0BGX7MXCuR yougPIUeWVYgoJmNtehonr0Lij5RO4aL8dl2psOKLQYML08draDBICLRWTL3dfTG/g5h cIrk1YEnC3hkOgte/f+AbMhssZlo8s+3PRGqmm/uqg4ni3F/pCXwRqOpsyAgcb4Dl6pS dcfsLNWp1+1tLkFIX6cN3ZTcflhCtsQoKfxkwbBrk5IRfVeGRsv3GvUgbCZv7Cz1LjJZ BIsQ== 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=5HJzctfs0A7+67wrWEyjqiiApDxFj7bBAuqDA0docR8=; b=Vr34w6baCngpJ7umkfiEZadDmjeEz7/1SWwM35OijVrNaDrGufMXzVioQgrkamQMIM q0GfTooyUKzUO48sRAv3svg28OghjZavWZGe6BUeE7Gw7Mud1k4bD9vXGQalCPTBil7S JPsTtRRsOG+YLyLQXA/CB2fq8BamXSHRup98jhpanSnvqYBTLQv4CjmvN3tZeaExMdod TFvStbC1Q6xgYptKEnpgVBuNqhaq7JWhEZycvLBUgkWT/CmiQcN7EYn0B6FGZNTXJO2n /2mMEH49cCXfksWmfyrRUmi4p8xr6X8+ztytjuGTekOVJprc0BcjwObkYsS3mcqme7bV THRg== X-Gm-Message-State: ANoB5pkSOeMB/fXiUgaiXrYAa/WcBilD5XvCaJfopwc13Har81jZ7Br+ uCF8WHN6LW6kCC5xAeo5tEU= X-Google-Smtp-Source: AA0mqf53iw5pBXG2lLUX2tXR2ljdn/DuiP0//O+YiWqTgo+EuFU1OoZ/hwTOfToMwL2LqnpV3AoYWA== X-Received: by 2002:a05:600c:1d98:b0:3cf:74b4:c3c8 with SMTP id p24-20020a05600c1d9800b003cf74b4c3c8mr2940495wms.17.1670529958638; Thu, 08 Dec 2022 12:05:58 -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 j42-20020a05600c1c2a00b003c6d21a19a0sm7068929wms.29.2022.12.08.12.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 12:05:57 -0800 (PST) From: "Fabio M. De Francesco" To: Bagas Sanjaya Cc: Jonathan Corbet , Andrew Morton , Sebastian Andrzej Siewior , Ira Weiny , Mike Rapoport , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Peter Zijlstra , Thomas Gleixner Subject: Re: [PATCH v2] mm/highmem: Add notes about conversions from kmap{,_atomic}() Date: Thu, 08 Dec 2022 21:05:56 +0100 Message-ID: <21697972.EfDdHjke4D@suse> In-Reply-To: References: <20221207225308.8290-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Rspamd-Queue-Id: 591128001A X-Stat-Signature: m53ymgr3zmqqcpbx6wmqs6z1imcphhzq X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1670529959-76052 X-HE-Meta: U2FsdGVkX1/k1H9N3nyYl0Nd4THZkBK+VsWXIg88YCQBpmh3ILDJw6ktetn9sXhX/KvdHn4HeCwH0iQINTgnP4k4I3GXQAE+/WhSmIuk1E7rZybnc38EfiMbBRhNDHoX/jCsZkUtX77TgED8WbNzRUwdGH7tf/vfurZ/QpczQcyxCQZm/6SzXg2BsN41y+iSmzMj/T0wjj1shNONhcqV3sa7O+eMO17BpQwb0Khm9ocfaomHprGhd5CqngGSyA4bqnItlzQPyD4RPqsV11Cwl2nCe2fNgc8RLu1el680TG5H+MMnIEGpfOt/BqlfFzxTkzRbnToUXEsQKG1Sj/HTFuaPwfS9J93YpycwK0AvZ4AjS2ZrlStvZdsbcxjZNx/v7BQSmhSsCayl22bF0U0G2I7yQK5nNfjkb2St3Bl9JzJtCjY6GaFTcOYI6Yaq6B2g3ULdlSnmOVVdercUfS8XgX/6wnbuVhcfNR+ZzgP1WPn/U046L2Mn7Y7XyD1WfiCw9YMu0+Y6Cdkn7/4r8a/RqVhA/e51ZZR8yQEna+zdg+uqwDLBW3qg7dwBo84lG8ASzJlwPWVzutMH5KACxdHkyuGWBvfu4wT0ANMHpp5m4HEIwDcF5pLVUOWiUHCEo/DstDhQQaC7bV5Ln85G8qAuAZPUlJVQTeFFbqLb3d3tik1SYpKsxSMKcS6cY3CLcKzv8gs2lh4Nyl4FKKyBTlQzb6DQCuENTK4jTLpmm1F87ltQASj47XWVsqT/TsHMcTEvtuHmk1jOPqzBfBtscsjFV41sz5dgpYFIAFoG2diOYuxuATRtRbE0sesYLLGH5GmYSqIJIx40YcAv1ZxAmhuXsMnKWY7qRlX6r5kML7kdSYqxBzvdO4gQf4fU07MbgWEXWWliIVLIQ4KHjKtfWkv1PkjyX7XgBkOOUJih/HYTzw6l/kBLaj0nRemzQBjjw0RD7Ty86aL2j+XWjyCasMb pLiFAh1Z b8Hsp02yCdbKiggGOH1vmj8S9mY0WioXkuXJDkQZoMBc3A/rg6+e1hqxqvbzYJmPpfdZzFwiolm8u79cQArPFRMACi0hg+CktzuKSXCoJlL082KESOVC9LrdmfOvfpDz2mYMnYvic2+M/PRE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000563, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On gioved=EC 8 dicembre 2022 05:22:37 CET Bagas Sanjaya wrote: > On Wed, Dec 07, 2022 at 11:53:08PM +0100, Fabio M. De Francesco wrote: > > diff --git a/Documentation/mm/highmem.rst b/Documentation/mm/highmem.rst > > index 0f731d9196b0..59d1078f53df 100644 > > --- a/Documentation/mm/highmem.rst > > +++ b/Documentation/mm/highmem.rst > > @@ -57,7 +57,8 @@ list shows them in order of preference of use. > >=20 > > It can be invoked from any context (including interrupts) but the > > mappings > > can only be used in the context which acquired them. > >=20 > > - This function should be preferred, where feasible, over all the othe= rs. > > + This function should always be used. kmap_atomic() and kmap() have b= een > > + deprecated. >=20 > "... always be used, whereas ..." >=20 > > + NOTE: Conversions to kmap_local_page() must take care to follow the > > mapping + restrictions imposed on kmap_local_page(). Furthermore, the= =20 code > > between + calls to kmap_atomic() and kunmap_atomic() may implicitly=20 depend > > on the side + effects of atomic mappings, i.e. disabling page faults or > > preemption, or both. + In that case, explicit calls to=20 pagefault_disable() > > or preempt_disable() or + both must be made in conjunction with the us= e=20 of > > kmap_local_page(). + > > ... > > + NOTE: Conversions to kmap_local_page() must take care to follow the > > mapping + restrictions imposed on kmap_local_page(). In particular, it= is > > necessary to + make sure that the kernel virtual memory pointer is only > > valid in the thread + that obtained it. > > + >=20 > What about using note block to signify conversion notes above? >=20 > ---- >8 ---- >=20 > diff --git a/Documentation/mm/highmem.rst b/Documentation/mm/highmem.rst > index 59d1078f53df57..ef53eb580d4cda 100644 > --- a/Documentation/mm/highmem.rst > +++ b/Documentation/mm/highmem.rst > @@ -103,12 +103,14 @@ list shows them in order of preference of use. >=20 > * kmap_atomic(). This function has been deprecated; use kmap_local_page(= ). >=20 > - NOTE: Conversions to kmap_local_page() must take care to follow the=20 mapping > - restrictions imposed on kmap_local_page(). Furthermore, the code betwe= en=20 =2D > calls to kmap_atomic() and kunmap_atomic() may implicitly depend on the= =20 side > - effects of atomic mappings, i.e. disabling page faults or preemption, = or > both. - In that case, explicit calls to pagefault_disable() or > preempt_disable() or - both must be made in conjunction with the use of > kmap_local_page(). + .. note:: > + Conversions to kmap_local_page() must take care to follow the mappi= ng > + restrictions imposed on kmap_local_page(). Furthermore, the code=20 between > + calls to kmap_atomic() and kunmap_atomic() may implicitly depend on= =20 the > + side effects of atomic mappings, i.e. disabling page faults or > preemption, + or both. In that case, explicit calls to > pagefault_disable() or + preempt_disable() or both must be made in > conjunction with the use of + kmap_local_page(). >=20 > [Legacy documentation] >=20 > @@ -129,10 +131,11 @@ list shows them in order of preference of use. >=20 > * kmap(). This function has been deprecated; use kmap_local_page(). >=20 > - NOTE: Conversions to kmap_local_page() must take care to follow the=20 mapping > - restrictions imposed on kmap_local_page(). In particular, it is necess= ary > to - make sure that the kernel virtual memory pointer is only valid in t= he > thread - that obtained it. > + .. note:: > + Conversions to kmap_local_page() must take care to follow the mappi= ng > + restrictions imposed on kmap_local_page(). In particular, it is > necessary + to make sure that the kernel virtual memory pointer is on= ly > valid in the + thread that obtained it. >=20 > [Legacy documentation] >=20 > Thanks. >=20 > -- > An old man doll... just what I always wanted! - Clara You provided valid suggestions, thanks! However, immediately after submitting this v2 patch, Andrew added it to the= - mm mm-unstable branch. I'll do the changes that you suggested in a subsequent patch which will bui= ld=20 on this. Again thanks, =46abio