From patchwork Fri Nov 19 16:58:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ismgrdDI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hwjgy2gmkz9sX3 for ; Sat, 20 Nov 2021 04:04:30 +1100 (AEDT) Received: from localhost ([::1]:39810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7JL-0002N7-TU for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 12:04:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EO-0005LA-EY for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7ED-00036g-FB for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341148; 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=XmEkVhVSKzuiu4C0PT+alXX9G5GjnHjiuGB7lH3TEq4=; b=ismgrdDIMyfnbkGm7aucHbZWN9EeYjPMkhMTApLqBFpbhaJHWDtGxnCB7VWAh0bcRZhct6 TxO4FIKmzKKTh+F/ZAVt7hWeooSmH5EaGEIUiN1/jV+sqThYEG3B2mBEnRdaydk6cbLIj2 47sAaGj+DVIi/dYtCJMFAXHnguVGQR8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-455-qMEknxMEO7-r88EHP0VhFw-1; Fri, 19 Nov 2021 11:59:07 -0500 X-MC-Unique: qMEknxMEO7-r88EHP0VhFw-1 Received: by mail-wm1-f70.google.com with SMTP id i131-20020a1c3b89000000b00337f92384e0so6199751wma.5 for ; Fri, 19 Nov 2021 08:59:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XmEkVhVSKzuiu4C0PT+alXX9G5GjnHjiuGB7lH3TEq4=; b=WOE9PfAWfqgy3gs7W5z37LM9z7DoJwDRFI7vn9n2K5PSQ80fZTLFjZ6lKJRIoj7Rzl +OSC3lphfk1wHu868YB0RLhXqLZgtYbkK/Yf1yeWhr0QUdHXWdM9dF/IAdzyQfa2EtjP jCc1kgriGl/i8IGplPpkRD00u7EfgH4OUgdzahKENa1gEObxlv5JahcR8TR52I0MpWym qLCxNtTJCOgfK6AcksAmnWWNgclb/3NDca+0rJkseY7EeB9lXD8qzeFHZcmPMHJOohY5 +kvL/yiCAo2f0EqFvS5/McWE1nVGn7vSSKI1iV6nz91kz5MazCXTI4hmoZF1RqlXW0Oc Zxyw== X-Gm-Message-State: AOAM530zfDQGRtriXSAakltBpJmxuXi82zwOKQWi1DwFxs/aweiuFiBJ /KUn2IUdXd9I5GleHeKkz7QSfs1DXgcquxxNOHCVJLKTLL2VMiUkMxKBl7Ka1OFPhsZGscmFji3 dYrzSVHf37bQ1IwUe0CUmuLRoygV+NSa60zUjtNTkEtF1AiMBGIRTYU0XXN7bNs8MPfQ= X-Received: by 2002:a05:600c:35cb:: with SMTP id r11mr1366053wmq.190.1637341146186; Fri, 19 Nov 2021 08:59:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzahFSFMgYW8SGXmVlwilXFzKr+605EU1K46LPD+/u9hvjHGg03cUhPbmCNqGtK+mBogyRgyQ== X-Received: by 2002:a05:600c:35cb:: with SMTP id r11mr1366008wmq.190.1637341145893; Fri, 19 Nov 2021 08:59:05 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id r8sm400927wrz.43.2021.11.19.08.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:05 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 01/11] migration: Remove is_zero_range() Date: Fri, 19 Nov 2021 17:58:53 +0100 Message-Id: <20211119165903.18813-2-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It just calls buffer_is_zero(). Just change the callers. Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson --- migration/ram.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 863035d235..f2a799ff83 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -81,11 +81,6 @@ /* 0x80 is reserved in migration.h start with 0x100 next */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 -static inline bool is_zero_range(uint8_t *p, uint64_t size) -{ - return buffer_is_zero(p, size); -} - XBZRLECacheStats xbzrle_counters; /* struct contains XBZRLE cache and a static page @@ -1180,7 +1175,7 @@ static int save_zero_page_to_file(RAMState *rs, QEMUFile *file, uint8_t *p = block->host + offset; int len = 0; - if (is_zero_range(p, TARGET_PAGE_SIZE)) { + if (buffer_is_zero(p, TARGET_PAGE_SIZE)) { len += save_page_header(rs, file, block, offset | RAM_SAVE_FLAG_ZERO); qemu_put_byte(file, 0); len += 1; @@ -3367,7 +3362,7 @@ static inline void *colo_cache_from_block_offset(RAMBlock *block, */ void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) { - if (ch != 0 || !is_zero_range(host, size)) { + if (ch != 0 || !buffer_is_zero(host, size)) { memset(host, ch, size); } } From patchwork Fri Nov 19 16:58:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557315 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Jl2kRKw8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwjZx0G3wz9sX3 for ; Sat, 20 Nov 2021 04:00:09 +1100 (AEDT) Received: from localhost ([::1]:60304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7F8-0005Xi-JV for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 12:00:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EN-0005L8-3Y for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:47647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EE-00036n-W7 for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341150; 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=0rYdjt1Fquz/o/MTD7skzHN1tkIhl+DVJLQUz2RjsO8=; b=Jl2kRKw8GYBcIzA9b/rH1bA777NXVGy7Vh7Zc3k8W0VRTkiuQ37wdox+iMxauS/vIgZw1S +ilEMPww2XUp20ysQZB6NJkwXTWhe4uM80K1PfSPuo701no60FCUVlZd8A3OqkGY0L8HG/ 8tum6ZEQaZ5D73KadLOJchQ21kV/L2w= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-225-EUNFxqAwMYGxjdn75kbd5A-1; Fri, 19 Nov 2021 11:59:09 -0500 X-MC-Unique: EUNFxqAwMYGxjdn75kbd5A-1 Received: by mail-wr1-f69.google.com with SMTP id q7-20020adff507000000b0017d160d35a8so1902101wro.4 for ; Fri, 19 Nov 2021 08:59:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0rYdjt1Fquz/o/MTD7skzHN1tkIhl+DVJLQUz2RjsO8=; b=fPVmHADNcI+bXYQ8fw9yhnQWD8orCj91rE3y03U7Ls20Gyta3lvmJxGvS8EC1vqr68 wBRWG3y49qc5TCZ+r8ArcsJJPOmQwuZglwEJ01FY4falPaRF9j1FuU9ROlKZ9d/cFtF7 ewQ7+1DtmRw92yiQDWYp39NFn5EwtZF+kGCzHp21eLgctIEgCBN5YsNnO04NhhjdfDZG CmNjFkpD6SvyqhLQSDxAaSEsTcV0DjZv6SVlF9IKXyKM5kRUQZqKJvsOsonjDLARnk4c zEdVRECGRqX9Cun2uCw2IhkYxTZSFzSu8hebwUlw7TuefxtN7kroTwrS3xZkodClxNYY x1KA== X-Gm-Message-State: AOAM531g1hGfLOWldJMI9mXQ8BEFD9uSviZ5ogApRUZMOuMSvoccYGqj 4VEqIoH0PRNIl638LFgUKHVR6oOk4/b843RP4gQy2cExAWYarKsHM07eZZG7IhfN3Nk2KzlfAsB fwuO3xd5TwYLvKpvLn5OS+15kfYQ3hK30aYvbkGKjsIpopKgjckT6OP2l2xq8S6ug4+8= X-Received: by 2002:adf:cf0a:: with SMTP id o10mr9121411wrj.84.1637341147332; Fri, 19 Nov 2021 08:59:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWNgw+l/lA0vDSaZ1GRpmEPis1XcvpP+ZZ1cZ9CpCzx1NWa9qB4NTW7vwiKP/b+G+msmS9RA== X-Received: by 2002:adf:cf0a:: with SMTP id o10mr9121383wrj.84.1637341147128; Fri, 19 Nov 2021 08:59:07 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id n2sm13079142wmi.36.2021.11.19.08.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:06 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 02/11] dump: Remove is_zero_page() Date: Fri, 19 Nov 2021 17:58:54 +0100 Message-Id: <20211119165903.18813-3-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It just calls buffer_is_zero(). Just change the callers. Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson Reviewed-by: Marc-André Lureau --- dump/dump.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index 662d0a62cd..a84d8b1598 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -1293,14 +1293,6 @@ static size_t get_len_buf_out(size_t page_size, uint32_t flag_compress) return 0; } -/* - * check if the page is all 0 - */ -static inline bool is_zero_page(const uint8_t *buf, size_t page_size) -{ - return buffer_is_zero(buf, page_size); -} - static void write_dump_pages(DumpState *s, Error **errp) { int ret = 0; @@ -1357,7 +1349,7 @@ static void write_dump_pages(DumpState *s, Error **errp) */ while (get_next_page(&block_iter, &pfn_iter, &buf, s)) { /* check zero page */ - if (is_zero_page(buf, s->dump_info.page_size)) { + if (buffer_is_zero(buf, s->dump_info.page_size)) { ret = write_cache(&page_desc, &pd_zero, sizeof(PageDescriptor), false); if (ret < 0) { From patchwork Fri Nov 19 16:58:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J+SXFX/w; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwjZp4bRtz9sX3 for ; Sat, 20 Nov 2021 04:00:02 +1100 (AEDT) Received: from localhost ([::1]:60070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7F1-0005MX-UC for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 11:59:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EN-0005LB-43 for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:38875) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EG-000374-0Z for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341151; 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=Ao9wdx6I6p8gRFWFOrvvGJdtsNfToaF6+klEmdsHy2A=; b=J+SXFX/wmFdh+N3GILWlxGpu3j58zzwR7SVD1XM2WD+SEbp1bg468Ut4Ek1TDiU7KJPlLZ Tpuf1uWvvthFvOqXGVC3jOpM1wDCXIZl2CgBPy4073fXjtXrXq5Fbnht8Xb5HoZ3ImwHeU EMBiBG3MbcPyWZ62jlP+u6sepiVHnbk= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-UmBtULndNvWjU9HV0o9Jgg-1; Fri, 19 Nov 2021 11:59:10 -0500 X-MC-Unique: UmBtULndNvWjU9HV0o9Jgg-1 Received: by mail-wm1-f72.google.com with SMTP id j193-20020a1c23ca000000b003306ae8bfb7so4332713wmj.7 for ; Fri, 19 Nov 2021 08:59:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ao9wdx6I6p8gRFWFOrvvGJdtsNfToaF6+klEmdsHy2A=; b=B3OiS3eGQy18NwA18uCI0dxCkDmTIWyz957zBa9xtRPcL9Gm4Fr4AiL7HgO4otowYu o6FhdUPejC0oVhuzYcFyqhS9PtSY8OzfIEZ3TfYkVJRtENpCLkAlkg8TYoyvvRAGE9WK XG+BrFDtAq6c315So7c4Lltxi5GROqXGbtviBm5TAWwyyK/fWogEiIDxNMWjjpN59ump JASEysptNNiYHT/VLiCbY2JjvmnWCmr+lRQp7P/nkiw0jBTNaqAEIlFFnSwjM+Zno6dQ 1NWDnxSGGflH+NsSAH3GgYEohM7I8uOQSURZMce4n6gsq5hZR6K07AqVs1OIPkUdYHoV Q25g== X-Gm-Message-State: AOAM5301u1kyy+k8c/eCo+tGHycFXm3Q9kDDhP7/O7zKEknMBLZ5z1kd F8r4qzLdPT2r3rlNeitUTBasOK22twh6FLJd6YxOOl8yyzo+vrwp5OuryZrJBUrB8sosVJAy1SI OzdiqVgPr/QJ+8kqGP1X3HNUwMpq4B8PVr9sEpFI4v+fkheaMSpOzjXY4FqHhoQlatmA= X-Received: by 2002:a5d:4b0e:: with SMTP id v14mr9410578wrq.196.1637341149019; Fri, 19 Nov 2021 08:59:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNct7971vGv2B8kUSYm+UF7EoC5gLAzyJsJ4ILdkQVtJ1iPUOOCJqv2oapjVZ77m6U2/cyCg== X-Received: by 2002:a5d:4b0e:: with SMTP id v14mr9410537wrq.196.1637341148740; Fri, 19 Nov 2021 08:59:08 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id q123sm12588655wma.30.2021.11.19.08.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:08 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 03/11] multifd: Fill offset and block for reception Date: Fri, 19 Nov 2021 17:58:55 +0100 Message-Id: <20211119165903.18813-4-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We were using the iov directly, but we will need this info on the following patch. Signed-off-by: Juan Quintela --- migration/multifd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/multifd.c b/migration/multifd.c index 7c9deb1921..e2adcdffa1 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -364,6 +364,8 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) offset, block->used_length); return -1; } + p->pages->offset[i] = offset; + p->pages->block = block; p->pages->iov[i].iov_base = block->host + offset; p->pages->iov[i].iov_len = qemu_target_page_size(); } From patchwork Fri Nov 19 16:58:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K8Wfefa6; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hwjk20m1pz9sX3 for ; Sat, 20 Nov 2021 04:06:15 +1100 (AEDT) Received: from localhost ([::1]:42844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7L2-0004OD-HG for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 12:06:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EP-0005Mm-Gm for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EM-00037F-RV for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341152; 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=RkK2JzVJ2Qn+eeGdXNOGpANBJZPJidfQbM5myyH9RDg=; b=K8Wfefa62k+GT9SqzKDDlmq1ZhhocWMaRJza1NMJY6sw06B6RLXmGxgkwIwvHwxqdipgIV sb6EvtR4XRjK3cftG7sCUfcR7agSS8Z2zbyLe5cNH3Iuw4otYrH4SiTzP48ta2PKkt8Iuf waM2sRYuXChw1ETEKKtKSFxsgB/cE1I= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-492-dr7oHfGpPkOl9ticekuoTA-1; Fri, 19 Nov 2021 11:59:11 -0500 X-MC-Unique: dr7oHfGpPkOl9ticekuoTA-1 Received: by mail-wm1-f69.google.com with SMTP id g80-20020a1c2053000000b003331a764709so6206752wmg.2 for ; Fri, 19 Nov 2021 08:59:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RkK2JzVJ2Qn+eeGdXNOGpANBJZPJidfQbM5myyH9RDg=; b=OxMqqUpvH1SgIJGpNg+um7bHmF9GnSLWPSZcRGs9lLwqjkUo1gfcNfwoDlsWpo/RiT c1wlg5uJfeH/EgQtndiCoXqigitdNcQUvrsb3I27zlugtUPU0SXUFVZO7Kvn9wFQLyVH qeKIwRS4+YQLlufVkBmhQiC+ZpKbeQa9OmcnEutgXGsXspvGZbZPO4Wy1H5O9z/+f9fT Q3js2k26KEcNf9otcdM4eu+F//iDEzhb6iZSXnAfM68GuBayRQ6DC2qhsESHNJj5AthV Qcrw5gQWAOWGjQgZ8EBH980uQ2M9FVrTdOFhIp+RD9ttPksYt3v9WTTt/VHWXXswSql/ 7P9g== X-Gm-Message-State: AOAM532kN9rjjSrNjhoAHAtB1fxwzp66G0WGMWXaXSBu+fPoh1tyawrp +9e59sab1fpaNZg8aKbfR54gfxndCTu1wu6NTAjF76OPlKyDAmOUys7eemURKNKHDIC029gL6z5 VArvf2P5QxMSEHzqP21hfFVD1eJm7w9pcdw/EdaOX6zX+8UcoK2tUXf7UkZ2q8l8GOo0= X-Received: by 2002:adf:ecce:: with SMTP id s14mr9071355wro.98.1637341150171; Fri, 19 Nov 2021 08:59:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJze5CuiEqMEXPEaI8Y+mADq1XsQbN2gDFZPsgeiWFna9KbJuCnUJndYOl8eFo2Wa+G4ACH6dw== X-Received: by 2002:adf:ecce:: with SMTP id s14mr9071318wro.98.1637341149926; Fri, 19 Nov 2021 08:59:09 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id t189sm205469wma.8.2021.11.19.08.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:09 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 04/11] multifd: Make zstd compression method not use iovs Date: Fri, 19 Nov 2021 17:58:56 +0100 Message-Id: <20211119165903.18813-5-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Juan Quintela --- migration/multifd-zstd.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 693bddf8c9..1dccdbd733 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include #include "qemu/rcu.h" +#include "exec/ramblock.h" #include "exec/target_page.h" #include "qapi/error.h" #include "migration.h" @@ -112,8 +113,8 @@ static void zstd_send_cleanup(MultiFDSendParams *p, Error **errp) */ static int zstd_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) { - struct iovec *iov = p->pages->iov; struct zstd_data *z = p->data; + size_t page_size = qemu_target_page_size(); int ret; uint32_t i; @@ -127,8 +128,8 @@ static int zstd_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) if (i == used - 1) { flush = ZSTD_e_flush; } - z->in.src = iov[i].iov_base; - z->in.size = iov[i].iov_len; + z->in.src = p->pages->block->host + p->pages->offset[i]; + z->in.size = page_size; z->in.pos = 0; /* @@ -264,6 +265,7 @@ static int zstd_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **errp) uint32_t expected_size = used * qemu_target_page_size(); uint32_t flags = p->flags & MULTIFD_FLAG_COMPRESSION_MASK; struct zstd_data *z = p->data; + size_t page_size = qemu_target_page_size(); int ret; int i; @@ -283,10 +285,8 @@ static int zstd_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **errp) z->in.pos = 0; for (i = 0; i < used; i++) { - struct iovec *iov = &p->pages->iov[i]; - - z->out.dst = iov->iov_base; - z->out.size = iov->iov_len; + z->out.dst = p->pages->block->host + p->pages->offset[i]; + z->out.size = page_size; z->out.pos = 0; /* @@ -300,8 +300,8 @@ static int zstd_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **errp) do { ret = ZSTD_decompressStream(z->zds, &z->out, &z->in); } while (ret > 0 && (z->in.size - z->in.pos > 0) - && (z->out.pos < iov->iov_len)); - if (ret > 0 && (z->out.pos < iov->iov_len)) { + && (z->out.pos < page_size)); + if (ret > 0 && (z->out.pos < page_size)) { error_setg(errp, "multifd %d: decompressStream buffer too small", p->id); return -1; From patchwork Fri Nov 19 16:58:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LKklua/w; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwjmS598Bz9sX3 for ; Sat, 20 Nov 2021 04:08:24 +1100 (AEDT) Received: from localhost ([::1]:48622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7N8-0008NM-HY for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 12:08:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EP-0005Mp-VB for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45346) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EM-00037S-Rj for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341154; 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=x21JJpo3l6foj8NaP+rDiQL/I3NxYzqELlR8UI5gEko=; b=LKklua/w+3W5ztDo3Pca3aQK8KkV4YdnhFyzElgFI5RlQDShACBg4d3bV4fA+tM9Ipfxsi Se0jM59D1SQb8Ag8mDarb2CiZ6tJ601ktNHDLZRSRrqNn2V+gOxPSg0IE+I/RR8+r0sTKb Eorp7At+LjUWbluY/05SnvvvUPqyboA= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-452-UVsshjNEMTC89GQk3-ZPNQ-1; Fri, 19 Nov 2021 11:59:13 -0500 X-MC-Unique: UVsshjNEMTC89GQk3-ZPNQ-1 Received: by mail-wm1-f72.google.com with SMTP id o10-20020a05600c4fca00b0033312e1ed8bso5046596wmq.2 for ; Fri, 19 Nov 2021 08:59:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x21JJpo3l6foj8NaP+rDiQL/I3NxYzqELlR8UI5gEko=; b=CPnGcq7FZKuo9RRidWTfr8x9ijjrXd6m7G4WVktDmO8b2ufKKuHECL682eIQpoNhpT clOGISvMgJm9MAmYspvBlUFS+7oEze9n59dbRlPhUff/S0U35UubOHRjjHBnSU3t/VSZ 5b6n1EbX1zO6VknJe5nK4zqT0S+OPVomRz0p4xaaMpL6swZkGn+DJrNFI87LROtcqMAY Tvx6FfGEC+oF9taFYl4xXWcc2kggJPtM/ShLGPr8vTlJCuDFo4XJU+4wRf9L+wb+GLlu 8/PjRU4OrEKfY5cF7Bnn+gesr5u+2Y+oApIBCyruQsCHrax0Pmb+l0sVDPqNaxFlI7r/ 6o+A== X-Gm-Message-State: AOAM532VrfATk52vL1d0T3YZQtkXlOHL1r1gFMKdVlst9viW9hDONRdp fPhJRIgunB8v/SmiuzWr0Fn679rCk0PMueLup+4nyoR5SXMgcO/adlKWjPq5DrTR3en29AZUR2E pUTBqWvSvurMMZMAgP5Mr+IiHBGyWQefzg2rss0ROIRjWI7DiJX7yqzLUN6bk9xSXzFc= X-Received: by 2002:a05:600c:1c87:: with SMTP id k7mr1364877wms.103.1637341151605; Fri, 19 Nov 2021 08:59:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyTctBnGPSKZ8duGzvf0uNNdqhxv+QnSFjj933dUnJZIaL3RngLiUJ0w5ddcT9gBW4wBrk2Q== X-Received: by 2002:a05:600c:1c87:: with SMTP id k7mr1364824wms.103.1637341151229; Fri, 19 Nov 2021 08:59:11 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id k187sm11986790wme.0.2021.11.19.08.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:10 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 05/11] multifd: Make zlib compression method not use iovs Date: Fri, 19 Nov 2021 17:58:57 +0100 Message-Id: <20211119165903.18813-6-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Juan Quintela --- migration/multifd-zlib.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index ab4ba75d75..40d4cbd0b8 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include #include "qemu/rcu.h" +#include "exec/ramblock.h" #include "exec/target_page.h" #include "qapi/error.h" #include "migration.h" @@ -99,8 +100,8 @@ static void zlib_send_cleanup(MultiFDSendParams *p, Error **errp) */ static int zlib_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) { - struct iovec *iov = p->pages->iov; struct zlib_data *z = p->data; + size_t page_size = qemu_target_page_size(); z_stream *zs = &z->zs; uint32_t out_size = 0; int ret; @@ -114,8 +115,8 @@ static int zlib_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) flush = Z_SYNC_FLUSH; } - zs->avail_in = iov[i].iov_len; - zs->next_in = iov[i].iov_base; + zs->avail_in = page_size; + zs->next_in = p->pages->block->host + p->pages->offset[i]; zs->avail_out = available; zs->next_out = z->zbuff + out_size; @@ -240,6 +241,7 @@ static void zlib_recv_cleanup(MultiFDRecvParams *p) static int zlib_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **errp) { struct zlib_data *z = p->data; + size_t page_size = qemu_target_page_size(); z_stream *zs = &z->zs; uint32_t in_size = p->next_packet_size; /* we measure the change of total_out */ @@ -264,7 +266,6 @@ static int zlib_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **errp) zs->next_in = z->zbuff; for (i = 0; i < used; i++) { - struct iovec *iov = &p->pages->iov[i]; int flush = Z_NO_FLUSH; unsigned long start = zs->total_out; @@ -272,8 +273,8 @@ static int zlib_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **errp) flush = Z_SYNC_FLUSH; } - zs->avail_out = iov->iov_len; - zs->next_out = iov->iov_base; + zs->avail_out = page_size; + zs->next_out = p->pages->block->host + p->pages->offset[i]; /* * Welcome to inflate semantics @@ -286,8 +287,8 @@ static int zlib_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **errp) do { ret = inflate(zs, flush); } while (ret == Z_OK && zs->avail_in - && (zs->total_out - start) < iov->iov_len); - if (ret == Z_OK && (zs->total_out - start) < iov->iov_len) { + && (zs->total_out - start) < page_size); + if (ret == Z_OK && (zs->total_out - start) < page_size) { error_setg(errp, "multifd %d: inflate generated too few output", p->id); return -1; From patchwork Fri Nov 19 16:58:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557324 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=acuSVmme; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwjyG5P0jz9sf8 for ; Sat, 20 Nov 2021 04:16:54 +1100 (AEDT) Received: from localhost ([::1]:37060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7VM-0002zN-Hg for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 12:16:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7ES-0005Ni-LC for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EN-00037c-0C for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341155; 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=i65KouW0qros+OIR6AIOQYFf5hMQeAXenZJYYpUSVVc=; b=acuSVmmeiTZmhxSlzis6Y5QOtSUL0WGsCKX4Xnb0PHiUPqn4R6JZkOgtQywq9ph2o4A9Th Bk4cYXZ0xrDF7h52NVe/eK+REXP8gAlBw6Tdq/jXyzO0rAFSm/WTu1KzjQT08MqrW+sDCr 2ptudUmN+9BJaPW8x5jUn8vIxdbw+BA= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-597-WJ3odMrdNfW-stbtMXpbGw-1; Fri, 19 Nov 2021 11:59:14 -0500 X-MC-Unique: WJ3odMrdNfW-stbtMXpbGw-1 Received: by mail-wm1-f70.google.com with SMTP id m14-20020a05600c3b0e00b0033308dcc933so5025403wms.7 for ; Fri, 19 Nov 2021 08:59:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i65KouW0qros+OIR6AIOQYFf5hMQeAXenZJYYpUSVVc=; b=5V31Pi7Yec4TZOMG9+j2xzy2QGqyJWvgH+a2IuvacSzob2JJ8wtHbjH3n8MKwJM3Ft AASTOmM79TDe4KgKd98Yul8FHjmVRFJlwD/QsCZinyu+/Zfbjrke+F+CxiHIvVJ52FRG Vzy7iRKsZxDRUIpkAOQfgw9fM1rnE0pylpCx/nqsNu5VQrJ6/FkGeX4xo+RNNDvMHJeA 1VaXKsvje00j60uhNiA9uVEiHstGhSm9njfGhA02z6ztEGMWME1DQFxhqUIPEYknH28m zw3nIV6xMOAd0ATZFGoanu6yeDtJYgYRcHb42PK5UAFo/HydOCnpVLAcIpNOzlLpE4t/ qHEw== X-Gm-Message-State: AOAM5330pEQoGtUg7QkjIRruDPWMBSFNYuu/3+c95dDmZx/c0mD1dbVe aNBemHw87TB/XnbhKQtNm17EPC6KTjjWr6zgkxtNbJvI0sUBt+4wL8U1Nhvol97XALgixtYN4xe rPoY0AuxXCPU8mrz5SgiMcH5qmVUcGbYIRtkyPxJ1K0pWBuq7Ccc+JRwLwUAdi6G50x8= X-Received: by 2002:a5d:6c6a:: with SMTP id r10mr9543643wrz.211.1637341152928; Fri, 19 Nov 2021 08:59:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7gAXwONI7KBjAdoRaTRdt9K+KFrT/uhUv+G7NryByEpmBVwjhIqyDZIsIH1aZOE0A5rto9A== X-Received: by 2002:a5d:6c6a:: with SMTP id r10mr9543589wrz.211.1637341152600; Fri, 19 Nov 2021 08:59:12 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id f7sm16351799wmg.6.2021.11.19.08.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:12 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 06/11] migration: Move iov from pages to params Date: Fri, 19 Nov 2021 17:58:58 +0100 Message-Id: <20211119165903.18813-7-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will allow us to reduce the number of system calls on the next patch. Signed-off-by: Juan Quintela --- migration/multifd.h | 8 ++++++-- migration/multifd.c | 30 +++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 15c50ca0b2..67f9104051 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -62,8 +62,6 @@ typedef struct { uint64_t packet_num; /* offset of each page */ ram_addr_t *offset; - /* pointer to each page */ - struct iovec *iov; RAMBlock *block; } MultiFDPages_t; @@ -110,6 +108,10 @@ typedef struct { uint64_t num_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; + /* buffers to send */ + struct iovec *iov; + /* used for compression methods */ + uint32_t iovs_used; /* used for compression methods */ void *data; } MultiFDSendParams; @@ -149,6 +151,8 @@ typedef struct { uint64_t num_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; + /* buffers to recv */ + struct iovec *iov; /* used for de-compression methods */ void *data; } MultiFDRecvParams; diff --git a/migration/multifd.c b/migration/multifd.c index e2adcdffa1..4368b7f855 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -87,6 +87,14 @@ static void nocomp_send_cleanup(MultiFDSendParams *p, Error **errp) static int nocomp_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) { + MultiFDPages_t *pages = p->pages; + + for (int i = 0; i < used; i++) { + p->iov[p->iovs_used].iov_base = pages->block->host + pages->offset[i]; + p->iov[p->iovs_used].iov_len = qemu_target_page_size(); + p->iovs_used++; + } + p->next_packet_size = used * qemu_target_page_size(); p->flags |= MULTIFD_FLAG_NOCOMP; return 0; @@ -105,7 +113,7 @@ static int nocomp_send_prepare(MultiFDSendParams *p, uint32_t used, */ static int nocomp_send_write(MultiFDSendParams *p, uint32_t used, Error **errp) { - return qio_channel_writev_all(p->c, p->pages->iov, used, errp); + return qio_channel_writev_all(p->c, p->iov, p->iovs_used, errp); } /** @@ -154,7 +162,11 @@ static int nocomp_recv_pages(MultiFDRecvParams *p, uint32_t used, Error **errp) p->id, flags, MULTIFD_FLAG_NOCOMP); return -1; } - return qio_channel_readv_all(p->c, p->pages->iov, used, errp); + for (int i = 0; i < p->pages->used; i++) { + p->iov[i].iov_base = p->pages->block->host + p->pages->offset[i]; + p->iov[i].iov_len = qemu_target_page_size(); + } + return qio_channel_readv_all(p->c, p->iov, used, errp); } static MultiFDMethods multifd_nocomp_ops = { @@ -244,7 +256,6 @@ static MultiFDPages_t *multifd_pages_init(size_t size) MultiFDPages_t *pages = g_new0(MultiFDPages_t, 1); pages->allocated = size; - pages->iov = g_new0(struct iovec, size); pages->offset = g_new0(ram_addr_t, size); return pages; @@ -256,8 +267,6 @@ static void multifd_pages_clear(MultiFDPages_t *pages) pages->allocated = 0; pages->packet_num = 0; pages->block = NULL; - g_free(pages->iov); - pages->iov = NULL; g_free(pages->offset); pages->offset = NULL; g_free(pages); @@ -366,8 +375,6 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) } p->pages->offset[i] = offset; p->pages->block = block; - p->pages->iov[i].iov_base = block->host + offset; - p->pages->iov[i].iov_len = qemu_target_page_size(); } return 0; @@ -471,8 +478,6 @@ int multifd_queue_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset) if (pages->block == block) { pages->offset[pages->used] = offset; - pages->iov[pages->used].iov_base = block->host + offset; - pages->iov[pages->used].iov_len = qemu_target_page_size(); pages->used++; if (pages->used < pages->allocated) { @@ -565,6 +570,8 @@ void multifd_save_cleanup(void) p->packet_len = 0; g_free(p->packet); p->packet = NULL; + g_free(p->iov); + p->iov = NULL; multifd_send_state->ops->send_cleanup(p, &local_err); if (local_err) { migrate_set_error(migrate_get_current(), local_err); @@ -653,6 +660,7 @@ static void *multifd_send_thread(void *opaque) uint32_t used = p->pages->used; uint64_t packet_num = p->packet_num; flags = p->flags; + p->iovs_used = 0; if (used) { ret = multifd_send_state->ops->send_prepare(p, used, @@ -922,6 +930,7 @@ int multifd_save_setup(Error **errp) p->packet->version = cpu_to_be32(MULTIFD_VERSION); p->name = g_strdup_printf("multifdsend_%d", i); p->tls_hostname = g_strdup(s->hostname); + p->iov = g_new0(struct iovec, page_count); socket_send_channel_create(multifd_new_send_channel_async, p); } @@ -1021,6 +1030,8 @@ int multifd_load_cleanup(Error **errp) p->packet_len = 0; g_free(p->packet); p->packet = NULL; + g_free(p->iov); + p->iov = NULL; multifd_recv_state->ops->recv_cleanup(p); } qemu_sem_destroy(&multifd_recv_state->sem_sync); @@ -1161,6 +1172,7 @@ int multifd_load_setup(Error **errp) + sizeof(uint64_t) * page_count; p->packet = g_malloc0(p->packet_len); p->name = g_strdup_printf("multifdrecv_%d", i); + p->iov = g_new0(struct iovec, page_count); } for (i = 0; i < thread_count; i++) { From patchwork Fri Nov 19 16:58:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557322 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=G3XgAhga; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HwjsV69Qhz9sXN for ; Sat, 20 Nov 2021 04:12:45 +1100 (AEDT) Received: from localhost ([::1]:57392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7RI-0005vY-JL for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 12:12:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EQ-0005N4-Pe for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EM-00037m-TV for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341156; 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=WDFI2IGTeowEVQIDHeq4RUL8gp6P5smXiMWEVlti1I4=; b=G3XgAhgaNr1m9Sb8JDwuwpixnNgamlvs9ZN1js4/7T0NLXAbyJLTK2TEkjX1LooZxljDNM kGbDgBIi5VYyS0dzGMhLU9ywekTiImLP8WJTRZyjNTSRGua9jZQ3br5N8qOGEljL10xi93 iTQOgIn6ORizUA4dBtoDlGABcy8EzhE= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-49-yAsVlbB2Mc2PFecGHR6jHw-1; Fri, 19 Nov 2021 11:59:15 -0500 X-MC-Unique: yAsVlbB2Mc2PFecGHR6jHw-1 Received: by mail-wr1-f72.google.com with SMTP id v17-20020adfedd1000000b0017c5e737b02so1891195wro.18 for ; Fri, 19 Nov 2021 08:59:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WDFI2IGTeowEVQIDHeq4RUL8gp6P5smXiMWEVlti1I4=; b=NzAMpZ6crK+bli14//CwsFOtE2yM9Sxp4+E94tmLD/4kbglGVQl7/YOZjqRjuxjF0M S5e8vK7yfZ3IgSbTpT2xhY/pW9ymLDf+PgDZffxBXnecNeWez0180jjvnXhVMna5oLa0 IltepBCtM8pgAopigdx5yJYbxD4DpeSZHUqgdtkBkoBh1ZsiPLrJNm+pURZcu+gwjygB pvYQa37D3C0CcCC38f1kDtA5aEUlgm2DKXFmePCuE6ntkzbDol4ukwIXOlI86ZQfQRm0 r+Max35BWKrCuyUxAGLFSXOxU6xqjTvB6mYSdLCTTNvT6ZS8OG/dZlB4B7tclJ2UqbaX 7qtQ== X-Gm-Message-State: AOAM531HzLW2zVL6ruOge/O8TPml3ftSicSs8V4sLHNJE3yQolWo/x/z y7PLCKP4XXzB1rOdTlWGIB9+9MEpDxv20eYVodXsNOVEve62rjftML9d+5UdhhyiUkUtkmBpVaf DLDNrAbZtRD9tmlb1fxld1EG8QbQUNxWUQ2vG++7jdPUzxC52sGtJRoPCKkHf3yOw428= X-Received: by 2002:adf:ded0:: with SMTP id i16mr9275138wrn.335.1637341154023; Fri, 19 Nov 2021 08:59:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN18RdVVe0YMYYqiTqb2XW+femKkO6mJNgM7Ej4+O2RdGuxAoyzVkd1KHE7B5HqsiKbL2tsw== X-Received: by 2002:adf:ded0:: with SMTP id i16mr9275105wrn.335.1637341153857; Fri, 19 Nov 2021 08:59:13 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id g5sm477883wri.45.2021.11.19.08.59.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:13 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 07/11] multifd: Make zlib use iov's Date: Fri, 19 Nov 2021 17:58:59 +0100 Message-Id: <20211119165903.18813-8-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Juan Quintela --- migration/multifd-zlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 40d4cbd0b8..2c385e57bc 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -144,6 +144,9 @@ static int zlib_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) } out_size += available - zs->avail_out; } + p->iov[p->iovs_used].iov_base = z->zbuff; + p->iov[p->iovs_used].iov_len = out_size; + p->iovs_used++; p->next_packet_size = out_size; p->flags |= MULTIFD_FLAG_ZLIB; @@ -163,10 +166,7 @@ static int zlib_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) */ static int zlib_send_write(MultiFDSendParams *p, uint32_t used, Error **errp) { - struct zlib_data *z = p->data; - - return qio_channel_write_all(p->c, (void *)z->zbuff, p->next_packet_size, - errp); + return qio_channel_writev_all(p->c, p->iov, p->iovs_used, errp); } /** From patchwork Fri Nov 19 16:59:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cm2BwliE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hwjng3D6Xz9sX3 for ; Sat, 20 Nov 2021 04:09:27 +1100 (AEDT) Received: from localhost ([::1]:51612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7O8-0001vv-1X for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 12:09:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7ES-0005ND-Fn for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48512) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EM-00037w-TZ for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341157; 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=wUyzTbOJjOPgXqSYs2to7uChDHjS+MqAZ2UTXfAVcng=; b=cm2BwliEEzRvbFMqrPz3Czhin2GjQVHozkQ04NSvJOMafV4kAAH+E5/a0o/pPa7MtXefx5 dVjzks50Udy3E2XcOoHPj5A0dLavjs7wmbzAJ9g/UCkcdpY9R7gW65UyTWsSSRCr6eHNN9 T6J0sfGMz3VJ+4m+lISsqvd3UpO/3CM= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-232-q_KyJF_FOuauQ1ZVPJVsFQ-1; Fri, 19 Nov 2021 11:59:16 -0500 X-MC-Unique: q_KyJF_FOuauQ1ZVPJVsFQ-1 Received: by mail-wm1-f70.google.com with SMTP id m14-20020a05600c3b0e00b0033308dcc933so5025445wms.7 for ; Fri, 19 Nov 2021 08:59:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wUyzTbOJjOPgXqSYs2to7uChDHjS+MqAZ2UTXfAVcng=; b=5AY6cx+wCFVVAByCyIRpB745DTQhSqF0tqr6oO1lLQYnFzauV1m5SWz7qVyjFhIoQK NkPYZ+pleuqQXyj7niW4dLgVT/qO1S0i6e5kxyjJUZNh2XFMalg99Nj4C3akD1Ug7ja5 GWthb+GVWLi3/Y6hMiECdd7FB+PibDSjDvXjFEF6SFNs9RQZGeUVpw4Km9FnBZ5Y+8Ro NjEcWnI5RbgENd8an6tpRgumb6mvdyvW52om94rQrfGvQRbTG5wMwPr5gcU3WikARAI+ ByfI/6b+wplbeJOR3B/CO/tVbBLiYmQ0JieskRUL8fqBNLCVXXA/ihnlY1VXqKoHTaVt lkcw== X-Gm-Message-State: AOAM530fLdnEu6WhVwCYAE5mToOIleYIgaqfPBLQqweUJ3c19FoX/YS8 BJ4Ww7fAROldcTr4Bso4xMPlB2KAOCXfqvvpqBTYpeQFK3TJg8HZBI3EzNPuPRrsiXBft6nDSWz 3z2xq9rNPd1Dg6zd0dMFdxyry9nZhzwjVqaYAHZLakwUmtLlQDJ7q8pTCHNaZNacI4Zo= X-Received: by 2002:adf:efc6:: with SMTP id i6mr9344057wrp.428.1637341155231; Fri, 19 Nov 2021 08:59:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrpT7GblCgXsaFm7U/gHEKfMSCw4J2QEpRW0x8Fj+6k5MtwYtZIfwm9xHVsXdvP9aOYo/nZw== X-Received: by 2002:adf:efc6:: with SMTP id i6mr9344020wrp.428.1637341154985; Fri, 19 Nov 2021 08:59:14 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id ay21sm13003396wmb.7.2021.11.19.08.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:14 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 08/11] multifd: Make zstd use iov's Date: Fri, 19 Nov 2021 17:59:00 +0100 Message-Id: <20211119165903.18813-9-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Juan Quintela --- migration/multifd-zstd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 1dccdbd733..6183d0b26d 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -155,6 +155,9 @@ static int zstd_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) return -1; } } + p->iov[p->iovs_used].iov_base = z->zbuff; + p->iov[p->iovs_used].iov_len = z->out.pos; + p->iovs_used++; p->next_packet_size = z->out.pos; p->flags |= MULTIFD_FLAG_ZSTD; @@ -174,10 +177,7 @@ static int zstd_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) */ static int zstd_send_write(MultiFDSendParams *p, uint32_t used, Error **errp) { - struct zstd_data *z = p->data; - - return qio_channel_write_all(p->c, (void *)z->zbuff, p->next_packet_size, - errp); + return qio_channel_writev_all(p->c, p->iov, p->iovs_used, errp); } /** From patchwork Fri Nov 19 16:59:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1557323 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JxZWV3DG; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hwjv60pcPz9sXS for ; Sat, 20 Nov 2021 04:14:10 +1100 (AEDT) Received: from localhost ([::1]:60132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo7Sh-0007ps-Qx for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2021 12:14:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EV-0005TU-3f for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:49692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo7EO-00038E-1V for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:59:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637341159; 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=vuMhtlBOUpnW7vrr3mqtU0Q/MSUM/C83+9vL+HWbmWU=; b=JxZWV3DGy3l3o0YI70oH7nLtGsBuZNU17r+83jr2JpK0JwNZBHlIYwldoqJXIBTd2wwMy9 gcVaXqGJe2szhhJ/pVcs98x0ir5g7oVMeytOsme85xcmDnDYwHO5AnB9LnXJUcVQ3yOBGD zy8G8n9sQ/+GnmKtiNoTgswTMZjK/vg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-263-7ts9AYgQPRu_K-h98j9svw-1; Fri, 19 Nov 2021 11:59:18 -0500 X-MC-Unique: 7ts9AYgQPRu_K-h98j9svw-1 Received: by mail-wr1-f69.google.com with SMTP id f3-20020a5d50c3000000b00183ce1379feso1889285wrt.5 for ; Fri, 19 Nov 2021 08:59:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vuMhtlBOUpnW7vrr3mqtU0Q/MSUM/C83+9vL+HWbmWU=; b=qzOcHTj3wsD7T4/rU8/UFZGITGeU/yPlSbJPWBvVV3SLqxGUV/LYPlAZw5AITl3XLV fRLcsJ2WyWqRTMOE5AYaXmX1nzLyqzmAX66HR/2XPEWKCdwa2ednJ7PASusFNHIb69qB O0VTCaw9IFn2zwu6cKZBthJwAK8I5Q3v3GIfCruA7Y+dAHQ1rxIYFFKvCpvUgkFV2y6C HeVdqidXcUpNygZehETA/TxU7moVk2Vn7NMMsDKgkNCucuwx0a51uwDAmH8OR2pa0jQ6 Er2/nNfPZYCyyAwYCZaP55eIvHAG0QKxOKyyputwF11KwbPrTOuLZWrZJxAe2HZE6+P7 Gi7A== X-Gm-Message-State: AOAM533VCLz2B3ETMXWmsMp1jOA47qv+4Sfo4syBwvxhTabD85hDvu1p +r+wcSqovlYZD4sslnxXvVgW7bT+9dvp0kVjgv4lKkRFQKfAFcobPOeHjgXhe1KgIWkfRDjh+kv K6mN/LyOFjKkZ+FGKRuUdcp8/I0qs4Y/xPjQ3MXD4it65jMYo7achsdgbQ9N5zqdt5Fk= X-Received: by 2002:adf:ded0:: with SMTP id i16mr9275454wrn.335.1637341156421; Fri, 19 Nov 2021 08:59:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyR0Kbhe8IXubs7xFnC9CYmiQ3S1F4CkKjNjlFJcbm68sIsi9t346cILtxQPeLrU0JjgM5qg== X-Received: by 2002:adf:ded0:: with SMTP id i16mr9275417wrn.335.1637341156191; Fri, 19 Nov 2021 08:59:16 -0800 (PST) Received: from localhost (static-233-86-86-188.ipcom.comunitel.net. [188.86.86.233]) by smtp.gmail.com with ESMTPSA id s13sm13135534wmc.47.2021.11.19.08.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:59:15 -0800 (PST) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH 09/11] multifd: Remove send_write() method Date: Fri, 19 Nov 2021 17:59:01 +0100 Message-Id: <20211119165903.18813-10-quintela@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211119165903.18813-1-quintela@redhat.com> References: <20211119165903.18813-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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_H4=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Juan Quintela , "Dr. David Alan Gilbert" , Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Everything use now iov's. Signed-off-by: Juan Quintela --- migration/multifd.h | 2 -- migration/multifd-zlib.c | 17 ----------------- migration/multifd-zstd.c | 17 ----------------- migration/multifd.c | 20 ++------------------ 4 files changed, 2 insertions(+), 54 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 67f9104051..f50c51f365 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -164,8 +164,6 @@ typedef struct { void (*send_cleanup)(MultiFDSendParams *p, Error **errp); /* Prepare the send packet */ int (*send_prepare)(MultiFDSendParams *p, uint32_t used, Error **errp); - /* Write the send packet */ - int (*send_write)(MultiFDSendParams *p, uint32_t used, Error **errp); /* Setup for receiving side */ int (*recv_setup)(MultiFDRecvParams *p, Error **errp); /* Cleanup for receiving side */ diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 2c385e57bc..1201473fa4 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -153,22 +153,6 @@ static int zlib_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) return 0; } -/** - * zlib_send_write: do the actual write of the data - * - * Do the actual write of the comprresed buffer. - * - * Returns 0 for success or -1 for error - * - * @p: Params for the channel that we are using - * @used: number of pages used - * @errp: pointer to an error - */ -static int zlib_send_write(MultiFDSendParams *p, uint32_t used, Error **errp) -{ - return qio_channel_writev_all(p->c, p->iov, p->iovs_used, errp); -} - /** * zlib_recv_setup: setup receive side * @@ -312,7 +296,6 @@ static MultiFDMethods multifd_zlib_ops = { .send_setup = zlib_send_setup, .send_cleanup = zlib_send_cleanup, .send_prepare = zlib_send_prepare, - .send_write = zlib_send_write, .recv_setup = zlib_recv_setup, .recv_cleanup = zlib_recv_cleanup, .recv_pages = zlib_recv_pages diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 6183d0b26d..1532450204 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -164,22 +164,6 @@ static int zstd_send_prepare(MultiFDSendParams *p, uint32_t used, Error **errp) return 0; } -/** - * zstd_send_write: do the actual write of the data - * - * Do the actual write of the comprresed buffer. - * - * Returns 0 for success or -1 for error - * - * @p: Params for the channel that we are using - * @used: number of pages used - * @errp: pointer to an error - */ -static int zstd_send_write(MultiFDSendParams *p, uint32_t used, Error **errp) -{ - return qio_channel_writev_all(p->c, p->iov, p->iovs_used, errp); -} - /** * zstd_recv_setup: setup receive side * @@ -325,7 +309,6 @@ static MultiFDMethods multifd_zstd_ops = { .send_setup = zstd_send_setup, .send_cleanup = zstd_send_cleanup, .send_prepare = zstd_send_prepare, - .send_write = zstd_send_write, .recv_setup = zstd_recv_setup, .recv_cleanup = zstd_recv_cleanup, .recv_pages = zstd_recv_pages diff --git a/migration/multifd.c b/migration/multifd.c index 4368b7f855..f748250c0e 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -100,22 +100,6 @@ static int nocomp_send_prepare(MultiFDSendParams *p, uint32_t used, return 0; } -/** - * nocomp_send_write: do the actual write of the data - * - * For no compression we just have to write the data. - * - * Returns 0 for success or -1 for error - * - * @p: Params for the channel that we are using - * @used: number of pages used - * @errp: pointer to an error - */ -static int nocomp_send_write(MultiFDSendParams *p, uint32_t used, Error **errp) -{ - return qio_channel_writev_all(p->c, p->iov, p->iovs_used, errp); -} - /** * nocomp_recv_setup: setup receive side * @@ -173,7 +157,6 @@ static MultiFDMethods multifd_nocomp_ops = { .send_setup = nocomp_send_setup, .send_cleanup = nocomp_send_cleanup, .send_prepare = nocomp_send_prepare, - .send_write = nocomp_send_write, .recv_setup = nocomp_recv_setup, .recv_cleanup = nocomp_recv_cleanup, .recv_pages = nocomp_recv_pages @@ -688,7 +671,8 @@ static void *multifd_send_thread(void *opaque) } if (used) { - ret = multifd_send_state->ops->send_write(p, used, &local_err); + ret = qio_channel_writev_all(p->c, p->iov, p->iovs_used, + &local_err); if (ret != 0) { break; }