From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH bpf-next 02/15] xsk: add user memory registration support sockopt Date: Mon, 23 Apr 2018 23:11:37 +0300 Message-ID: <20180423231026-mutt-send-email-mst@kernel.org> References: <20180423135619.7179-1-bjorn.topel@gmail.com> <20180423135619.7179-3-bjorn.topel@gmail.com> <20180423190615-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: "Karlsson, Magnus" , "Duyck, Alexander H" , Alexander Duyck , John Fastabend , Alexei Starovoitov , Jesper Dangaard Brouer , Willem de Bruijn , Daniel Borkmann , Netdev , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , michael.lundkvist@ericsson.com, "Brandeburg, Jesse" , "Singhai, Anjali" , "Zhang, Qi Z" To: =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= Return-path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50774 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932393AbeDWULi (ORCPT ); Mon, 23 Apr 2018 16:11:38 -0400 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Apr 23, 2018 at 10:00:15PM +0200, Björn Töpel wrote: > 2018-04-23 18:18 GMT+02:00 Michael S. Tsirkin : > > [...] > > >> +static void xdp_umem_unpin_pages(struct xdp_umem *umem) > >> +{ > >> + unsigned int i; > >> + > >> + if (umem->pgs) { > >> + for (i = 0; i < umem->npgs; i++) > > > > Since you pin them with FOLL_WRITE, I assume these pages > > are written to. > > Don't you need set_page_dirty_lock here? > > > > Hmm, I actually *removed* it from the RFC V2, but after doing some > homework, I think you're right. Thanks for pointing this out! > > Thinking more about this; This function is called from sk_destruct, > and in the Tx case the sk_destruct can be called from interrupt > context, where set_page_dirty_lock cannot be called. > > Are there any preferred ways of solving this? Scheduling the whole > xsk_destruct call to a workqueue is one way (I think). Any > cleaner/better way? > > [...] Defer unpinning pages until the next tx call? > >> +static int __xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) > >> +{ > >> + u32 frame_size = mr->frame_size, frame_headroom = mr->frame_headroom; > >> + u64 addr = mr->addr, size = mr->len; > >> + unsigned int nframes; > >> + int size_chk, err; > >> + > >> + if (frame_size < XDP_UMEM_MIN_FRAME_SIZE || frame_size > PAGE_SIZE) { > >> + /* Strictly speaking we could support this, if: > >> + * - huge pages, or* > > > > what does "or*" here mean? > > > > Oops, I'll change to just 'or' in the next revision. > > > Thanks! > Björn