From owner-freebsd-current@FreeBSD.ORG Tue May 28 09:51:58 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6CF7BB10 for ; Tue, 28 May 2013 09:51:58 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx1.freebsd.org (Postfix) with ESMTP id EC8608BE for ; Tue, 28 May 2013 09:51:57 +0000 (UTC) Received: by mail-lb0-f173.google.com with SMTP id t10so7585185lbi.32 for ; Tue, 28 May 2013 02:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=OkWxA6bErHtDlXWo7Q1sWODMuUXQQ98sX3oNBx7FSKo=; b=mf07nE2C2cJ1ZO4lghnjhEuO4SkFyzVhl5Uq+U15AB1Io5YBHA/1hhTgYIvA8yAtMb zbLMGz3M1O9FErdS1kQhPoG23qA+sw9+p6kBgAKQg9vypsyJGRfu3PW79lr5PvpQZgPC Rp5Jrx/10QzoUjYRG6S1rbB+F/CNknY2DONleMSeo5DlZ276yv0yO3yknmqhKTsKqpUY LpGiI3pJJjizFniU+GJRRZ6MocN9sMZOCvNRGSr+QQzVMgPY3tR4HWS8SDb0CQTaM8Jw 4tmaEBUDCQilbCTP1GoJKJHrYkSlrPwKnuJh3mhGp5kKkbYOKRZf9cbL5qO1KbPhhxhN sdNw== MIME-Version: 1.0 X-Received: by 10.112.145.100 with SMTP id st4mr16029934lbb.102.1369734716519; Tue, 28 May 2013 02:51:56 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.181.42 with HTTP; Tue, 28 May 2013 02:51:56 -0700 (PDT) In-Reply-To: References: <20130527233801.GA32042@onelab2.iet.unipi.it> Date: Tue, 28 May 2013 11:51:56 +0200 X-Google-Sender-Auth: HdqJVHzCG-r51kOD1Fn69lpv7R8 Message-ID: Subject: Re: copyin+copyout in one step ? From: Luigi Rizzo To: Zaphod Beeblebrox Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: FreeBSD Current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 May 2013 09:51:58 -0000 On Tue, May 28, 2013 at 6:56 AM, Zaphod Beeblebrox wrote: > On Mon, May 27, 2013 at 7:38 PM, Luigi Rizzo wrote: > >> >> say a process P1 wants to use the kernel to copy the content of a >> buffer SRC (in its user address space) to a buffer DST (in the >> address space of another process P2), and assume that P1 issues the >> request to the kernel when P2 has already told the kernel where the >> data should go: >> > > Urm... Isn't the use of shared memory the more obvious way to transfer > data between processes? Am I missing some nuance? > see my other message about the use between VMs. I cannot simply share memory because otherwise the sender could alter the message while the receiver is playing with it, so at least one copy is needed (or page flipping, but that would be way more complex/wasteful/ expensive) . But also, in my case the source and destination buffers are chosen arbitrarily by the two VMs, and do not necessarily reside in the mmapped buffers that the kernel module provides. So at the moment I have three copies instead of one. cheers luigi