Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4827927rwd; Sat, 17 Jun 2023 23:32:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dy2L4pu37NaKsK1+8xmcZmJL1fXVgPTD4ZosHLG/HL9UTPDhfwdIHgw2/TpPIVgfSN+Bf X-Received: by 2002:a05:6808:1904:b0:398:27d3:1fc3 with SMTP id bf4-20020a056808190400b0039827d31fc3mr9149046oib.42.1687069929158; Sat, 17 Jun 2023 23:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687069929; cv=none; d=google.com; s=arc-20160816; b=YjkNygjPWfTEf3Sm1s/gGFrOlG+L3uKWPlit9jZcTEJ1Dmr7c2AYMejYnbNJOg5Mlm tXmXYiBUxUU/lkH9JIh4YIdh05lGajQ/YDk6EcwqnqsXL10blaK73ciwJd/5Sw0rR/L6 cMayL0QRBJUsTK4WbIBEAU481Xz4HD1k2OVcdTtyLhMZFmVHsFirGzZNfrLWO2bNwmqA SPD9t1hpZpkLX9/hByUSmOsWH8IR14NLDB+Ur2t1AGTwUArkoCedqjp28neJijNL8v0C 9yiyme9jHSTihYS1swmGTt1BxnjOfV86kqzLoKPSHA0X44nntKNnh74Vv/huCEj8Bl2J kpbg== 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=J+qqsqpcmp1BNuckvDBNutT1wsju4zMnJ/FPnqSF/3I=; b=VibBnh7KFNVaF/lQh5Ru71HVOdTMk1fO/8RdGtMDBUNskhXPBY/nkgjv8hGJicweuh +7xFGVwRhrNV++gxvUuxMe7RGp3wm/MMqg8oiNME0xOho00Hz+jbpW7yxin+sVskAloC Hkt16tw8N2f9gtCgD8J2CtVtVcjlSCrB74Ow6THKKTyxo8NZfT9oMz7S4wO+ROl62gnr xs3553VDhYISj5fHjRZiarmkSQx3aH4U2zCptHvi57wACAXuYzwDiCctxb+wDEMe6G1k MQCfdrn2ae9Mp2UvcLMZwR7IBndom5vfqsD8kUpzGYfMbO5EtsDrNg7V0JbekaYXGfuR Qakg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=lalI1AI7; 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 z2-20020aa79482000000b00668724d0816si1002385pfk.38.2023.06.17.23.31.55; Sat, 17 Jun 2023 23:32:09 -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=20221208 header.b=lalI1AI7; 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 S229520AbjFRFHI (ORCPT + 99 others); Sun, 18 Jun 2023 01:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjFRFHH (ORCPT ); Sun, 18 Jun 2023 01:07:07 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E495E137; Sat, 17 Jun 2023 22:07:05 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3111547c8f9so2353323f8f.1; Sat, 17 Jun 2023 22:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687064824; x=1689656824; 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=J+qqsqpcmp1BNuckvDBNutT1wsju4zMnJ/FPnqSF/3I=; b=lalI1AI7uebE7hPNOhbKNNQC24Lh5BL1X/SgQMnMTwRk+fvPSCcVn0KajZnibVQX+a QzoW9DNa2quSr6CQiYd9M9vcaTiKmcMUToe7KmIBRdux7BBFdr8tQ5dWM/40KJCxQrqn P8dKrQkQzZKCrEqAuoKBglwhZ7BBGvRsmZ0x+lXytN98bc/QKCG/tzckuHudZqbmi1fI Lgqm/Hbsiigmhmk/tgNTT3n4htYQQUWJFLhaiG2qm2SmjlBzsGAfhBsUVgxjpvQG4xP+ kJMyJQzzbCDEVVYQEUxumz1+t/Fu74q61/ePHBwaSh9krXhswGKFSfXaOGOBssBY1puc G/ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687064824; x=1689656824; 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=J+qqsqpcmp1BNuckvDBNutT1wsju4zMnJ/FPnqSF/3I=; b=kuFbwDzbTjmW9EXsr3/t3LgTnmGrGh1kOj7GbGDji5mh1gcW2g5Q64Lw2upXm6BcoL 1g5v14suILLqV7eS/Ew9jYJNIBIuW0cDwLHpf4Gg3AOzkbYqqSEd101SZiGtr+YHCdiY WPwq07+rbBPj8rzSbazGZCTGigHZAVzWyHgcwN3OAAGfLNCX/dlczRS5fPfzwcK28Fbv CcoAAr3Lq2Pzh2Dul3E/SdCzoGLJRRX0pdz32JpTMd86omh1F1n3Wvo+EPEcRc8KGgks x9YZgLZWQyUW5Guqm6LWeC8HRXm9623c4nwi6ebw3Kud5Ybrkej13O69l2x7wVrLdq0m 7WqA== X-Gm-Message-State: AC+VfDwHoX4T/UKqQ3+o3FKxa/HAVm7QDJIj1uJtXSKXQe5Yq6A37YY3 /LzFz7Ccsl7Ogg117fWckZpw8mZvjxg= X-Received: by 2002:adf:db47:0:b0:30f:c6c3:e6d9 with SMTP id f7-20020adfdb47000000b0030fc6c3e6d9mr5011298wrj.46.1687064824120; Sat, 17 Jun 2023 22:07:04 -0700 (PDT) Received: from suse.localnet (host-79-26-32-1.retail.telecomitalia.it. [79.26.32.1]) by smtp.gmail.com with ESMTPSA id e8-20020adff348000000b00304adbeeabbsm27943038wrp.99.2023.06.17.22.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jun 2023 22:07:03 -0700 (PDT) From: "Fabio M. De Francesco" To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Sumitra Sharma Cc: Ira Weiny , Deepak R Varma Subject: Re: [PATCH v2] lib/test_bpf: Call page_address() on page acquired with GFP_KERNEL flag Date: Sun, 18 Jun 2023 07:07:00 +0200 Message-ID: <3564297.R56niFO833@suse> In-Reply-To: <20230613071756.GA359746@sumitra.com> References: <20230613071756.GA359746@sumitra.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" 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 marted=EC 13 giugno 2023 09:17:56 CEST Sumitra Sharma wrote: > generate_test_data() acquires a page with alloc_page(GFP_KERNEL). Pages > allocated with GFP_KERNEL cannot come from Highmem. This is why > there is no need to call kmap() on them. >=20 > Therefore, use a plain page_address() on that page. >=20 > Suggested-by: Fabio M. De Francesco > Signed-off-by: Sumitra Sharma > --- >=20 > Changes in v2: > - Remove the kmap() call and call page_address() instead. NIT: Give credit to whom asked you for this removal and explain why the=20 mapping is not required. > - Change the commit subject and message. >=20 > lib/test_bpf.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) >=20 > diff --git a/lib/test_bpf.c b/lib/test_bpf.c > index ade9ac672adb..70fcd0bcf14b 100644 > --- a/lib/test_bpf.c > +++ b/lib/test_bpf.c > @@ -14388,11 +14388,10 @@ static void *generate_test_data(struct bpf_test > *test, int sub) if (!page) > goto err_kfree_skb; >=20 > - ptr =3D kmap(page); > + ptr =3D page_address(page); > if (!ptr) > goto err_free_page; What is the reason of this test? Could "ptr" ever be NULL? What is the code= =20 checking just few lines above this latter test? Please, take a deeper look at this function as a whole. =46abio > memcpy(ptr, test->frag_data, MAX_DATA); > - kunmap(page); > skb_add_rx_frag(skb, 0, page, 0, MAX_DATA, MAX_DATA); > } >=20 > -- > 2.25.1