From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B7273427E2; Mon, 20 Mar 2023 14:01:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A746A40A7F; Mon, 20 Mar 2023 14:01:32 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id A8ABC406BC for ; Mon, 20 Mar 2023 14:01:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679317291; h=from:from: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; bh=gWPZ8wOI6aKV7DPXHZFChiRBiqTFFibM0M8YazHYjkw=; b=Bu1wWX1R5ckueYiNwmpXSVdc+cXwI3MQ+juC8LDXWSD/pLIYNJtF8lWBM6CMd7PbdFPZrp onHMkLwxVHfYiegCKLbHDhhsBBnyByu7YgBx1w2g+hDdQVnxKr4G+eMPEQ5MePKPtbqPpx uI6MxvOmWuDLH6nS+0S0gSUQV+uvfJM= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-NRP_gCH_MmuOpHZ23gwQvA-1; Mon, 20 Mar 2023 09:01:29 -0400 X-MC-Unique: NRP_gCH_MmuOpHZ23gwQvA-1 Received: by mail-pl1-f198.google.com with SMTP id i6-20020a170902c94600b0019d16e4ac0bso7093258pla.5 for ; Mon, 20 Mar 2023 06:01:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679317288; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gWPZ8wOI6aKV7DPXHZFChiRBiqTFFibM0M8YazHYjkw=; b=bUgdxe9t7KXujwkoDnXpJRBASAaYvYyLqHnT7nuSKp3zxHWkozXFD1nlsO5701grrg G1sTkUzqoLZNSIjU0v3r1ne38mfQPqSdNoIZBYKLEGcaU6WBYgZ8JSYm76Vz812jI+nm O6/GBTl8cr+y0KaTQU+iCuY2gLGR3Feysll9fZNGM0L4lsaFmPccu5izUfi8y9zC4+rO DM0EJcN7bP05pMun0UY5MzlpR5xiwemnrUU0cETEzoO90NOne12/lMWHtoywzIvRYV3I Awy5wDKaO3fbxPycpNPstt18C2BRVtQo57s+Mf5a9Z5j/8K+bMOQqojgDMfw7nZt2140 IZaA== X-Gm-Message-State: AO0yUKUWEdb8F6SXlRusCPHOhBC0KtPUE/l5/ml5/He8Zv/p/oyz2C1W ZpkW9aPweN7Ssk8+Ahu+76vFVjTOS+jim3uN643TuAaCCkhTCbvEiwINl2aXLSyJwtaIgxI7j5O iz5hwNt7w3i8eBG1G5vOV9WJLNS32RQ== X-Received: by 2002:a65:56c2:0:b0:4fc:7e60:d0c with SMTP id w2-20020a6556c2000000b004fc7e600d0cmr1822476pgs.11.1679317288428; Mon, 20 Mar 2023 06:01:28 -0700 (PDT) X-Google-Smtp-Source: AK7set8hNuQcw2afCv5BWXAVKv+IWIP2AdGRA23yk6DQXiV5D6TQnzPIZ9+z6YagQnrvYUz0qoq7jUP5HgYsYRDka+o= X-Received: by 2002:a65:56c2:0:b0:4fc:7e60:d0c with SMTP id w2-20020a6556c2000000b004fc7e600d0cmr1822465pgs.11.1679317288103; Mon, 20 Mar 2023 06:01:28 -0700 (PDT) MIME-Version: 1.0 References: <20230228172909.2054386-1-ferruh.yigit@amd.com> In-Reply-To: From: David Marchand Date: Mon, 20 Mar 2023 14:01:16 +0100 Message-ID: Subject: Re: [PATCH] kni: fix build with Linux 6.3 To: Ferruh Yigit , Vamsi Attunuru , Kiran Kumar Kokkilagadda , Jerin Jacob Kollanukkaran Cc: dev@dpdk.org, Thomas Monjalon X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Mar 20, 2023 at 1:10=E2=80=AFPM David Marchand wrote: > > On Tue, Feb 28, 2023 at 9:45=E2=80=AFPM David Marchand > wrote: > > > > On Tue, Feb 28, 2023 at 6:29 PM Ferruh Yigit wro= te: > > > > > > KNI calls `get_user_pages_remote()` API which is using `FOLL_TOUCH` > > > flag, but `FOLL_TOUCH` is no more in public headers since v6.3, > > > causing a build error. > > > > Something looks strange with what kni was doing. > > > > Looking at get_user_pages_remote implementation, I see it internally > > passes FOLL_TOUCH in addition to passed gup_flags. > > And looking at FOLL_TOUCH definition, it seems natural (to me) that > > this flag would be handled internally. > > > > Maybe it changed over time... but then the question is when did > > passing FOLL_TOUCH become unneeded? > > Here is some more info. > > get_user_pages_remote() was added in kernel commit 1e9877902dc7 > ("mm/gup: Introduce get_user_pages_remote()"). > At this time, it was passing the FOLL_TOUCH flag internally. > > +long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm= , > + unsigned long start, unsigned long nr_pages, > + int write, int force, struct page **pages, > + struct vm_area_struct **vmas) > { > return __get_user_pages_locked(tsk, mm, start, nr_pages, write, f= orce, > - pages, vmas, NULL, false, FOLL_TOU= CH); > + pages, vmas, NULL, false, > + FOLL_TOUCH | FOLL_REMOTE); > +} > +EXPORT_SYMBOL(get_user_pages_remote); > > get_user_pages_remote() later gained the ability to pass gup flags in > kernel commit 9beae1ea8930 ("mm: replace get_user_pages_remote() > write/force parameters with gup_flags"). > But FOLL_TOUCH was still added internally. > > long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm= , > unsigned long start, unsigned long nr_pages, > - int write, int force, struct page **pages, > + unsigned int gup_flags, struct page **pages, > struct vm_area_struct **vmas) > { > - unsigned int flags =3D FOLL_TOUCH | FOLL_REMOTE; > - > - if (write) > - flags |=3D FOLL_WRITE; > - if (force) > - flags |=3D FOLL_FORCE; > - > return __get_user_pages_locked(tsk, mm, start, nr_pages, pages, v= mas, > - NULL, false, flags); > + NULL, false, > + gup_flags | FOLL_TOUCH | FOLL_REMO= TE); > } > > > There were other changes in this area of the kernel code, but I did > not notice a change in relation with FOLL_TOUCH. > > So I think the dpdk commit e73831dc6c26 ("kni: support userspace VA") > uselessly introduced call to this flag and we can remove it. > Adding author and reviewers of this change. Alternatively, we could go with passing 0 in flags when FOLL_TOUCH is not exported. Something like: diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h index 7aa6cd9fca..3164a48971 100644 --- a/kernel/linux/kni/compat.h +++ b/kernel/linux/kni/compat.h @@ -129,6 +129,14 @@ */ #if KERNEL_VERSION(4, 10, 0) <=3D LINUX_VERSION_CODE #define HAVE_IOVA_TO_KVA_MAPPING_SUPPORT + +/* + * get_user_pages_remote() should not require the flag FOLL_TOUCH to be pa= ssed. + * Simply pass it as 0 when this flag is internal and not exported anymore= . + */ +#ifndef FOLL_TOUCH +#define FOLL_TOUCH 0 +#endif #endif #if KERNEL_VERSION(5, 6, 0) <=3D LINUX_VERSION_CODE || \ --=20 David Marchand