From nobody Thu Nov 28 08:43:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693092320; cv=none; d=zohomail.com; s=zohoarc; b=FyxDOay0kNPb/0dZX5AxZ0DHdCAwavN/IvjisQKNn4+LFVVLSko4CdqhkxrIT2lwrL9JV4MD8Gpja9IVX7RwahvXIJyXdAnWtJHpeA+6rR7mJjNUPd+PPyxTES0mgMWiC3yrV96vbWk80h/DhqPdO1k+n3/NfIdmkU3GhuHjpAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693092320; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lAdtNsi8ueSm/FaTXl8r9wCJNZiral8qMJdVDfCEFMk=; b=GS7jHL/y2FXRlu2G9rJXRGckayN9AYENqgrPq648mIHSZ8i/kHUKgDfziTWK2RxaUWeCH/xA1LeSaIfemxAv3PExu7GxKOjd8Xt8SNsC4tcFkB75CdEyxznhA3nAbgn5MA0FuExj9efd1K74p8JN5/xhXfATygbgYpz+VgXDWDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693092320217754.5083596914758; Sat, 26 Aug 2023 16:25:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qa2dw-0000Sg-Ns; Sat, 26 Aug 2023 19:24:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qa2dj-0000RF-CX for qemu-devel@nongnu.org; Sat, 26 Aug 2023 19:24:24 -0400 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qa2dh-00066K-2i for qemu-devel@nongnu.org; Sat, 26 Aug 2023 19:24:23 -0400 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3a7d4030621so1308286b6e.3 for ; Sat, 26 Aug 2023 16:24:20 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id u9-20020a63a909000000b005633311c70dsm4226472pge.32.2023.08.26.16.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Aug 2023 16:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693092260; x=1693697060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lAdtNsi8ueSm/FaTXl8r9wCJNZiral8qMJdVDfCEFMk=; b=Bj7QkS7hD9216l11I3EMVFauRe9ao8eKIoZ4dWgTJlCkCMGOUHC/l9h7+sA8vtK5RQ dmiumzA6SOYPk0/tBUZ0LIzL09B39pcjq+E8F02QgGGgx7Bmx4eAyaMxlIcn4O/50bd7 smVzm0gNsai3hWpV+nj6rQmziJbJ446R/V4J3MBrSgQu/yGaWLyl5qTnY5dD9rFJdeyV RNvOI7q56azjBiA2GAfL5Ytu+DowT1Y3ZUID5Byk9bInJMvZ2gU323K1cGJoQ634LZ2l FNC1CvJwSOJnsl97g42IAMW4xR9xRFNtsVirNRcXnNOG/7/TXPCqbrhe6wr3YfMwUX7X 3BVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693092260; x=1693697060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lAdtNsi8ueSm/FaTXl8r9wCJNZiral8qMJdVDfCEFMk=; b=S+EpyMcJLt8crxkCjKW4cD3NirNWJzLQphiZa+KhoP79qcJJo8Y7pYIqLZzdoBqSEu gv1P0Tj8XWgvKACi+y6Pw5/J84nFJgnPWc2TS7cy7Uj23FdfCT5Ha702QFw/0DaiKEZK Y/W1uvJ3QwGUJD1MDRHTSd1/SlWNUVIe7T67a1gDVgeU8LwhF7UXwzxMx5F0Zk3cQXuA VqoHZ0kgbD8y0BFKzXbVmzXYEJo/ZBGOzz24dbyZTfnYHF3mit4kR+spu8r0sy+yvJ2j KxfEWwzpgwM7KHzZhj0Y8Bqcc3CcwJoBSV3YHHTut5cdnXd7V0Je9HTIFdG84xlr580b Rtdg== X-Gm-Message-State: AOJu0YxHsDUSA37sBpCAU9Nrn4YfYbZxbEU3k3IyZjEln9UfmusJSoAH uJosSP8KwEWKLbLQv577YdAmVFxIWwWqRGUTHu4= X-Google-Smtp-Source: AGHT+IFGQSDjBPOivnu8wndlmSTUGralGMGA1QVHPYMriPmvBAhlCTbOOp+WMhkyRouPg+kYX3459g== X-Received: by 2002:a54:4f03:0:b0:3a8:443b:d87b with SMTP id e3-20020a544f03000000b003a8443bd87bmr7235361oiy.34.1693092259406; Sat, 26 Aug 2023 16:24:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org Subject: [PATCH 1/3] softmmu: Assert data in bounds in iotlb_to_section Date: Sat, 26 Aug 2023 16:24:13 -0700 Message-Id: <20230826232415.80233-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230826232415.80233-1-richard.henderson@linaro.org> References: <20230826232415.80233-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x232.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1693092322477100011 Suggested-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Acked-by: Alex Benn=C3=A9e --- softmmu/physmem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 3df73542e1..7597dc1c39 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -2413,9 +2413,15 @@ MemoryRegionSection *iotlb_to_section(CPUState *cpu, int asidx =3D cpu_asidx_from_attrs(cpu, attrs); CPUAddressSpace *cpuas =3D &cpu->cpu_ases[asidx]; AddressSpaceDispatch *d =3D qatomic_rcu_read(&cpuas->memory_dispatch); - MemoryRegionSection *sections =3D d->map.sections; + int section_index =3D index & ~TARGET_PAGE_MASK; + MemoryRegionSection *ret; =20 - return §ions[index & ~TARGET_PAGE_MASK]; + assert(section_index < d->map.sections_nb); + ret =3D d->map.sections + section_index; + assert(ret->mr); + assert(ret->mr->ops); + + return ret; } =20 static void io_mem_init(void) --=20 2.34.1 From nobody Thu Nov 28 08:43:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693092320; cv=none; d=zohomail.com; s=zohoarc; b=gStlNhFcLQ7sQhBd0JgcMJ6KFB9nvPeTf9nYYcJxeW9I5L/X0yyI3eZxvZjLH2Gkpl0fcY7QqfO9teWWvpG/e3DL1vmNxYJrwa+EA1i3h9u80MdOU7slUwR8LZU58JOwzBeBBgX4z++2g1R5//o/q0CkTaOKl7bjQU48d+ZbIOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693092320; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m4J6eq/v5V1H1fkQEu9wQ8wHYQUH4m1you9F+PZm5SU=; b=lKrSkg6qxcUlMbSjcwlpecgnKukQMystcFcGOtSEVAThaCxz/+8rRU2tw+mtKKh9XZfDiXvvzBmVnafnslNoHLLFf2dgZHcwxOItTqvbeyqqXuO/70dpEaO6zmFE/N1e86iHn56aJsCy8hffWKCuRqM2X7mOBJl2Fm9x9YO+6zI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693092320176254.59252562601773; Sat, 26 Aug 2023 16:25:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qa2dy-0000T0-1O; Sat, 26 Aug 2023 19:24:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qa2dn-0000Rb-3L for qemu-devel@nongnu.org; Sat, 26 Aug 2023 19:24:28 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qa2dh-00066R-Pf for qemu-devel@nongnu.org; Sat, 26 Aug 2023 19:24:25 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3a7f4f7a8easo1096713b6e.2 for ; Sat, 26 Aug 2023 16:24:21 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id u9-20020a63a909000000b005633311c70dsm4226472pge.32.2023.08.26.16.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Aug 2023 16:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693092260; x=1693697060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m4J6eq/v5V1H1fkQEu9wQ8wHYQUH4m1you9F+PZm5SU=; b=vCPnKSVbESkMAxpwhkHwJlUwtYIa1IJnx6FSggjfoNMgvBDrHFZ0TNmKfPpur7o5uc NsOrTk0OwVzDaQ1d3WBdllcIyhO5/j4fjSuFeU/vy8zrKYj3FIONpBkkZNVg5LkY2cAI fdMLj/Y58Hy0cEvJ8uFjWH0WmwNdxVVzositPEP9g7fgaujBTqmDwykU0gFIDyK8cOD4 PThh/IyCD4hRtfvHgJfA6WGa1OM9Loiq8CAYs2hAp4zczr7+z8uPaxQZKbafrO7ivDup xiQM9Octg6rcYpA8flFa2ynnAPYTQUDhwSa3K4Up3uYCMG77jRDxNDEv8kD+SbbftSOB XhGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693092260; x=1693697060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m4J6eq/v5V1H1fkQEu9wQ8wHYQUH4m1you9F+PZm5SU=; b=cD9j4Ram9ncrIfCR77p8qWCBCnk/c75ry030iE9mOLBXHxUG2edo+lEbBARqiyiROP dHf51IPhURHPS0heL3414tq7B8ru9LJe+w8QmyYqGGQVG2GFYz00nMppQHzXjA533xWP yE4k35TUoaDMYAtSCe9Kuu8h6tRPRSASnOa8+weVxW+lBDzulvP8uunpv6GdTzx4oe59 OZ/av3yznCzwI6i6b/MvndfpEwYjquszRpz0Hx0zvghca422LyaYFf7RedRq0fIlp7V+ 0QHejAUdHrBAsofK3gNyeIk94OiPVrnVW2jlLGhsuVEzHxfgehm5byGPOmyQ4j2wLXQM GQgw== X-Gm-Message-State: AOJu0Yx5fY+GAGCfuBDz8pSDazCK3hwtiQDrQDo9MXmS8D6L9fpdB9N1 4iU8qkpub9ZaTBSrpq4dPRz2J64tMYt02Z+hcFE= X-Google-Smtp-Source: AGHT+IEkgIcT5guGsEKuGfa+eAq48d6tDFs0OaE+85KLlPVb7e0mF+WK+sN9mPWT4fSh8vqFCs7C/Q== X-Received: by 2002:a54:441a:0:b0:3a8:f3e7:d691 with SMTP id k26-20020a54441a000000b003a8f3e7d691mr6534937oiw.37.1693092260577; Sat, 26 Aug 2023 16:24:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org Subject: [PATCH 2/3] softmmu: Use async_run_on_cpu in tcg_commit Date: Sat, 26 Aug 2023 16:24:14 -0700 Message-Id: <20230826232415.80233-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230826232415.80233-1-richard.henderson@linaro.org> References: <20230826232415.80233-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1693092321915100004 Content-Type: text/plain; charset="utf-8" After system startup, run the update to memory_dispatch and the tlb_flush on the cpu. This eliminates a race, wherein a running cpu sees the memory_dispatch change but has not yet seen the tlb_flush. Since the update now happens on the cpu, we need not use qatomic_rcu_read to protect the read of memory_dispatch. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1826 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1834 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1846 Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e Tested-by: Jonathan Cameron --- softmmu/physmem.c | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 7597dc1c39..18277ddd67 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -680,8 +680,7 @@ address_space_translate_for_iotlb(CPUState *cpu, int as= idx, hwaddr orig_addr, IOMMUTLBEntry iotlb; int iommu_idx; hwaddr addr =3D orig_addr; - AddressSpaceDispatch *d =3D - qatomic_rcu_read(&cpu->cpu_ases[asidx].memory_dispatch); + AddressSpaceDispatch *d =3D cpu->cpu_ases[asidx].memory_dispatch; =20 for (;;) { section =3D address_space_translate_internal(d, addr, &addr, plen,= false); @@ -2412,7 +2411,7 @@ MemoryRegionSection *iotlb_to_section(CPUState *cpu, { int asidx =3D cpu_asidx_from_attrs(cpu, attrs); CPUAddressSpace *cpuas =3D &cpu->cpu_ases[asidx]; - AddressSpaceDispatch *d =3D qatomic_rcu_read(&cpuas->memory_dispatch); + AddressSpaceDispatch *d =3D cpuas->memory_dispatch; int section_index =3D index & ~TARGET_PAGE_MASK; MemoryRegionSection *ret; =20 @@ -2487,23 +2486,42 @@ static void tcg_log_global_after_sync(MemoryListene= r *listener) } } =20 +static void tcg_commit_cpu(CPUState *cpu, run_on_cpu_data data) +{ + CPUAddressSpace *cpuas =3D data.host_ptr; + + cpuas->memory_dispatch =3D address_space_to_dispatch(cpuas->as); + tlb_flush(cpu); +} + static void tcg_commit(MemoryListener *listener) { CPUAddressSpace *cpuas; - AddressSpaceDispatch *d; + CPUState *cpu; =20 assert(tcg_enabled()); /* since each CPU stores ram addresses in its TLB cache, we must reset the modified entries */ cpuas =3D container_of(listener, CPUAddressSpace, tcg_as_listener); - cpu_reloading_memory_map(); - /* The CPU and TLB are protected by the iothread lock. - * We reload the dispatch pointer now because cpu_reloading_memory_map= () - * may have split the RCU critical section. + cpu =3D cpuas->cpu; + + /* + * Defer changes to as->memory_dispatch until the cpu is quiescent. + * Otherwise we race between (1) other cpu threads and (2) ongoing + * i/o for the current cpu thread, with data cached by mmu_lookup(). + * + * In addition, queueing the work function will kick the cpu back to + * the main loop, which will end the RCU critical section and reclaim + * the memory data structures. + * + * That said, the listener is also called during realize, before + * all of the tcg machinery for run-on is initialized: thus halt_cond. */ - d =3D address_space_to_dispatch(cpuas->as); - qatomic_rcu_set(&cpuas->memory_dispatch, d); - tlb_flush(cpuas->cpu); + if (cpu->halt_cond) { + async_run_on_cpu(cpu, tcg_commit_cpu, RUN_ON_CPU_HOST_PTR(cpuas)); + } else { + tcg_commit_cpu(cpu, RUN_ON_CPU_HOST_PTR(cpuas)); + } } =20 static void memory_map_init(void) --=20 2.34.1 From nobody Thu Nov 28 08:43:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693092324; cv=none; d=zohomail.com; s=zohoarc; b=OCf2puhruPnlSrfSAe0TnI6Myln4xby2Jusy+kC2P+IaXL98YcrOMINtIyl1N8fRsrsfyNUaxkaWA5rYCrtCV/x6WqI5dm9CBJwEucCmc+hNaD4T5lGIGd3dkZ/ORYTqmk+U+VXsejPfLPWGn+TX6ezfHlNU/3QpvO1aam8BhIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693092324; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oFn1LgnAzbXnHqrJlI8Dpzt3UFxqmFwBrMDqITY7sQE=; b=eWJfVIeLOHZ7/6JZ4F+tLO3bYKSj4Zp7xaA1YPioF0oYFRUzMfEjgzCfDV1QT+9paP2HW0oiNjhF86vIqdIf9aa4p8m+Dp2+GqpJevX8qbDx1lfHPKknzNg/LPFZG7uLx+MFAdnyH6cAj5Koi8m9uub3avZ3G6LPAadu0H3fc7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693092324900732.9011226915246; Sat, 26 Aug 2023 16:25:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qa2dx-0000Sv-F4; Sat, 26 Aug 2023 19:24:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qa2dn-0000Rc-3i for qemu-devel@nongnu.org; Sat, 26 Aug 2023 19:24:28 -0400 Received: from mail-yw1-x112b.google.com ([2607:f8b0:4864:20::112b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qa2dj-00066Z-DY for qemu-devel@nongnu.org; Sat, 26 Aug 2023 19:24:26 -0400 Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-58caaedb20bso24528577b3.1 for ; Sat, 26 Aug 2023 16:24:23 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id u9-20020a63a909000000b005633311c70dsm4226472pge.32.2023.08.26.16.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Aug 2023 16:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693092262; x=1693697062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oFn1LgnAzbXnHqrJlI8Dpzt3UFxqmFwBrMDqITY7sQE=; b=Ew9EnDlUHHms/ipkzxlKDVOGsHPeNYH7uZpGJZXtlcBMzC1fGyrjaV7yzboul975WT B1mY+QcBZWXr/fw6sOkepMJVKpZOrzio4gK+JH/F1SWn32p4scD46dP9WVnT+wY436so 5KlujhSAg/RvAH7m1lVLysyV01rRbcmOt6ojTYSwxYIaU3FvtkOlLVH+/cbbSqOD3g/Z FuaRAP2P8NYU7rUG//fyHUh5rXqGaSuo5y0gGLxHaXBUMg46PrAGadtW/or5MMBKAZQ5 Gu5gT4ls1he3wdkeVI7gqV0LyKehN8H58v5+xJgc8j9egU2Gc0PP4HEalYk5axzXFaHC K6Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693092262; x=1693697062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oFn1LgnAzbXnHqrJlI8Dpzt3UFxqmFwBrMDqITY7sQE=; b=Bo3jCwBFZfpU5FTZG3wf71Po74Rx9ep6O05wYChTt2M1TsXnC5XsiQq3lzKdyzkH5K xC0+wWynHK8ai1CHRlhZiMBhVNvtPUlWpzItcMfKCSG8O2kEV9EhhlK31ZPvGwdgPmwt 79CacvDKej1/XwCXJsHAbDmvqwoFscnM6DM1QwS1HqPkqYXCZ4vNAJKCqMKo+XW2DFIi aiOKv7V8DZl1FGiR3pK+0xGIH4Lj3cozfyxPXuyV6sKChpQ1Z7alxwilKCtORxC08nfH Qbozmnu7d99V03hh1gZpsA3HwCeVsaq/u5aokne50+3QPg0DuELEQjrhNvzN2fsNj9x8 u90g== X-Gm-Message-State: AOJu0Ywjdt0cqfRf+7w3HkHEJFFgg/ttEsb3m/xrnolN2mQFl6HVhLUF 8KUh1IYP6QzFTFGPLKkh7sRJWKfdYIfA21NbCXw= X-Google-Smtp-Source: AGHT+IF0ZWF+CllHHpUl7iDv1bqKsb0PBEEpwJ/V9+u9EdIFYr8Nufmh5uny1rmSvQM2OWQb8TnDhw== X-Received: by 2002:a0d:c182:0:b0:589:ad30:5f5 with SMTP id c124-20020a0dc182000000b00589ad3005f5mr18537517ywd.52.1693092262129; Sat, 26 Aug 2023 16:24:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org Subject: [PATCH 3/3] softmmu: Remove cpu_reloading_memory_map as unused Date: Sat, 26 Aug 2023 16:24:15 -0700 Message-Id: <20230826232415.80233-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230826232415.80233-1-richard.henderson@linaro.org> References: <20230826232415.80233-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::112b; envelope-from=richard.henderson@linaro.org; helo=mail-yw1-x112b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1693092325609100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- include/exec/cpu-common.h | 1 - accel/tcg/cpu-exec-common.c | 30 ------------------------------ 2 files changed, 31 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 87dc9a752c..41788c0bdd 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -133,7 +133,6 @@ static inline void cpu_physical_memory_write(hwaddr add= r, { cpu_physical_memory_rw(addr, (void *)buf, len, true); } -void cpu_reloading_memory_map(void); void *cpu_physical_memory_map(hwaddr addr, hwaddr *plen, bool is_write); diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 9a5fabf625..7e35d7f4b5 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -33,36 +33,6 @@ void cpu_loop_exit_noexc(CPUState *cpu) cpu_loop_exit(cpu); } =20 -#if defined(CONFIG_SOFTMMU) -void cpu_reloading_memory_map(void) -{ - if (qemu_in_vcpu_thread() && current_cpu->running) { - /* The guest can in theory prolong the RCU critical section as long - * as it feels like. The major problem with this is that because it - * can do multiple reconfigurations of the memory map within the - * critical section, we could potentially accumulate an unbounded - * collection of memory data structures awaiting reclamation. - * - * Because the only thing we're currently protecting with RCU is t= he - * memory data structures, it's sufficient to break the critical s= ection - * in this callback, which we know will get called every time the - * memory map is rearranged. - * - * (If we add anything else in the system that uses RCU to protect - * its data structures, we will need to implement some other mecha= nism - * to force TCG CPUs to exit the critical section, at which point = this - * part of this callback might become unnecessary.) - * - * This pair matches cpu_exec's rcu_read_lock()/rcu_read_unlock(),= which - * only protects cpu->as->dispatch. Since we know our caller is ab= out - * to reload it, it's safe to split the critical section. - */ - rcu_read_unlock(); - rcu_read_lock(); - } -} -#endif - void cpu_loop_exit(CPUState *cpu) { /* Undo the setting in cpu_tb_exec. */ --=20 2.34.1