From nobody Mon Apr 29 11:15:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516373111586460.07883455963747; Fri, 19 Jan 2018 06:45:11 -0800 (PST) Received: from localhost ([::1]:53234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecXuk-0001do-M0 for importer@patchew.org; Fri, 19 Jan 2018 09:45:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecXpz-0006FS-SQ for qemu-devel@nongnu.org; Fri, 19 Jan 2018 09:40:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecXpu-00064U-UC for qemu-devel@nongnu.org; Fri, 19 Jan 2018 09:40:11 -0500 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:39769) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecXpu-00064M-PE for qemu-devel@nongnu.org; Fri, 19 Jan 2018 09:40:06 -0500 Received: by mail-qt0-x243.google.com with SMTP id f4so4267357qtj.6 for ; Fri, 19 Jan 2018 06:40:06 -0800 (PST) Received: from x1.local ([138.117.48.219]) by smtp.gmail.com with ESMTPSA id f66sm5974364qkc.85.2018.01.19.06.40.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 06:40:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eJWAoU+OZgXDsC4CBQw1s671HOUok6o491CB7ULX2I4=; b=gOeTFFL+S95oR/bqeGwf3HrC62GX4q+E8xiROSbBmgNmWrGcswvZEDEjZz2XpWoAY0 vb8FV9TXGYxkqFjHF0rdhzUAYlyKHz8HZ+NSvSb+SDgVjxiTg1BUkUq1/m+MlAwFZR7x m85UM63l+RbGngtpioTOhM/n6f5pTBR1ZidMQFw7ZrcgvE6B/7X5yXMBGRJv49d59FeU e6m6C7Pf8tL+d8XpnkLj8Ed5/xXLBOH4u+Z1AaoNk5OQJf7ci0ZPp9S+tW4fBTS9552o c6+xqbk+6ZPCYCW+0IAbDMqVI0NNkTfhnObqyAMV6mVyU4JilDTUnZYe8SmqXvV+4zHa M2Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=eJWAoU+OZgXDsC4CBQw1s671HOUok6o491CB7ULX2I4=; b=twoBmIwaDtgHoLcy/8Jo9pnglmP93benemedJhDMy3tJGX1OGBQCbupO2GmHUbuBiz NTFTkNRAMkGnrkgeTfE9MA8o3eorAr0ALgq+0r7/BK41uJGErx5vGZSyMrDlzLNuRrCU gaamPUJXe+aNkzeKsu1Nfqiq1gyF3eRpEIzxRV+dkd1fvm+6Qr28QuW4yoiSTizvlSV+ cMHLq3pAM2eI6FnkZxG/EgYCDRakP2otlyP5P4NGJBdJc71JreV4Eix3Bo2jPc0pv4Pj dgDkd2U2hxTtXpDXTNlko23ueanTX1TSmsDbLKQ0LpZzyVHq+ytqoCbPaFK6e3AJ3hdJ GsEA== X-Gm-Message-State: AKwxytd9SXL5ZckJ9kcP4IbtpkM6UbXJTjyVv59AU6SV3f18ccvNpDxm x2rHspEmdgOqnyMonTcM4fc= X-Google-Smtp-Source: ACJfBotA6Kc3SbBUEvwe/L6NJgAneV0ejJli9bHj6Ry2OolwQXZ87zUSqRJd58ZrMNZeFf3RZIDyUw== X-Received: by 10.200.3.159 with SMTP id t31mr31584263qtg.259.1516372806186; Fri, 19 Jan 2018 06:40:06 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Juan Quintela , "Dr. David Alan Gilbert" , Richard Henderson , Alexey Perevalov Date: Fri, 19 Jan 2018 11:39:51 -0300 Message-Id: <20180119143951.5810-1-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [RFC PATCH] migration: do not use atomic__nocheck() functions directly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 (incorrectly use in 3be98be4e9f) Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- currently on ppc32 the linking fails: CC migration/postcopy-ram.o ... LINK microblaze-softmmu/qemu-system-microblaze ../migration/postcopy-ram.o: In function `mark_postcopy_blocktime_end': migration/postcopy-ram.c:717: undefined reference to `__atomic_fetch_add_8' migration/postcopy-ram.c:738: undefined reference to `__atomic_fetch_add_8' ../migration/postcopy-ram.o: In function `mark_postcopy_blocktime_begin': migration/postcopy-ram.c:651: undefined reference to `__atomic_exchange_8' migration/postcopy-ram.c:652: undefined reference to `__atomic_exchange_8' migration/postcopy-ram.c:661: undefined reference to `__atomic_exchange_8' collect2: error: ld returned 1 exit status Makefile:193: recipe for target 'qemu-system-microblaze' failed make[1]: *** [qemu-system-microblaze] Error 1 with this patch the compilation fails: CC migration/postcopy-ram.o In file included from include/qemu/osdep.h:36:0, from migration/postcopy-ram.c:19: migration/postcopy-ram.c: In function 'mark_postcopy_blocktime_begin': include/qemu/compiler.h:86:30: error: static assertion failed: "not expecti= ng: sizeof(*&dc->last_begin) > ATOMIC_REG_SIZE" #define QEMU_BUILD_BUG_ON(x) _Static_assert(!(x), "not expecting: " #x) ^ include/qemu/atomic.h:183:5: note: in expansion of macro 'QEMU_BUILD_BUG_ON' QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ ^ migration/postcopy-ram.c:651:5: note: in expansion of macro 'atomic_xchg' atomic_xchg(&dc->last_begin, now_ms); ^ migration/postcopy-ram.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 7814da5b4b..6ecc1aa820 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -648,17 +648,17 @@ static void mark_postcopy_blocktime_begin(uintptr_t a= ddr, uint32_t ptid, atomic_inc(&dc->smp_cpus_down); } =20 - atomic_xchg__nocheck(&dc->last_begin, now_ms); - atomic_xchg__nocheck(&dc->page_fault_vcpu_time[cpu], now_ms); - atomic_xchg__nocheck(&dc->vcpu_addr[cpu], addr); + atomic_xchg(&dc->last_begin, now_ms); + atomic_xchg(&dc->page_fault_vcpu_time[cpu], now_ms); + atomic_xchg(&dc->vcpu_addr[cpu], addr); =20 /* check it here, not at the begining of the function, * due to, check could accur early than bitmap_set in * qemu_ufd_copy_ioctl */ already_received =3D ramblock_recv_bitmap_test(rb, (void *)addr); if (already_received) { - atomic_xchg__nocheck(&dc->vcpu_addr[cpu], 0); - atomic_xchg__nocheck(&dc->page_fault_vcpu_time[cpu], 0); + atomic_xchg(&dc->vcpu_addr[cpu], 0); + atomic_xchg(&dc->page_fault_vcpu_time[cpu], 0); atomic_dec(&dc->smp_cpus_down); } trace_mark_postcopy_blocktime_begin(addr, dc, dc->page_fault_vcpu_time= [cpu], @@ -719,7 +719,7 @@ static void mark_postcopy_blocktime_end(uintptr_t addr) read_vcpu_time =3D=3D 0) { continue; } - atomic_xchg__nocheck(&dc->vcpu_addr[i], 0); + atomic_xchg(&dc->vcpu_addr[i], 0); vcpu_blocktime =3D now_ms - read_vcpu_time; affected_cpu +=3D 1; /* we need to know is that mark_postcopy_end was due to --=20 2.15.1