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.6 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 B2311C388F9 for ; Mon, 26 Oct 2020 22:03:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1473D2084C for ; Mon, 26 Oct 2020 22:03:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mvAStn/o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1473D2084C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 80D836B005C; Mon, 26 Oct 2020 18:03:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BC1A6B005D; Mon, 26 Oct 2020 18:03:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6846D6B0062; Mon, 26 Oct 2020 18:03:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id 372376B005C for ; Mon, 26 Oct 2020 18:03:54 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BC5F31EF1 for ; Mon, 26 Oct 2020 22:03:53 +0000 (UTC) X-FDA: 77415454746.20.magic85_0510c9c27276 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 9EA93180C07AF for ; Mon, 26 Oct 2020 22:03:53 +0000 (UTC) X-HE-Tag: magic85_0510c9c27276 X-Filterd-Recvd-Size: 12818 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 26 Oct 2020 22:03:53 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id t9so14617242wrq.11 for ; Mon, 26 Oct 2020 15:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=UZph9YDFnVBWNl2CHJ6aq7G08GSTpJx8UQf0r3junRY=; b=mvAStn/oyjUEYW+b6PIKeMRmeTNDG4/g2YKjfqeS8P2sw4YJTrEEH/iJICctkEfVcA S7830e1OGQ/KB0cKxep27xCN8rQPZvEqw2gSHgUu4RAmQoQycMaH4q7S2BmxIqwYhmj1 854vcVs79vnfgCroLgme3pNbYSfDdB8z5fQHs= 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=UZph9YDFnVBWNl2CHJ6aq7G08GSTpJx8UQf0r3junRY=; b=QSWkgSqISMTpmmwOhzD+er4nf5uv3L+tlVbAKdL9tG3yKk7bhow8Je/zEVXqPLQEnY lJ3LFTOUGGgQjrGGu3G1RaYEycvkeCcKI0iOF55l4Vuf+c/4xnebgIa8J7QgNwHEcay2 R1w1Z0T+4lftMUOo0zHEsk24oMgMOCCLClRD2omXb/atf25dehCXCiDkuXSaMhXxJGLx 8tvQ/izU/mLTnCxwIY9hXsHtm/7wtu0mqiM6qDy8Jrx2BJtQl/CFfFKF1NBPcVATCq8V Qnhm2aELTEtuJgCx/391riPdST9rdP7pK+udcDcTujasCAz5C+qhPiyVz17uyJCKyAVc mY1A== X-Gm-Message-State: AOAM532KoGTpm1u8et9dli4CqnaKclr94H6CUFoCTJetqdwuKZD4vyU8 VCvBr6qfy8eIn1BfJQbwAyuo0A== X-Google-Smtp-Source: ABdhPJw3fIO8fPo3S3fy5/5o+MHabEL5DjrpxhmTPaczsGMSjqk0zojmmpJWZOoy06udaiv5c3dsbA== X-Received: by 2002:adf:f247:: with SMTP id b7mr21635315wrp.56.1603749831961; Mon, 26 Oct 2020 15:03:51 -0700 (PDT) Received: from chromium.org (216.131.76.34.bc.googleusercontent.com. [34.76.131.216]) by smtp.gmail.com with ESMTPSA id n5sm24251098wrm.2.2020.10.26.15.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Oct 2020 15:03:51 -0700 (PDT) Date: Mon, 26 Oct 2020 22:03:50 +0000 From: Tomasz Figa To: Daniel Vetter Cc: 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 , Mauro Carvalho Chehab , Daniel Vetter , Jason Gunthorpe , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Mauro Carvalho Chehab , Andrew Morton , =?iso-8859-1?B?Suly9G1l?= Glisse , Jan Kara , Dan Williams Subject: Re: [PATCH v4 06/15] media: videobuf2: Move frame_vector into media subsystem Message-ID: <20201026220350.GB2802004@chromium.org> References: <20201026105818.2585306-1-daniel.vetter@ffwll.ch> <20201026105818.2585306-7-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20201026105818.2585306-7-daniel.vetter@ffwll.ch> 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 Mon, Oct 26, 2020 at 11:58:09AM +0100, Daniel Vetter wrote: > It's the only user. This also garbage collects the CONFIG_FRAME_VECTOR > symbol from all over the tree (well just one place, somehow omap media > driver still had this in its Kconfig, despite not using it). >=20 > Reviewed-by: John Hubbard > Acked-by: Mauro Carvalho Chehab > 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 > Signed-off-by: Daniel Vetter > -- > v3: > - Create a new frame_vector.h header for this (Mauro) > --- > 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/frame_vector.h | 47 +++++++++++++++++++ > include/media/videobuf2-core.h | 1 + > mm/Kconfig | 3 -- > mm/Makefile | 1 - > 9 files changed, 51 insertions(+), 48 deletions(-) > rename {mm =3D> drivers/media/common/videobuf2}/frame_vector.c (99%) > create mode 100644 include/media/frame_vector.h >=20 Acked-by: Tomasz Figa Best regards, Tomasz > diff --git a/drivers/media/common/videobuf2/Kconfig b/drivers/media/com= mon/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/co= mmon/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_v= ector.c > similarity index 99% > rename from mm/frame_vector.c > rename to drivers/media/common/videobuf2/frame_vector.c > index d44779e56313..6590987c14bd 100644 > --- a/mm/frame_vector.c > +++ b/drivers/media/common/videobuf2/frame_vector.c > @@ -8,6 +8,8 @@ > #include > #include > =20 > +#include > + > /** > * get_vaddr_frames() - map virtual addresses to pfns > * @start: starting user address > diff --git a/drivers/media/platform/omap/Kconfig b/drivers/media/platfo= rm/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, unsi= gned long pages, bool inc); > int __account_locked_vm(struct mm_struct *mm, unsigned long pages, boo= l 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 *vec= ) > -{ > - return vec->nr_frames; > -} > - > -static inline struct page **frame_vector_pages(struct frame_vector *ve= c) > -{ > - 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 *ve= c) > -{ > - 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/frame_vector.h b/include/media/frame_vector.= h > new file mode 100644 > index 000000000000..1ed0cd64510d > --- /dev/null > +++ b/include/media/frame_vector.h > @@ -0,0 +1,47 @@ > +// SPDX-License-Identifier: GPL-2.0 > +#ifndef _MEDIA_FRAME_VECTOR_H > +#define _MEDIA_FRAME_VECTOR_H > + > +/* 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 *vec= ) > +{ > + return vec->nr_frames; > +} > + > +static inline struct page **frame_vector_pages(struct frame_vector *ve= c) > +{ > + 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 *ve= c) > +{ > + if (!vec->is_pfns) > + frame_vector_to_pfns(vec); > + return (unsigned long *)(vec->ptrs); > +} > + > +#endif /* _MEDIA_FRAME_VECTOR_H */ > diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-c= ore.h > index bbb3f26fbde9..d045e3a5a1d8 100644 > --- a/include/media/videobuf2-core.h > +++ b/include/media/videobuf2-core.h > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > =20 > #define VB2_MAX_FRAME (32) > #define VB2_MAX_PLANES (8) > 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 > 2.28.0 >=20