From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sowmini Varadhan Subject: Re: [PATCH RFC net-next 1/6] sock: MSG_PEEK support for sk_error_queue Date: Thu, 18 Jan 2018 12:12:51 -0500 Message-ID: <20180118171251.GD24553@oracle.com> References: <05d060dc1169649d84c37ad51b0f8fe54a2a3185.1516147540.git.sowmini.varadhan@oracle.com> <20180118110207.GA24920@oracle.com> <1516290887.3606.21.camel@gmail.com> <20180118161048.GB24553@oracle.com> <1516294395.3606.23.camel@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Willem de Bruijn , Network Development , David Miller , rds-devel@oss.oracle.com, santosh.shilimkar@oracle.com To: Eric Dumazet Return-path: Received: from aserp2130.oracle.com ([141.146.126.79]:42764 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932483AbeARRXA (ORCPT ); Thu, 18 Jan 2018 12:23:00 -0500 Content-Disposition: inline In-Reply-To: <1516294395.3606.23.camel@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On (01/18/18 08:53), Eric Dumazet wrote: > > The thing is : MSG_PEEK 'support' will also need SO_PEEK_OFF support. sure, I'll drop the MSG_PEEK idea (which I wasnt very thrilled about anyway) > So lets properly design things, and not re-use legacy stuff that is > proven to be not multi-thread ready and too complex. > > If you want to design a new channel of communication, do it, and > maintain it. My instinct is to go with the fixed size ancillary data- which itself allows 2 options: 1. cmsg_data has a sock_extended_err preamble with ee_origin = SO_EE_ORIGIN_ZEROCOPY_COOKIE (or similar), and the ee_data is an array of 32 bit cookies (can pack at most 8 32-bit cookies, if we want to pack this into an skb->cb) Using the sock_extended_err as preamble will allow this to be usable by existing tcp zcopy applications (they can use the ee_origin to find out if this a batch of cookies or the existing hi/lo values). 2. If we have the option of passing completion-notification up as ancillary data on the pollin/recvmsg channel itself (instead of MSG_ERRQUEUE) we dont have to try to retain "backward compat" to the SO_EE_ORIGIN_ZEROCOPY API: we can just use a completely new data struct for the notification and potentially pack more cookies into 48 bytes (RDS could be the first guinea pig for this- doesnt even have to be done across all protocol families on day-1). I think the shmem channel suggestion would be an optional optimization that can be added later- it may not even be necessary, since most applications will likely be sending *and* receiving data, so passing up cookies with recvmsg should be "good enough" to save syscall overhead for the common case. I can work #2, if there are no objections to it. --Sowmini