From nobody Tue Nov 29 17:40:22 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NM8kG2Qf1z4jMb5; Tue, 29 Nov 2022 17:40:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NM8kG1yKCz4bkn; Tue, 29 Nov 2022 17:40:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669743622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r0W78wbe8n/m92CusgLOBAEWxWv6hN9lNK8HpLF8cxE=; b=B6aBfEtoGUPveuPaVmYRQG85bXT7nOsdiD08P/oBm7IP6BDL5+w2MkNmtm3CeyxDO31ZCX TZAFbyIKscsOSVeSpASpvx5yYJ8hLNzxhdAkSflpbJWXArDtU5s5nY6IuT7ynFY7/Dtrsh NcvfgK5XT+56i7cwWmKN3b0JHvr8rszJddg0gcZzvPt7y3YFu0T4e9d/Bmozy2Gyyo9enH Mqt5MvEql6k0JOIxhMSpwRYwvwq2cZQTjlmfLx1fxY81vIp5SN2zumITgg3r1DZa5CaBJ2 2bu0T5HOSEh8yfQ9DkIZX9OYcuuvoyDEULTHbRtnG88ZFsflbKvpWdZ1WBpBdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669743622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r0W78wbe8n/m92CusgLOBAEWxWv6hN9lNK8HpLF8cxE=; b=Yk+CsQ9bINUjgSCvKIUqLYKaYuNrn1sX2c5Jgbh3K01owAWUEHltf2FrRq9A5PmzvVgQi1 84igrfcG6r0EHuOD7IWKOAF7KXm/WirfCaZqWQrWCpa8Y5YDpqBMjPErBNv7Eb+9E1e2iq a3A1bYq9dwOuzkT3YWSo9Sj+J6rd0A7ZVWUaL06DlSUv53QWNX2ftLbcgwjho4GC1B6a1z bDhWGN3Ra2PgkVDYqyvxiiTF8mo6pqtVGRA+EQeNTm6a0k9IHyevQQ7IGgqXia26HW80Ec D2BmLFdyEMC6QpIDkxiAQTz+Wc8hinBJUQry+B5HogZ1Y3Upxua8eZWmCGXPOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669743622; a=rsa-sha256; cv=none; b=NXm2qH7/PLOC1yapQAw/CrflWTqDFA75HoQ+Kf1PFure3bqx/7PtbHs8HU4TM+SaEqlfHH xYXYGaeDaN44orZ7uUai0A4g9GxYli0bcp7YnaJ0lBhAEvn+FkSY27mJGOVMJVEvnUdJbB ysQwwjRDa2K2/ncN5DnPW0NShWN26SnUW0xVRznPwATkkhoqqcs/V2i/MGGB/KOZbiFlqr hndOvpiq5XPkqCslaX/XKc9lbpmyUjYlESag60nh6QtGNvhDxy91b9YzV3h1ArYMSVtCyW zWNKZuBIvRgkbjAKnsI2EhehzSwHW9i5GDkTalxARguG9UGb6RgtRi1azQxBwg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NM8kG11LkzQmg; Tue, 29 Nov 2022 17:40:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2ATHeMBY051689; Tue, 29 Nov 2022 17:40:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ATHeM3I051688; Tue, 29 Nov 2022 17:40:22 GMT (envelope-from git) Date: Tue, 29 Nov 2022 17:40:22 GMT Message-Id: <202211291740.2ATHeM3I051688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 385e330c1c5d - stable/13 - bhyve: Drop volatile qualifiers from snapshot code List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 385e330c1c5de51d688e7511ffaac9ad58add34f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=385e330c1c5de51d688e7511ffaac9ad58add34f commit 385e330c1c5de51d688e7511ffaac9ad58add34f Author: Mark Johnston AuthorDate: 2022-11-11 15:02:26 +0000 Commit: Mark Johnston CommitDate: 2022-11-29 17:40:12 +0000 bhyve: Drop volatile qualifiers from snapshot code They accomplish nothing since the qualifier is casted away in calls to memcpy() and copyin()/copyout(). No functional change intended. MFC after: 2 weeks Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D37292 (cherry picked from commit 8b1adff8bcbdf0e58878431c6ed5a14553178d4d) --- sys/amd64/include/vmm_snapshot.h | 10 +++++----- sys/amd64/vmm/vmm_snapshot.c | 17 ++++++----------- usr.sbin/bhyve/snapshot.c | 14 ++++++-------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/sys/amd64/include/vmm_snapshot.h b/sys/amd64/include/vmm_snapshot.h index 8d1ecc1db4b1..d08f980e7988 100644 --- a/sys/amd64/include/vmm_snapshot.h +++ b/sys/amd64/include/vmm_snapshot.h @@ -101,13 +101,13 @@ struct vm_snapshot_meta { }; void vm_snapshot_buf_err(const char *bufname, const enum vm_snapshot_op op); -int vm_snapshot_buf(volatile void *data, size_t data_size, - struct vm_snapshot_meta *meta); +int vm_snapshot_buf(void *data, size_t data_size, + struct vm_snapshot_meta *meta); size_t vm_get_snapshot_size(struct vm_snapshot_meta *meta); int vm_snapshot_guest2host_addr(void **addrp, size_t len, bool restore_null, - struct vm_snapshot_meta *meta); -int vm_snapshot_buf_cmp(volatile void *data, size_t data_size, - struct vm_snapshot_meta *meta); + struct vm_snapshot_meta *meta); +int vm_snapshot_buf_cmp(void *data, size_t data_size, + struct vm_snapshot_meta *meta); #define SNAPSHOT_BUF_OR_LEAVE(DATA, LEN, META, RES, LABEL) \ do { \ diff --git a/sys/amd64/vmm/vmm_snapshot.c b/sys/amd64/vmm/vmm_snapshot.c index c77bb05f76b7..1e5f57028523 100644 --- a/sys/amd64/vmm/vmm_snapshot.c +++ b/sys/amd64/vmm/vmm_snapshot.c @@ -57,14 +57,11 @@ vm_snapshot_buf_err(const char *bufname, const enum vm_snapshot_op op) } int -vm_snapshot_buf(volatile void *data, size_t data_size, - struct vm_snapshot_meta *meta) +vm_snapshot_buf(void *data, size_t data_size, struct vm_snapshot_meta *meta) { struct vm_snapshot_buffer *buffer; int op; - void *nv_data; - nv_data = __DEVOLATILE(void *, data); buffer = &meta->buffer; op = meta->op; @@ -74,9 +71,9 @@ vm_snapshot_buf(volatile void *data, size_t data_size, } if (op == VM_SNAPSHOT_SAVE) - copyout(nv_data, buffer->buf, data_size); + copyout(data, buffer->buf, data_size); else if (op == VM_SNAPSHOT_RESTORE) - copyin(buffer->buf, nv_data, data_size); + copyin(buffer->buf, data, data_size); else return (EINVAL); @@ -106,13 +103,11 @@ vm_get_snapshot_size(struct vm_snapshot_meta *meta) } int -vm_snapshot_buf_cmp(volatile void *data, size_t data_size, - struct vm_snapshot_meta *meta) +vm_snapshot_buf_cmp(void *data, size_t data_size, struct vm_snapshot_meta *meta) { struct vm_snapshot_buffer *buffer; int op; int ret; - void *_data = *(void **)(void *)&data; buffer = &meta->buffer; op = meta->op; @@ -125,9 +120,9 @@ vm_snapshot_buf_cmp(volatile void *data, size_t data_size, if (op == VM_SNAPSHOT_SAVE) { ret = 0; - copyout(_data, buffer->buf, data_size); + copyout(data, buffer->buf, data_size); } else if (op == VM_SNAPSHOT_RESTORE) { - ret = memcmp(_data, buffer->buf, data_size); + ret = memcmp(data, buffer->buf, data_size); } else { ret = EINVAL; goto done; diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 4ffdb315883c..029c291a3cd1 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -1625,8 +1625,7 @@ vm_snapshot_buf_err(const char *bufname, const enum vm_snapshot_op op) } int -vm_snapshot_buf(volatile void *data, size_t data_size, - struct vm_snapshot_meta *meta) +vm_snapshot_buf(void *data, size_t data_size, struct vm_snapshot_meta *meta) { struct vm_snapshot_buffer *buffer; int op; @@ -1640,9 +1639,9 @@ vm_snapshot_buf(volatile void *data, size_t data_size, } if (op == VM_SNAPSHOT_SAVE) - memcpy(buffer->buf, (uint8_t *) data, data_size); + memcpy(buffer->buf, data, data_size); else if (op == VM_SNAPSHOT_RESTORE) - memcpy((uint8_t *) data, buffer->buf, data_size); + memcpy(data, buffer->buf, data_size); else return (EINVAL); @@ -1708,8 +1707,7 @@ done: } int -vm_snapshot_buf_cmp(volatile void *data, size_t data_size, - struct vm_snapshot_meta *meta) +vm_snapshot_buf_cmp(void *data, size_t data_size, struct vm_snapshot_meta *meta) { struct vm_snapshot_buffer *buffer; int op; @@ -1726,9 +1724,9 @@ vm_snapshot_buf_cmp(volatile void *data, size_t data_size, if (op == VM_SNAPSHOT_SAVE) { ret = 0; - memcpy(buffer->buf, (uint8_t *) data, data_size); + memcpy(buffer->buf, data, data_size); } else if (op == VM_SNAPSHOT_RESTORE) { - ret = memcmp((uint8_t *) data, buffer->buf, data_size); + ret = memcmp(data, buffer->buf, data_size); } else { ret = EINVAL; goto done;