From nobody Mon Feb 9 23:01:05 2026 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 1529375634609911.8061031805139; Mon, 18 Jun 2018 19:33:54 -0700 (PDT) Received: from localhost ([::1]:38660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV6Sv-0004sf-QQ for importer@patchew.org; Mon, 18 Jun 2018 22:33:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5hu-0001VD-0O for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5ht-0008N1-01 for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:45:18 -0400 Received: from mail-oi0-x22e.google.com ([2607:f8b0:4003:c06::22e]:42963) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5hs-0008Mc-RN; Mon, 18 Jun 2018 21:45:16 -0400 Received: by mail-oi0-x22e.google.com with SMTP id k190-v6so16694198oib.9; Mon, 18 Jun 2018 18:45:16 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id o55-v6sm10498467otb.51.2018.06.18.18.45.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ctdwtVYPNXOTefE+rDLS0xnoZMYx2WO+KiGPzDBrN24=; b=h3U/ganJ7w9fbKiao4+awo0pJzuQAhU+iOooz5Q9mYVizrbroUQzQJRoBaFsz1XH4i Yl1zFDNW+nUJ/e//7ZSfUQj3/WAFB2crskg/2rdmeSCHhopkaTuX5T10T3sc9W5e7ruO TfPUsitViSO9C7aHqZwK17342akWBu3h6LKzvUaOWr+uzi0VPFb5GzWEWxu7/7+DyJ2e 9TsU6s7YBXb8l4XccPclNrcxkeIPzCxuKK3ZmoJwmqTwdekB/kYFuNUYkNHGOJprLN4c IPfPYBbxJ2uDS6dvCgQByvi9Y07aZoK9+FSTYklscMVcXN674Uh8DWtdPVn5v1qLpxT+ rr3w== 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 :in-reply-to:references; bh=ctdwtVYPNXOTefE+rDLS0xnoZMYx2WO+KiGPzDBrN24=; b=NNwyndV8Z/oSp3gmkvnzWmR/2xRajPdS4aJbP6ca4m4sxudwNMWKpYJNSOz4NPTobI F3rI+ZxLPzGvs5nMf9XFgd8gHrNYJjmPT5eazGVFtFP7bG80qMtq+th4QF5wiYBjEerV hPGPSRN4CNAIvZ+fIm06IxShh/d/W+qoogl9qLW9yJiavP4Y7L4v0nEAUZKbvxXlNTZ9 a8a0RfJqE45LmBYLIRRhzdTBzObdLG2YlOglozxBIPMqDkC4//N2UVjtTrfuJRUAhTOr kjzrTq0Sbcfai01GOEOro55rPZ2cnyGg+YamsG+bBI0BeLkFawsbQLuJWgwS/f/9Nx/d S19w== X-Gm-Message-State: APt69E3DbBCwCipjd04HM7EutboNbh/8mEiyDkaH+LrxcL7URRyfzgW/ bSlIosYrxJYIyJXFl6iNDiqFRaaU X-Google-Smtp-Source: ADUXVKJ51yflGlgu4CtVJhOEp9b2SJMRj94UPbTI/A1DNnhVNd1zyWJh2VQ8eCMHLkvnlTkAe3qfHw== X-Received: by 2002:aca:e895:: with SMTP id f143-v6mr7893378oih.59.1529372715603; Mon, 18 Jun 2018 18:45:15 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:41:59 -0500 Message-Id: <20180619014319.28272-34-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::22e Subject: [Qemu-devel] [PATCH 033/113] address_space_rw: address_space_to_flatview needs RCU lock 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: Paolo Bonzini , qemu-stable@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 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini address_space_rw is calling address_space_to_flatview but it can be called outside the RCU lock. To fix it, transform flatview_rw into address_space_rw, since flatview_rw is otherwise unused. Reviewed-by: Alexey Kardashevskiy Signed-off-by: Paolo Bonzini (cherry picked from commit db84fd973eba3f1e121416dcab73a4e8a60f2526) Signed-off-by: Michael Roth --- exec.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/exec.c b/exec.c index e30155c113..d589283bdd 100644 --- a/exec.c +++ b/exec.c @@ -3108,24 +3108,6 @@ static MemTxResult flatview_read(FlatView *fv, hwadd= r addr, addr1, l, mr); } =20 -static MemTxResult flatview_rw(FlatView *fv, hwaddr addr, MemTxAttrs attrs, - uint8_t *buf, int len, bool is_write) -{ - if (is_write) { - return flatview_write(fv, addr, attrs, (uint8_t *)buf, len); - } else { - return flatview_read(fv, addr, attrs, (uint8_t *)buf, len); - } -} - -MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, uint8_t *buf, - int len, bool is_write) -{ - return flatview_rw(address_space_to_flatview(as), - addr, attrs, buf, len, is_write); -} - MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, uint8_t *buf, int le= n) { @@ -3159,6 +3141,16 @@ MemTxResult address_space_write(AddressSpace *as, hw= addr addr, return result; } =20 +MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs att= rs, + uint8_t *buf, int len, bool is_write) +{ + if (is_write) { + return address_space_write(as, addr, attrs, buf, len); + } else { + return address_space_read_full(as, addr, attrs, buf, len); + } +} + void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf, int len, int is_write) { --=20 2.11.0