From nobody Fri Nov 11 15:04:10 2022 X-Original-To: dev-commits-src-main@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 4N826L4VKjz4dtpW; Fri, 11 Nov 2022 15:04:10 +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 4N826L423Tz4H6D; Fri, 11 Nov 2022 15:04:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668179050; 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=SnHZWNRUrNykVtx5EvSZyvaqaokRc6Nlv4wmtgaSaLw=; b=cYCzqXJd+icxnfCyJ09KocSQDljYo9SQCCUXKbSBYPt7u55zA0JIiwMdXPs/2lCfczWcYH n7WBsBLj0XQhVC8bRp8BEq8Lux3oSU5eEInD/4CR6YxcvmjD784n6CaONaf8a5Y5Vui2Vg 51rOyRlH508C8Hy3xhKZbKD2m1jOOv311hWpJu7P47z91NpnBebTe2z3T88gCoZonICm8I lSl1xLD4iGDhZD9JRKEWFGra1umHt3jJPAOMawQ0HPNGVZ3CGUZdiDlDxn3NEaY/TTPr6j yZgYGopZg/oSrpkVBwWkY2YTA6gMu7uylGzDSlGO3imxci7p+tInqE/iQw3J+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668179050; 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=SnHZWNRUrNykVtx5EvSZyvaqaokRc6Nlv4wmtgaSaLw=; b=uE4UwWmrEMKARhg+dmrpfo76DcYh7b46jmbDAceKcJ7+zWAr4gkaIezcshwlZ3lC1w2GF6 ScPtwce8tPLyKkOf3I4usKZpzkPJOEH+2fO0i7uge1p1F/Xa0a3s3EdIjjpXatq9EVN5hx 4vJqMK4ySCMzmXCeEUafLyUYSe3t5ap+mp53Wwib2wvnzyDmFGXvhpPs53lsVNEaV0If1T Rf/hG74hmMsNE6qjK4Y6oBcuQSiHaOEMgLkSRJpHkOjoPpgMy5pN7zkT71gafBFKHqgvKl 5Yw+DMmCUn/fBrQkRcP+gmiJT6YycYA/VLhVbZMQanVYNe8eRikC3Lb+/y26ww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668179050; a=rsa-sha256; cv=none; b=Py4888dHEYY4A5OBHwfG8RVOVbma5gLQBTsMVjVMiBUML3iRphcmROkk3JenP0r6yDaQGd 30W3NHoWxg3h9v/NijjMOro4LwvgLrZPq6xRHMsbhYpfnSluvaIKD+82uAUxK/clhiur8a okoMWOOJt4ziEucwXWykGvbbAsg0kwnOSqaHWIqDUezde8YgiYy+BlMRMARV0j7Cca6W+X tpmbPxQGN4ZJ6EZvUoCE2JQZvLHvJMmjxjqQOJ67nK8B9ICJUzjufOQ01I3fjAbEcC1k5W agwuZC/VMDSu2IQDC1Vq7MByn3jYalxkxiASnBZFCFjm+TY/CfAMK5k8b7lA4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4N826L2yxWzmb6; Fri, 11 Nov 2022 15:04:10 +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 2ABF4Ahi094220; Fri, 11 Nov 2022 15:04:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ABF4Akc094219; Fri, 11 Nov 2022 15:04:10 GMT (envelope-from git) Date: Fri, 11 Nov 2022 15:04:10 GMT Message-Id: <202211111504.2ABF4Akc094219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8b1adff8bcbd - main - bhyve: Drop volatile qualifiers from snapshot code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 8b1adff8bcbdf0e58878431c6ed5a14553178d4d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8b1adff8bcbdf0e58878431c6ed5a14553178d4d commit 8b1adff8bcbdf0e58878431c6ed5a14553178d4d Author: Mark Johnston AuthorDate: 2022-11-11 15:02:26 +0000 Commit: Mark Johnston CommitDate: 2022-11-11 15:02:26 +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 --- 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 0c7267316a17..6f4e3c1f91a2 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -1584,8 +1584,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; @@ -1599,9 +1598,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); @@ -1667,8 +1666,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; @@ -1685,9 +1683,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;