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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 9C12EC433EF for ; Tue, 7 Sep 2021 18:34:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 42A3661108 for ; Tue, 7 Sep 2021 18:34:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 42A3661108 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNfvK-0000Sb-4P for qemu-devel@archiver.kernel.org; Tue, 07 Sep 2021 14:34:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNftX-0007LI-7r for qemu-devel@nongnu.org; Tue, 07 Sep 2021 14:32:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNftU-0002Ck-FX for qemu-devel@nongnu.org; Tue, 07 Sep 2021 14:32:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631039547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=v/Gy6GddH8/Ma2/9BwMbKuBkZfLmwSMKT4eEZVV/X7Q=; b=F05dsCloHTGkFbToD8SVXM5fejhi1mUQ9i4FiQDVkzm9wDWnWtlRkcCPCm5jyLfgi9avNC 3HArNHx4tQ7H0xxprI0FsDa7tK0+8SdUHc59DBV6anUcgIZxqDVOFwd5PE+/7pcvZZ4Eyy R0SnvyPMG9jjY6hvJ9EP0L4zilEKQD4= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-LH2cmUBbNAuzPPDwopmDnQ-1; Tue, 07 Sep 2021 14:32:26 -0400 X-MC-Unique: LH2cmUBbNAuzPPDwopmDnQ-1 Received: by mail-qt1-f199.google.com with SMTP id 13-20020ac8560d000000b0029f69548889so321500qtr.3 for ; Tue, 07 Sep 2021 11:32:26 -0700 (PDT) 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:in-reply-to; bh=v/Gy6GddH8/Ma2/9BwMbKuBkZfLmwSMKT4eEZVV/X7Q=; b=hPB9yyPVeXkUfd5kvDj29nq9m8wv4HUQeTJw8rFpdVzZQVHghlvDtP+IbwZXb+9Q7R BMiEYgxBJ3pr3925ex4X8+gjHeNIdydEawB46t+1Q3aNxhn2Sdlij5n+I98AFqg7PRNL SdbXgYmd1nFmFMV3Tx5MI2YyVmD4z+xtbLPXi57qmrpEA0PEjogf3+H7vswlPRy1R/Zv yYiH0NnFtXzxJp6N8utH16lg/S98ARHJIW2y7+GXQM7nZc26cePDMbFm79OZorodnb6N YlB7gaHK+cCAZheWtv9FZBptLxFVx4r9/wj1zf4Wfzt+2JTzB76I8oUX+uBuLuwIXKcP U6TA== X-Gm-Message-State: AOAM533gb0+L3irOInISZwbPde4RjHihhGP7uvYLTDjG7L3Mr77MFE7n vEz1AOAsVf8NwfpQVK3dYXLswL1lGREJwHvIbRH++7dFZ+lP2vC+sZhBUcRXJCgXWPC6EHbOHmz OQbtqX4HAZAN58g0= X-Received: by 2002:a37:d4c:: with SMTP id 73mr17448205qkn.188.1631039545922; Tue, 07 Sep 2021 11:32:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ7Ir1OL14DqXsab42Lj0VPOAQ7lDrYNPZphgDaRcSg7KLfx60A2HgMraJeK1jd+lUL6pnRA== X-Received: by 2002:a37:d4c:: with SMTP id 73mr17448179qkn.188.1631039545671; Tue, 07 Sep 2021 11:32:25 -0700 (PDT) Received: from t490s ([2607:fea8:56a3:500::ad7f]) by smtp.gmail.com with ESMTPSA id h4sm9258423qkp.86.2021.09.07.11.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 11:32:25 -0700 (PDT) Date: Tue, 7 Sep 2021 14:32:23 -0400 From: Peter Xu To: Leonardo Bras Soares Passos Subject: Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy Message-ID: References: <20210831110238.299458-1-leobras@redhat.com> <20210831110238.299458-4-leobras@redhat.com> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elena Ufimtseva , John G Johnson , Jagannathan Raman , qemu-block@nongnu.org, Juan Quintela , qemu-devel , Jason Wang , Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= , "Dr. David Alan Gilbert" , Paolo Bonzini , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Fam Zheng Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Thu, Sep 02, 2021 at 04:22:55AM -0300, Leonardo Bras Soares Passos wrote: > > I don't think it is valid to unconditionally enable this feature due to the > > resource usage implications > > > > https://www.kernel.org/doc/html/v5.4/networking/msg_zerocopy.html > > > > "A zerocopy failure will return -1 with errno ENOBUFS. This happens > > if the socket option was not set, the socket exceeds its optmem > > limit or the user exceeds its ulimit on locked pages." > > You are correct, I unfortunately missed this part in the docs :( > > > The limit on locked pages is something that looks very likely to be > > exceeded unless you happen to be running a QEMU config that already > > implies locked memory (eg PCI assignment) > > Do you mean the limit an user has on locking memory? > > If so, that makes sense. I remember I needed to set the upper limit of locked > memory for the user before using it, or adding a capability to qemu before. So I'm a bit confused on why MSG_ZEROCOPY requires checking RLIMIT_MEMLOCK. The thing is IIUC that's accounting for pinned pages only with either mlock() (FOLL_MLOCK) or vfio (FOLL_PIN). I don't really think MSG_ZEROCOPY is doing that at all... I'm looking at __zerocopy_sg_from_iter() -> iov_iter_get_pages(). Say, I think there're plenty of iov_iter_get_pages() callers and normal GUPs, I think most of them do no need such accountings. -- Peter Xu