Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9059366rwd; Wed, 21 Jun 2023 02:24:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4w8MFnf9/rA4QMGdSd3cnhTtT/NaU9mAUAumuoz87fqGNGUUdMkE/C9EkKI8xK61lJeo0p X-Received: by 2002:a05:620a:2f2:b0:762:4266:47e6 with SMTP id a18-20020a05620a02f200b00762426647e6mr11566545qko.27.1687339475353; Wed, 21 Jun 2023 02:24:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687339475; cv=none; d=google.com; s=arc-20160816; b=F2majyNXMU0vekLvXV5LRTEvJgE3J65/IGGq5n6ab9uEk27NAklGC73IB6Mg75AdEm 50IHawz3Rzmy/eOeRRLGQaX4/JMnkCc/A1o0xpOBJ2UDxIOESJ6Ho4khLC9MA68L/lxC 7ft/yLn8KyQSnXw3gQ7Jxf5xqayU17I+JdwMuKLaeUv2t8DkyF4+uSDWEbWGxNQ7sz57 hRTXwZKpElpYRydTZJm1alWER/f2MAzPJnsZR/rBkrj7UmUGJ47JV6NiyC6p4vxy8rNz GCYjLwlDN1+Dxu3qWze9HR2EJWE/4XdnU+m6ivMQsgyXCpT3/F4R77ymGdQM2M89fmF3 bbGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Y2ftvHCvMNCPITiD+WNmTnmAPpt29IJpsvn2EcHuPeI=; b=RzahyoXAWa5+Leg/Ho08YjE5U5BWcabiUgFTljjD7I5wZBBrs1jsXZ40JsRsm18Ro+ Ewen+QZePPkE1YiNEcNXjg/ZrXxXh6rxMWqnzOHEX+wrgfzl55WbWGcU6xYjrGTZZFcH XS5V1N64cpRTCn1T2x8hRYffUu1SkSyvcWvP9xcUCHZdU62paR5TcGY4ybU/8FzcXq0D h0St/RwGe8RslRkEHTzjLRIOqIyQecpaY3SruzVCQIc40foXTJkw1Tdfv84wM6ZrvTYs djrESxu+CgNcjwtJJ5JNrcokt2wu0T1AuBE3Bpu9qCceWji2gkfN5DCo/PXV8FVeoBG8 eNXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=ahm6S886; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g82-20020a625255000000b0065290aa261dsi301375pfb.22.2023.06.21.02.24.23; Wed, 21 Jun 2023 02:24:35 -0700 (PDT) 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=fail (test mode) header.i=@shipmail.org header.s=mail header.b=ahm6S886; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbjFUJQ3 (ORCPT + 99 others); Wed, 21 Jun 2023 05:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230244AbjFUJQZ (ORCPT ); Wed, 21 Jun 2023 05:16:25 -0400 X-Greylist: delayed 556 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 21 Jun 2023 02:16:18 PDT Received: from pio-pvt-msa3.bahnhof.se (pio-pvt-msa3.bahnhof.se [79.136.2.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F3DD1B4 for ; Wed, 21 Jun 2023 02:16:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id 9233E3FA9A; Wed, 21 Jun 2023 11:06:59 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Score: -2.201 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Authentication-Results: pio-pvt-msa3.bahnhof.se (amavisd-new); dkim=pass (1024-bit key) header.d=shipmail.org Received: from pio-pvt-msa3.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n0VbiRymwsKG; Wed, 21 Jun 2023 11:06:58 +0200 (CEST) Received: by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id 5645E3FA67; Wed, 21 Jun 2023 11:06:57 +0200 (CEST) Received: from [192.168.0.209] (unknown [134.191.232.81]) by mail1.shipmail.org (Postfix) with ESMTPSA id 16B553631FE; Wed, 21 Jun 2023 11:06:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1687338416; bh=ASHe5V5zHsS9gHNX0/ImqDfplWNdOYDmwlVBv/l+V5U=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ahm6S886OmI+vdOHzg4L1cVK8vLVBmZrhYjLIAVqt3PSzQ7efHi5TZbOv1o6fOGFV 2QL6tStvv7uVzKKraE4pgvthvBHSjKSVEGuWxmvUsDRqhwihq6A+AHkjh4vUF6Mg0v ifVIyJshfIiyBrsM4Zf+yPpecBRw/RHJlDYiA9aY= Message-ID: <79e1f37f-3ffa-0195-860b-08cc890d810e@shipmail.org> Date: Wed, 21 Jun 2023 11:06:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.1 Subject: Re: [PATCH v2] drm/i915: Replace kmap() with kmap_local_page() Content-Language: en-US To: Sumitra Sharma , Ira Weiny Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Fabio , Deepak R Varma References: <20230620180759.GA419158@sumitra.com> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28Intel=29?= In-Reply-To: <20230620180759.GA419158@sumitra.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 6/20/23 20:07, Sumitra Sharma wrote: > On Tue, Jun 20, 2023 at 06:23:38AM -0700, Ira Weiny wrote: >> Sumitra Sharma wrote: >>> On Sun, Jun 18, 2023 at 11:11:08AM -0700, Ira Weiny wrote: >>>> Sumitra Sharma wrote: >>>>> kmap() has been deprecated in favor of the kmap_local_page() >>>>> due to high cost, restricted mapping space, the overhead of a >>>>> global lock for synchronization, and making the process sleep >>>>> in the absence of free slots. >>>>> >>>>> kmap_local_page() is faster than kmap() and offers thread-local >>>>> and CPU-local mappings, take pagefaults in a local kmap region >>>>> and preserves preemption by saving the mappings of outgoing tasks >>>>> and restoring those of the incoming one during a context switch. >>>>> >>>>> The mapping is kept thread local in the function >>>>> “i915_vma_coredump_create” in i915_gpu_error.c >>>>> >>>>> Therefore, replace kmap() with kmap_local_page(). >>>>> >>>>> Suggested-by: Ira Weiny >>>>> >>>> NIT: No need for the line break between Suggested-by and your signed off line. >>>> >>> Hi Ira, >>> >>> What does NIT stand for? >> Shorthand for 'nitpicking'. >> >> "giving too much attention to details that are not important, especially >> as a way of criticizing: " >> >> - https://dictionary.cambridge.org/dictionary/english/nitpicking >> >> Via email this is a way for authors of an email to indicate something is >> technically wrong but while nicely acknowledging that it is not very >> significant and could be seen as overly critical. >> >> For this particular comment I'm showing something to pay attention to next >> time but that was not a big deal this time around. >> > Hi Ira, > > Thank for your explanation on NIT. > > >>> Thank you. I will take care about the line breaks. >>> >>>>> Signed-off-by: Sumitra Sharma >>>>> --- >>>>> >>>>> Changes in v2: >>>>> - Replace kmap() with kmap_local_page(). >>>> Generally it is customary to attribute a change like this to those who >>>> suggested it in a V1 review. >>>> >>>> For example: >>>> >>>> - Tvrtko/Thomas: Use kmap_local_page() instead of page_address() >>>> >>>> Also I don't see Thomas on the new email list. Since he took the time to >>>> review V1 he might want to check this version out. I've added him to the >>>> 'To:' list. >>>> >>>> Also a link to V1 is nice. B4 formats it like this: >>>> >>>> - Link to v1: https://lore.kernel.org/all/20230614123556.GA381200@sumitra.com/ >>>> >>>> All that said the code looks good to me. So with the above changes. >>>> >>>> Reviewed-by: Ira Weiny >>>> >>> I have noted down the points mentioned above. Thank you again. >>> >>> I am not supposed to create another version of this patch for >>> adding the above mentions, as you and Thomas both gave this patch >>> a reviewed-by tag. Right? >>> >> Based on this response[*] from Tvrtko I think this version can move >> through without a v3. > Okay! > > > Thanks & regards > Sumitra I think one thing worth mentioning in the context of this patch is that IIRC kmap_local_page() will block offlining of the mapping CPU until kunmap_local(), so while I haven't seen any guidelines around the usage of this api for long-held mappings, I figure it's wise to keep the mapping duration short, or at least avoid sleeping with a kmap_local_page() map active. I figured, while page compression is probably to be considered "slow" it's probably not slow enough to motivate kmap() instead of kmap_local_page(), but if anyone feels differently, perhaps it should be considered. With that said, my Reviewed-by: still stands. /Thomas > >> Thanks! >> Ira >> >> [*] https://lore.kernel.org/all/bcb0a1d2-cd4d-a56f-1ee6-7ccfdd2f7b38@linux.intel.com/ >> >> >> Thanks all! I'll just re-send the patch for our CI, since it didn't get >> picked up automatically (stuck in moderation perhaps), with all r-b tags >> added and extra line space removed and merge it if results will be green. >> >> Regards, >> >> Tvrtko >> >> >> >>> Thanks & regards >>> Sumitra >>> >>> PS: I am new to the open source vocabulary terms. >>> >>>>> - Change commit subject and message. >>>>> >>>>> drivers/gpu/drm/i915/i915_gpu_error.c | 4 ++-- >>>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c >>>>> index f020c0086fbc..bc41500eedf5 100644 >>>>> --- a/drivers/gpu/drm/i915/i915_gpu_error.c >>>>> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c >>>>> @@ -1164,9 +1164,9 @@ i915_vma_coredump_create(const struct intel_gt *gt, >>>>> >>>>> drm_clflush_pages(&page, 1); >>>>> >>>>> - s = kmap(page); >>>>> + s = kmap_local_page(page); >>>>> ret = compress_page(compress, s, dst, false); >>>>> - kunmap(page); >>>>> + kunmap_local(s); >>>>> >>>>> drm_clflush_pages(&page, 1); >>>>> >>>>> -- >>>>> 2.25.1 >>>>> >>>> >>