From nobody Mon Feb 9 02:50:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601577286; cv=none; d=zohomail.com; s=zohoarc; b=H0dRzCZSni41tUQlr2BWImOX6iwiaLsyguLy4XDtsr9cUdsTdFMAEmKXfnFWHSDtcaoj+TweFlMDYfPHzHtVxxLao0jnuoWYR7LfZ0GjBiFC6Nqiazh225PB7hve0tHPG3D0pmDm5T5VgEh7a06YPkGoYF3zMVQYpdCPuklTzVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601577286; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=n4IR530G0jn3KaGrAMU+kHWU9guPG9Q80wHEffp3OJw=; b=aIJi7cp6k8JbAPcMROQeXB8XvDY/7CoaFODvvnqPKAVWi122fL9waMTX5ZopExarFj95Qfqn9bUjHy1o0J+ig1e7S1kdlaNvS4QLS79Xjrq/ZUuZA3IWUeV3dSJoZRKtj8ikFhlILPH+28yfsi3f7RKnKilwn4gEVEW9vZ2Fv6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601577286007894.7702673753072; Thu, 1 Oct 2020 11:34:46 -0700 (PDT) Received: from localhost ([::1]:51418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO3Pg-00027K-Mz for importer@patchew.org; Thu, 01 Oct 2020 14:34:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO3I6-0002Uy-EW for qemu-devel@nongnu.org; Thu, 01 Oct 2020 14:26:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59492) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kO3I3-0003gD-8L for qemu-devel@nongnu.org; Thu, 01 Oct 2020 14:26:54 -0400 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-104-18DrE5bVMSmn7IHIq8Mg5g-1; Thu, 01 Oct 2020 14:26:45 -0400 Received: by mail-qt1-f198.google.com with SMTP id w92so4369524qte.19 for ; Thu, 01 Oct 2020 11:26:45 -0700 (PDT) Received: from xz-x1.redhat.com (toroon474qw-lp130-09-184-147-14-204.dsl.bell.ca. [184.147.14.204]) by smtp.gmail.com with ESMTPSA id v56sm7892699qtc.49.2020.10.01.11.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 11:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601576807; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n4IR530G0jn3KaGrAMU+kHWU9guPG9Q80wHEffp3OJw=; b=IeB2DjnhBODBRec4Q0vfrnhMUEMvA6pTAAVKya3Zc3l6hy/K56c26UoqjOhJwBJnpqdlon WPICf+5DsoDWppc9ohVTjFb2NT8H24hVbMELUDQQhwizWZm4lvXIcT3YsKnWz8WpkJBtqf AK64Ktpl578vqD5/z4WQ1SP5Aw6VNGo= X-MC-Unique: 18DrE5bVMSmn7IHIq8Mg5g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n4IR530G0jn3KaGrAMU+kHWU9guPG9Q80wHEffp3OJw=; b=ai3r/JQhi0hUQUz2BhZHOeZcTc/lLCk0VDwFkWxohxVlWB/nzwcMlDjQfRNqIayJBQ g4tC34A90eK3hkhE7d5Qc3Rs8jXB66zWlAK/9zJXbLC1TYS36yIIMWfpwgfjMx0vQ1O5 HXxOf73t2gUN1QpNGoWHZfNVD1QLEb0HsTS36tWtZ8PCMaNx4k+VqkwBlnQ8Jig6ee0f q6jV0IRha63TarIfksWjHeRl2QZiSSuQAi3TtKH5ZxmfeVwvL+yBzE8beeasLMuPFGap 2zoBY3RiofxrUx0RrtF7OpKtkIntW4D6oFCKhtWo7GO7EcIBylhaizAlwWPXIHYSJ4bB qxBA== X-Gm-Message-State: AOAM532qAqFFSgntptl2mGbpJA/7h+EZzwbcRN1NC2lRNrifTFIdXpAi Ru8/sk7a87NZds1G+9SRp8BHfV9rxWp+SrLBsQtH+k06Jg9dc+oGcP7MUP85tyM5Gz6mXc9kCFL PAqfXnpaXiLLAaW0= X-Received: by 2002:a05:620a:200d:: with SMTP id c13mr8627019qka.499.1601576804963; Thu, 01 Oct 2020 11:26:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCbbMFpMCsfRF4FMFhvulPIvAG8ebmJ825JzVhQZTzDeBWMmF7VftAMt+KMqW7p3K9CYAtpw== X-Received: by 2002:a05:620a:200d:: with SMTP id c13mr8627006qka.499.1601576804728; Thu, 01 Oct 2020 11:26:44 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v3 1/4] migration: Pass incoming state into qemu_ufd_copy_ioctl() Date: Thu, 1 Oct 2020 14:26:38 -0400 Message-Id: <20201001182641.80232-2-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001182641.80232-1-peterx@redhat.com> References: <20201001182641.80232-1-peterx@redhat.com> MIME-Version: 1.0 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-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 02:15:30 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: "Dr . David Alan Gilbert" , peterx@redhat.com, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" It'll be used in follow up patches to access more fields out of it. Meanwh= ile fetch the userfaultfd inside the function. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 0a2f88a87d..722034dc01 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1128,10 +1128,12 @@ int postcopy_ram_incoming_setup(MigrationIncomingSt= ate *mis) return 0; } =20 -static int qemu_ufd_copy_ioctl(int userfault_fd, void *host_addr, +static int qemu_ufd_copy_ioctl(MigrationIncomingState *mis, void *host_add= r, void *from_addr, uint64_t pagesize, RAMBloc= k *rb) { + int userfault_fd =3D mis->userfault_fd; int ret; + if (from_addr) { struct uffdio_copy copy_struct; copy_struct.dst =3D (uint64_t)(uintptr_t)host_addr; @@ -1185,7 +1187,7 @@ int postcopy_place_page(MigrationIncomingState *mis, = void *host, void *from, * which would be slightly cheaper, but we'd have to be careful * of the order of updating our page state. */ - if (qemu_ufd_copy_ioctl(mis->userfault_fd, host, from, pagesize, rb)) { + if (qemu_ufd_copy_ioctl(mis, host, from, pagesize, rb)) { int e =3D errno; error_report("%s: %s copy host: %p from: %p (size: %zd)", __func__, strerror(e), host, from, pagesize); @@ -1212,7 +1214,7 @@ int postcopy_place_page_zero(MigrationIncomingState *= mis, void *host, * but it's not available for everything (e.g. hugetlbpages) */ if (qemu_ram_is_uf_zeroable(rb)) { - if (qemu_ufd_copy_ioctl(mis->userfault_fd, host, NULL, pagesize, r= b)) { + if (qemu_ufd_copy_ioctl(mis, host, NULL, pagesize, rb)) { int e =3D errno; error_report("%s: %s zero host: %p", __func__, strerror(e), host); --=20 2.26.2