Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp178967rwb; Wed, 7 Dec 2022 16:21:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf50+UjEUx/FCvlWqeWcnFzyEvdBxOonsUthkmm/eNsE01rbAfap9cumdedMFPpfBrPTozg1 X-Received: by 2002:aa7:85cb:0:b0:575:871f:2e7a with SMTP id z11-20020aa785cb000000b00575871f2e7amr734032pfn.35.1670458866848; Wed, 07 Dec 2022 16:21:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670458866; cv=none; d=google.com; s=arc-20160816; b=RhGYHS0qMnoSgONsQMKRsMX/RPTD98v1vZeVMz8g005w/8h8/GFRRj+Vs/ny9896fp 6IfP6g8ehWN9/Ao9PvKtYRi99Iyiw8/0AdpKbKd0KRRmtCkYFzLW6DwicE7jOreBKVGs lHRyAC7ChkFAhaLn8YndfLVLl7ZuWlW94Xv98Hjy341s182JbUatiQKxJyilW/jDRyZS EdHE3t8g2bRlMctN+txkVgGPZJqsNHYuWKvoPFsGTgEYY+x6V6kLNW0PbuSUpzYqBijO KKkDNxdqsjLs8Ezw7VjV2OMtYtvLU+WnhDyi7qjgQ3BIdTMAL1pFNwO98V5TLOZk1Xgy ++vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OlRZXX5fi6uW5Xh2LMxBmgQ7B0VSc2snpywNu1tW4NI=; b=06pX5lJfNyaEU0SIAUXnKdxkXt+OH7UMUsi0zSPqluHsnSIzawSdrnCsnrRbRdX/Hx B+2q7ZUSsxNX1qMaUhxEC/sfqOzs4K1paKEXlDF2UPvFwd0hVX+J0ASRKuB1YJ1T9VlF UgeI/4xtFokWXmncs3BN1LyM/481HEngkLK1KeRxYw+NgzrccXEuRD2cnstjd/q6CrNK tQTmMNQfEPkl/uM4mI6aQ88v+ESviD6KvRBXrq9c8sp1KURk5mDXB0r1MucEVNGii2yo UPMkk9gPQ5ng/ubeM0sIgMrrGf7JhkzXiclijvd7vODTEOkPkAsKdaQ0Xn6zijaJuGMQ LdxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Dj7+8fB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w15-20020a1709027b8f00b00189c4a9c5ecsi13361998pll.297.2022.12.07.16.20.55; Wed, 07 Dec 2022 16:21:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Dj7+8fB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbiLGXDq (ORCPT + 74 others); Wed, 7 Dec 2022 18:03:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229971AbiLGXDg (ORCPT ); Wed, 7 Dec 2022 18:03:36 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C045713D3E; Wed, 7 Dec 2022 15:03:33 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id h12so30280198wrv.10; Wed, 07 Dec 2022 15:03:33 -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=OlRZXX5fi6uW5Xh2LMxBmgQ7B0VSc2snpywNu1tW4NI=; b=Dj7+8fB4fw+2QdujWiQxxIkZgbFUihxLnxAqCWqnmVuceiC+w7/oGLydRxSI7h1lxB 0peNzyiiz8uSh+9+kRzGEx3zvrooMEIizeOgE9Flas/91C6+0QiUG9aR8Xeqp4IFVyop XTcm1uOr54A4qTUerg0bCDlZlGTWu3yJDT+RiJstPURbVDVqmtrRXr2I1L9grF/OMarv Ex1mp9qXeju8NSruHmXe1/pUwQZDWs4+GSNM8DHYTSwg+CyFCjBs9nFuBWy0g9ZJ1fp5 xAiNNao7DWjsUizxjzc/3NbOaxUcAUIX0Mr3TZ4Umm7h6e9/p5jJogeEnFqgCnP4D+u/ Q4Hg== 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=OlRZXX5fi6uW5Xh2LMxBmgQ7B0VSc2snpywNu1tW4NI=; b=dAKwHbwKfQNTvINB2nPzJhg4VdDzWMzmIh8h5ovhjCkCzDGkT/FzZlSl6rwiNxvF9U ADR2d1UCXDmSu9yzWaNwnkPFUwYYmZMaiAaB9l+msHB/A7hucwDTB6B8Xzv8wmGq4XQ0 FVVisudQfzdQkuXzDv5xB1jnAgDBTtIX+WZ8+gNGQVaUxcMU70eCj50A4UB8DKkgq0tI IoGXamc0MMlIRD3OtEDfJMhZM/rMkVT5SllTYjMkLR5t71e52jU/wssI0wMC/gF15kex l4SEpp/3bBRdTsziMPX9L/n23CfM+0bXMxJMfhMQSEKBXdlJyHVKVb6baSwb7fEeBQRI jh5g== X-Gm-Message-State: ANoB5pkzJ8MERiaXnACRS7TLsUv2SQy6osKJwRSX5BCldRrUwqsfeiJp dvPqpd39ZlTfxFMbPDYFxaY= X-Received: by 2002:a05:6000:104a:b0:242:257f:56f8 with SMTP id c10-20020a056000104a00b00242257f56f8mr691030wrx.11.1670454212122; Wed, 07 Dec 2022 15:03:32 -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 cl8-20020a5d5f08000000b00241fde8fe04sm20994245wrb.7.2022.12.07.15.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 15:03:30 -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: Thu, 08 Dec 2022 00:03:29 +0100 Message-ID: <2263204.ElGaqSPkdT@suse> In-Reply-To: References: <20221206070029.7342-1-fmdefrancesco@gmail.com> <2130641.irdbgypaU6@suse> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On mercoled=C3=AC 7 dicembre 2022 14:51:00 CET Sebastian Andrzej Siewior wr= ote: > On 2022-12-07 14:01:50 [+0100], Fabio M. De Francesco wrote: > > > > If so, I understand and I again agree with you. If not, I'm missing > > > > something; so please let me understand properly. > > > >=20 > > > > Aside from the above, I'm not sure whether you deleted the last phr= ase > > > > before > > > > your suggestion. What about making it to become "For the above- mentioned > > > > cases, conversions should also explicitly disable page-faults and/or > > > > preemption"? > > >=20 > > > 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. > >=20 > > I never meant to suggest to _unconditionally_ disable page-faults > > and/or preemption. I was only trying to say that developers must carefu= lly > > check whether or not the whole kmap-ed section depended on those side > > effects. > I know. That are the two condition that should be checked/ kept in mind > while replacing the code. Maybe I read it wrongly=E2=80=A6 >=20 > > If so, they must _explicitly_ disable preemption or page-faults or both > > together with the use of kmap_local_page(). >=20 > Right. The requirement for it should be probably documented in case it > is not obvious. For PREEMPT_RT it will become a problem if the preempt > disabled section additionally acquired a spinlock_t or allocated memory. > So ideally it won't be used ;) >=20 > > Instead, if the section=20 doesn't > >=20 > > depend on preemption and/or page-faults disabling, they must only repla= ce > > kmap_atomic() with kmap_local_page(). >=20 > Correct and I assumed that you know all this. >=20 > > I had probably used a bad wording when trying to say the same things th= at > > you > > wrote much more clearly. >=20 > Write it as you wish I just made a recommendation. If the wording is > crystal clear then there is less room for interpretations. I just sent v2 of this patch.[1] I hope that now I left less room for=20 potential misinterpretation by merging your suggestion with the old text. Again thanks for helping, =46abio [1] https://lore.kernel.org/lkml/20221207225308.8290-1-fmdefrancesco@gmail.= com/T/