Received: by 2002:ac0:cd04:0:0:0:0:0 with SMTP id w4csp4664imn; Fri, 1 Jul 2022 08:43:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vohVoZW65weAAqcW8GMHkjJjv/iRILYQo7VMwBatsVJZPN3rYXWs3ETsnQIoN6D71BYWos X-Received: by 2002:aa7:94ad:0:b0:525:265b:991f with SMTP id a13-20020aa794ad000000b00525265b991fmr21870281pfl.30.1656690210407; Fri, 01 Jul 2022 08:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656690210; cv=none; d=google.com; s=arc-20160816; b=IQhefw5Itf9akVmcLYYt6A2te5Kivel/ix79YkytDhcJByqCg0EkiRAZdTpIyDkEsZ P4Q/d9sDatHapaqrNLyzBFQqkEqLqe40AS7xcWV8BYrhBWJ7NcQ53j1DK4BrnLkr039V rjNeq7KgABBE6gu/yAXTscfVHx3eWPdyckGcQl3Or8JwJxCDRPiRnoP/HpaFJTJc9g71 1iFnHT7rIQm/gQA9sQw6MWYAz91eGxQZ92Lgbrfqyh5x9NXnr8UF9Zu19QN4nK/8bzCa s4fdOvdFspM9Zwj8dM2I+QQNS0udrFVxPR7FTVUsrmnuDPzNLE58MnsnScfaQayKrDq3 Jo2w== 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=kVWP9v9nuRHyTkGEYSrcvx5uXVMOYJJ1wNoS0VDXg9k=; b=dt0lcq1aPzsSlBC8nSr6Dn+UuhOxlX83vVaWjcpMGp4FbHsu2oklmUVmtQ8OvBLMOT 0TtbZwdEk71lx83HJTU04ZsFqgYJlV+wLuKgifvJM6fQPTskNKACFPai5dO3AI3dwuv7 /BFYIIYLV4WLkhIG0Jj/OhgMM7lnZrm5QvYH6BRih5CEBIjBngB/feajNth2xCr0J9Wr XIi1oq1IoxYb/S6+mr2KQoLuxXWR3ByAwi6dGHxLHQKsqfrDbzXHkBRwdUgEJFZxVNaf DXSU+kqFS7/jWV9kYk6LbA1x9k1muIV0HMcIEWh/v/vXcBGssuYFiuyRHOlGh20inzDJ 6ERQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SqZhVjf7; 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 t8-20020a656088000000b0040d28f1a116si1394651pgu.328.2022.07.01.08.43.17; Fri, 01 Jul 2022 08:43:30 -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=pass header.i=@gmail.com header.s=20210112 header.b=SqZhVjf7; 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 S231259AbiGAPhA (ORCPT + 99 others); Fri, 1 Jul 2022 11:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbiGAPgu (ORCPT ); Fri, 1 Jul 2022 11:36:50 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4546939BA4; Fri, 1 Jul 2022 08:36:47 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id pk21so4776980ejb.2; Fri, 01 Jul 2022 08:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kVWP9v9nuRHyTkGEYSrcvx5uXVMOYJJ1wNoS0VDXg9k=; b=SqZhVjf7YNNWixNsKmBLY6iXajXocLtajbIf7Rwa4/DgzXmfZOf929koyVGp5a4cJM 9rrisSEADI6F7uCEphtjMSxcfpYNk6hkQn7MYGwsnEJI42VB5gSdrHMeISl1m0u/uNbM FKmTJpDjug72jjNeo2v6vGUKbrRVU6PK9rTE7g6l/txGHCOGAsbNNk3zbSU9w/LpDtbQ Qz0foezAvyKetuqKHK/Epagqzwa+luCiiN6hbGSzAqzVloMh5MoCcakiImRU8hb+v4tP LIlhFcBX1UfLysKyB5fLC+xNhn/ly0jvmTgqbw6LSKbR909kFJAWzGLH8VnoYHpd3R6d tXeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kVWP9v9nuRHyTkGEYSrcvx5uXVMOYJJ1wNoS0VDXg9k=; b=YKq8NJhHKbzPHz3BY36bJNlM9UQCfncHPgFHcTpxauBwqmWbXa7U5UBHv6XK8B4FIt kJd3AdUwblEUSOPIlbrWHg4ghyD6MXOGiY77pQ1DpTgy2OY5gPhI6GCj74I4DfD87+0n P0kN+gqDYU+PijmcnLtrcGyJoMImQOvFJOJX0IcwXk7EINu7pKx/7sHFuGLPrtHyzyem yj1z9rnFgxrg2ak/4UJYiQzjz8oxVoKOk8LntY+3bK2+wr0F2xsRzPPeCuyxyAV32fzB E1gSZNb4ckrK0Fy0Gl/fZJVPkOPpKa9XQR4r7MnQtZ6YJO5NCCL+oap1wa1QinGO+N40 cMmA== X-Gm-Message-State: AJIora95TztoNYBtbQegTcYwzOkNHYIdbrw5pY84kwrARFJlIWnH9x1w y0U3/M9T4NweWWv+u1UN1v8= X-Received: by 2002:a17:907:628a:b0:6fe:526c:ebc with SMTP id nd10-20020a170907628a00b006fe526c0ebcmr14194125ejc.531.1656689805755; Fri, 01 Jul 2022 08:36:45 -0700 (PDT) Received: from opensuse.localnet (host-79-53-109-127.retail.telecomitalia.it. [79.53.109.127]) by smtp.gmail.com with ESMTPSA id c12-20020a170906d18c00b00727c6da69besm3853562ejz.38.2022.07.01.08.36.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 08:36:44 -0700 (PDT) From: "Fabio M. De Francesco" To: Alexander Duyck Cc: Eric Dumazet , Maciej Fijalkowski , Jesper Dangaard Brouer , Daniel Borkmann , intel-wired-lan , Alexander Duyck , John Fastabend , Jesse Brandeburg , Alexei Starovoitov , Netdev , Jakub Kicinski , bpf , Paolo Abeni , Ira Weiny , "David S. Miller" , LKML Subject: Re: [Intel-wired-lan] [PATCH] ixgbe: Use kmap_local_page in ixgbe_check_lbtest_frame() Date: Fri, 01 Jul 2022 17:36:42 +0200 Message-ID: <2834855.e9J7NaK4W3@opensuse> In-Reply-To: References: <20220629085836.18042-1-fmdefrancesco@gmail.com> <2254584.ElGaqSPkdT@opensuse> 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,T_SCC_BODY_TEXT_LINE 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 gioved=C3=AC 30 giugno 2022 23:59:23 CEST Alexander Duyck wrote: > On Thu, Jun 30, 2022 at 11:18 AM Fabio M. De Francesco > wrote: > > > > On gioved=C3=AC 30 giugno 2022 18:09:18 CEST Alexander Duyck wrote: > > > On Thu, Jun 30, 2022 at 8:25 AM Eric Dumazet =20 wrote: > > > > > > > > On Thu, Jun 30, 2022 at 5:17 PM Alexander Duyck > > > > wrote: > > > > > > > > > > On Thu, Jun 30, 2022 at 3:10 AM Maciej Fijalkowski > > > > > wrote: > > > > > > > > > > > > On Wed, Jun 29, 2022 at 10:58:36AM +0200, Fabio M. De Francesco > > wrote: > > > > > > > The use of kmap() is being deprecated in favor of > > kmap_local_page(). > > > > > > > > > > > > > > With kmap_local_page(), the mapping is per thread, CPU local= =20 and > > not > > > > > > > globally visible. Furthermore, the mapping can be acquired=20 from > > any context > > > > > > > (including interrupts). > > > > > > > > > > > > > > Therefore, use kmap_local_page() in=20 ixgbe_check_lbtest_frame() > > because > > > > > > > this mapping is per thread, CPU local, and not globally=20 visible. > > > > > > > > > > > > Hi, > > > > > > > > > > > > I'd like to ask why kmap was there in the first place and not=20 plain > > > > > > page_address() ? > > > > > > > > > > > > Alex? > > > > > > > > > > The page_address function only works on architectures that have > > access > > > > > to all of physical memory via virtual memory addresses. The kmap > > > > > function is meant to take care of highmem which will need to be > > mapped > > > > > before it can be accessed. > > > > > > > > > > For non-highmem pages kmap just calls the page_address function. > > > > > https://elixir.bootlin.com/linux/latest/source/include/linux/ highmem-internal.h#L40 > > > > > > > > > > > > Sure, but drivers/net/ethernet/intel/ixgbe/ixgbe_main.c is=20 allocating > > > > pages that are not highmem ? > > > > > > > > This kmap() does not seem needed. > > > > > > Good point. So odds are page_address is fine to use. Actually there=20 is > > > a note to that effect in ixgbe_pull_tail. > > > > > > As such we could probably go through and update igb, and several of > > > the other Intel drivers as well. > > > > > > - Alex > > > > > I don't know this code, however I know kmap*(). > > > > I assumed that, if author used kmap(), there was possibility that the=20 page > > came from highmem. > > > > In that case kmap_local_page() looks correct here. > > > > However, now I read that that page _cannot_ come from highmem.=20 Therefore, > > page_address() would suffice. > > > > If you all want I can replace kmap() / kunmap() with a "plain" > > page_address(). Please let me know. > > > > Thanks, > > > > Fabio >=20 > Replacing it with just page_address() should be fine. Back when I > wrote the code I didn't realize that GFP_ATOMIC pages weren't > allocated from highmem so I suspect I just used kmap since it was the > way to cover all the bases. >=20 > Thanks, >=20 > - Alex >=20 OK, I'm about to prepare another patch with page_address() (obviously, this= =20 should be discarded). Last thing... Is that page allocated with dma_pool_alloc() at ixgbe/ixgbe_fcoe.c:196? Somewhere else? Thanks, =46abio P.S.: Can you say something about how pages are allocated in intel/e1000=20 and in intel/e1000e? I see that those drivers use kmap_atomic().