From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3279EC433DF for ; Fri, 9 Oct 2020 16:57:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 163062225F for ; Fri, 9 Oct 2020 16:57:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="PkNBVdrv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 163062225F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 89B1A6B005C; Fri, 9 Oct 2020 12:57:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 825C66B0071; Fri, 9 Oct 2020 12:57:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EC9B6B0073; Fri, 9 Oct 2020 12:57:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 387D06B005C for ; Fri, 9 Oct 2020 12:57:47 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B6BFC362C for ; Fri, 9 Oct 2020 16:57:46 +0000 (UTC) X-FDA: 77352993732.23.toys91_3a012e0271e2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 97FE337604 for ; Fri, 9 Oct 2020 16:57:46 +0000 (UTC) X-HE-Tag: toys91_3a012e0271e2 X-Filterd-Recvd-Size: 13986 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Fri, 9 Oct 2020 16:57:45 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id d3so10504811wma.4 for ; Fri, 09 Oct 2020 09:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=0pLn82IbgQV35wH4ma+k0406StKvwf+W3mj4bGhZifE=; b=PkNBVdrvO/SF2HUY/SBKzGH/JIbyGv1X7JVHwyRp2NMGmrRwPiJ8YO5KTnNxVs/DTR h+yXL8eb2mq4/cn2Dwt59h04BZYPDMJfUrNOEQpyRhv358eWBm8iMQ4wuE8aH+K/XoWv VQPgSPuQrV1mjqwCbrtPywjhk1nkKWI7znRiE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=0pLn82IbgQV35wH4ma+k0406StKvwf+W3mj4bGhZifE=; b=V0P5SzWeIhdcb2mSdYMYvQibaravbNQl86ySk/2SRgcmtRyUFVw7c9rMgZ8Uw48MyG dyvI/jtsVIVkDw4tZxXPv4UE0bYJG4OplDVGtiqJx7Z5EHaQMTa0NKghUzqg9KhKJaae nO2URmM50pwfOGARkMcfhMNITKSZMpsh9FgLkXTGaTmPygVrl0s9z4lFAK1AD2a63v8u gJ+yy5jZmxMZFaFeLKAmLevmBGClxzKTWL7+ULvynwpQ9MVbPRlLC0rwxwg1CSqznxiQ +jMdv1Rzhy41m/GeysyLu7Ml4qpDvR7mFffMZW7NMxUmWg7We5rFKdorU/JDzZ/YEwCc 85ng== X-Gm-Message-State: AOAM530Pbsq9AsVhyGpe61nWg6iVEt3+LOwAHXwJzmMYrLyiy4gMMfmN a8C5D2wxkLjtZnGz33rMkSx9HA== X-Google-Smtp-Source: ABdhPJzWm2EDClZGBoeRp2koRpZWB9TbXgl54u2KDWSi+G0UmCpXfa0O1HJTk/LTlflMGH/BrzAI9Q== X-Received: by 2002:a1c:9ad0:: with SMTP id c199mr15291080wme.54.1602262664449; Fri, 09 Oct 2020 09:57:44 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id n10sm12381658wmk.7.2020.10.09.09.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 09:57:43 -0700 (PDT) Date: Fri, 9 Oct 2020 18:57:40 +0200 From: Daniel Vetter To: Mauro Carvalho Chehab Cc: Daniel Vetter , DRI Development , LKML , kvm@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org, linux-s390@vger.kernel.org, John Hubbard , Daniel Vetter , Jason Gunthorpe , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Tomasz Figa , Andrew Morton , =?iso-8859-1?B?Suly9G1l?= Glisse , Jan Kara , Dan Williams Subject: Re: [PATCH v2 06/17] media: videobuf2: Move frame_vector into media subsystem Message-ID: <20201009165740.GP438822@phenom.ffwll.local> Mail-Followup-To: Mauro Carvalho Chehab , DRI Development , LKML , kvm@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org, linux-s390@vger.kernel.org, John Hubbard , Daniel Vetter , Jason Gunthorpe , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Tomasz Figa , Andrew Morton , =?iso-8859-1?B?Suly9G1l?= Glisse , Jan Kara , Dan Williams References: <20201009075934.3509076-1-daniel.vetter@ffwll.ch> <20201009075934.3509076-7-daniel.vetter@ffwll.ch> <20201009121417.115db7d9@coco.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20201009121417.115db7d9@coco.lan> X-Operating-System: Linux phenom 5.7.0-1-amd64 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Oct 09, 2020 at 12:14:17PM +0200, Mauro Carvalho Chehab wrote: > Em Fri, 9 Oct 2020 09:59:23 +0200 > Daniel Vetter escreveu: >=20 > > It's the only user. This also garbage collects the CONFIG_FRAME_VECTO= R > > symbol from all over the tree (well just one place, somehow omap medi= a > > driver still had this in its Kconfig, despite not using it). > >=20 > > Reviewed-by: John Hubbard > > Signed-off-by: Daniel Vetter > > Cc: Jason Gunthorpe > > Cc: Pawel Osciak > > Cc: Marek Szyprowski > > Cc: Kyungmin Park > > Cc: Tomasz Figa > > Cc: Mauro Carvalho Chehab > > Cc: Andrew Morton > > Cc: John Hubbard > > Cc: J=E9r=F4me Glisse > > Cc: Jan Kara > > Cc: Dan Williams > > Cc: linux-mm@kvack.org > > Cc: linux-arm-kernel@lists.infradead.org > > Cc: linux-samsung-soc@vger.kernel.org > > Cc: linux-media@vger.kernel.org > > Cc: Daniel Vetter > > --- > > drivers/media/common/videobuf2/Kconfig | 1 - > > drivers/media/common/videobuf2/Makefile | 1 + > > .../media/common/videobuf2}/frame_vector.c | 2 + > > drivers/media/platform/omap/Kconfig | 1 - > > include/linux/mm.h | 42 -----------------= -- > > include/media/videobuf2-core.h | 42 +++++++++++++++++= ++ > > mm/Kconfig | 3 -- > > mm/Makefile | 1 - > > 8 files changed, 45 insertions(+), 48 deletions(-) > > rename {mm =3D> drivers/media/common/videobuf2}/frame_vector.c (99%) > >=20 > > diff --git a/drivers/media/common/videobuf2/Kconfig b/drivers/media/c= ommon/videobuf2/Kconfig > > index edbc99ebba87..d2223a12c95f 100644 > > --- a/drivers/media/common/videobuf2/Kconfig > > +++ b/drivers/media/common/videobuf2/Kconfig > > @@ -9,7 +9,6 @@ config VIDEOBUF2_V4L2 > > =20 > > config VIDEOBUF2_MEMOPS > > tristate > > - select FRAME_VECTOR > > =20 > > config VIDEOBUF2_DMA_CONTIG > > tristate > > diff --git a/drivers/media/common/videobuf2/Makefile b/drivers/media/= common/videobuf2/Makefile > > index 77bebe8b202f..54306f8d096c 100644 > > --- a/drivers/media/common/videobuf2/Makefile > > +++ b/drivers/media/common/videobuf2/Makefile > > @@ -1,5 +1,6 @@ > > # SPDX-License-Identifier: GPL-2.0 > > videobuf2-common-objs :=3D videobuf2-core.o > > +videobuf2-common-objs +=3D frame_vector.o > > =20 > > ifeq ($(CONFIG_TRACEPOINTS),y) > > videobuf2-common-objs +=3D vb2-trace.o > > diff --git a/mm/frame_vector.c b/drivers/media/common/videobuf2/frame= _vector.c > > similarity index 99% > > rename from mm/frame_vector.c > > rename to drivers/media/common/videobuf2/frame_vector.c > > index d44779e56313..2b0b97761d15 100644 > > --- a/mm/frame_vector.c > > +++ b/drivers/media/common/videobuf2/frame_vector.c > > @@ -8,6 +8,8 @@ > > #include > > #include > > =20 > > +#include > > + >=20 > See my comment below... >=20 > > /** > > * get_vaddr_frames() - map virtual addresses to pfns > > * @start: starting user address > > diff --git a/drivers/media/platform/omap/Kconfig b/drivers/media/plat= form/omap/Kconfig > > index f73b5893220d..de16de46c0f4 100644 > > --- a/drivers/media/platform/omap/Kconfig > > +++ b/drivers/media/platform/omap/Kconfig > > @@ -12,6 +12,5 @@ config VIDEO_OMAP2_VOUT > > depends on VIDEO_V4L2 > > select VIDEOBUF2_DMA_CONTIG > > select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3 > > - select FRAME_VECTOR > > help > > V4L2 Display driver support for OMAP2/3 based boards. > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index 16b799a0522c..acd60fbf1a5a 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -1743,48 +1743,6 @@ int account_locked_vm(struct mm_struct *mm, un= signed long pages, bool inc); > > int __account_locked_vm(struct mm_struct *mm, unsigned long pages, b= ool inc, > > struct task_struct *task, bool bypass_rlim); > > =20 > > -/* Container for pinned pfns / pages */ > > -struct frame_vector { > > - unsigned int nr_allocated; /* Number of frames we have space for */ > > - unsigned int nr_frames; /* Number of frames stored in ptrs array */ > > - bool got_ref; /* Did we pin pages by getting page ref? */ > > - bool is_pfns; /* Does array contain pages or pfns? */ > > - void *ptrs[]; /* Array of pinned pfns / pages. Use > > - * pfns_vector_pages() or pfns_vector_pfns() > > - * for access */ > > -}; > > - > > -struct frame_vector *frame_vector_create(unsigned int nr_frames); > > -void frame_vector_destroy(struct frame_vector *vec); > > -int get_vaddr_frames(unsigned long start, unsigned int nr_pfns, > > - unsigned int gup_flags, struct frame_vector *vec); > > -void put_vaddr_frames(struct frame_vector *vec); > > -int frame_vector_to_pages(struct frame_vector *vec); > > -void frame_vector_to_pfns(struct frame_vector *vec); > > - > > -static inline unsigned int frame_vector_count(struct frame_vector *v= ec) > > -{ > > - return vec->nr_frames; > > -} > > - > > -static inline struct page **frame_vector_pages(struct frame_vector *= vec) > > -{ > > - if (vec->is_pfns) { > > - int err =3D frame_vector_to_pages(vec); > > - > > - if (err) > > - return ERR_PTR(err); > > - } > > - return (struct page **)(vec->ptrs); > > -} > > - > > -static inline unsigned long *frame_vector_pfns(struct frame_vector *= vec) > > -{ > > - if (!vec->is_pfns) > > - frame_vector_to_pfns(vec); > > - return (unsigned long *)(vec->ptrs); > > -} > > - > > struct kvec; > > int get_kernel_pages(const struct kvec *iov, int nr_pages, int write= , > > struct page **pages); > > diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2= -core.h > > index bbb3f26fbde9..a2e75ca0334f 100644 > > --- a/include/media/videobuf2-core.h > > +++ b/include/media/videobuf2-core.h > > @@ -1254,4 +1254,46 @@ bool vb2_request_object_is_buffer(struct media= _request_object *obj); > > */ > > unsigned int vb2_request_buffer_cnt(struct media_request *req); > > =20 > > +/* Container for pinned pfns / pages in frame_vector.c */ > > +struct frame_vector { > > + unsigned int nr_allocated; /* Number of frames we have space for */ > > + unsigned int nr_frames; /* Number of frames stored in ptrs array */ > > + bool got_ref; /* Did we pin pages by getting page ref? */ > > + bool is_pfns; /* Does array contain pages or pfns? */ > > + void *ptrs[]; /* Array of pinned pfns / pages. Use > > + * pfns_vector_pages() or pfns_vector_pfns() > > + * for access */ > > +}; > > + > > +struct frame_vector *frame_vector_create(unsigned int nr_frames); > > +void frame_vector_destroy(struct frame_vector *vec); > > +int get_vaddr_frames(unsigned long start, unsigned int nr_pfns, > > + unsigned int gup_flags, struct frame_vector *vec); > > +void put_vaddr_frames(struct frame_vector *vec); > > +int frame_vector_to_pages(struct frame_vector *vec); > > +void frame_vector_to_pfns(struct frame_vector *vec); > > + > > +static inline unsigned int frame_vector_count(struct frame_vector *v= ec) > > +{ > > + return vec->nr_frames; > > +} > > + > > +static inline struct page **frame_vector_pages(struct frame_vector *= vec) > > +{ > > + if (vec->is_pfns) { > > + int err =3D frame_vector_to_pages(vec); > > + > > + if (err) > > + return ERR_PTR(err); > > + } > > + return (struct page **)(vec->ptrs); > > +} > > + > > +static inline unsigned long *frame_vector_pfns(struct frame_vector *= vec) > > +{ > > + if (!vec->is_pfns) > > + frame_vector_to_pfns(vec); > > + return (unsigned long *)(vec->ptrs); > > +} > > + > > #endif /* _MEDIA_VIDEOBUF2_CORE_H */ >=20 > Please place those into a include/media/frame_vector.h file, instead of > merging it directly at vb2 core header. >=20 > Then include the new header at videobuf2-core.h and at frame_vector.c. Makes sense, I'll do that for v3. > With such changes: >=20 > Acked-by: Mauro Carvalho Chehab Thanks for taking a look. -Daniel >=20 > > diff --git a/mm/Kconfig b/mm/Kconfig > > index 6c974888f86f..da6c943fe9f1 100644 > > --- a/mm/Kconfig > > +++ b/mm/Kconfig > > @@ -815,9 +815,6 @@ config DEVICE_PRIVATE > > memory; i.e., memory that is only accessible from the device (or > > group of devices). You likely also want to select HMM_MIRROR. > > =20 > > -config FRAME_VECTOR > > - bool > > - > > config ARCH_USES_HIGH_VMA_FLAGS > > bool > > config ARCH_HAS_PKEYS > > diff --git a/mm/Makefile b/mm/Makefile > > index d5649f1c12c0..a025fd6c6afd 100644 > > --- a/mm/Makefile > > +++ b/mm/Makefile > > @@ -111,7 +111,6 @@ obj-$(CONFIG_PAGE_EXTENSION) +=3D page_ext.o > > obj-$(CONFIG_CMA_DEBUGFS) +=3D cma_debug.o > > obj-$(CONFIG_USERFAULTFD) +=3D userfaultfd.o > > obj-$(CONFIG_IDLE_PAGE_TRACKING) +=3D page_idle.o > > -obj-$(CONFIG_FRAME_VECTOR) +=3D frame_vector.o > > obj-$(CONFIG_DEBUG_PAGE_REF) +=3D debug_page_ref.o > > obj-$(CONFIG_HARDENED_USERCOPY) +=3D usercopy.o > > obj-$(CONFIG_PERCPU_STATS) +=3D percpu-stats.o >=20 >=20 >=20 > Thanks, > Mauro --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch