From patchwork Mon May 6 12:37:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 795014 Delivered-To: patch@linaro.org Received: by 2002:adf:a453:0:b0:34e:ceec:bfcd with SMTP id e19csp902041wra; Mon, 6 May 2024 05:40:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUeIlmggnO/n3jo3NsMjWZxiobKsFJfH0qQBozJtISkrAN8UcsuHmx0jwqoFnj5kp6UY8e7EkiZIT8vm7ca7Xou X-Google-Smtp-Source: AGHT+IFpQQ/s+QTs63ugCXjhosB9OiPti2DKfzP6r+/d9OhbElqQdtAtZugyB/BBe0mPbsQnldp0 X-Received: by 2002:a0d:e6d5:0:b0:618:1034:f4ef with SMTP id p204-20020a0de6d5000000b006181034f4efmr9198449ywe.16.1714999258715; Mon, 06 May 2024 05:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714999258; cv=none; d=google.com; s=arc-20160816; b=XyjbS1v31EJme/mXIRzRZtQl017HO/IfEoCJFq07CYcrEEO+qz5W5zlhE5x+a1fYaN moQ/KJePAPfU5wF6pnuJXEvQV+Diu3GG9R4Oi72YmVDiqxIdZZjse437XOkgFO6GCt3a VBnDPrEi/wFNOPGyzN4NtQZ9sKOuvUYJT1sDtvAXb9V/BmdN/Azkxb0lATm1JUohUbpx xtUwA4AQyXr/CkNoOLHqCMdqubtWiS2Lt+aK7bVbNT75dT0zMqAzNMWeCdwcgAEIBLBz LJMJWy30G0GLhRjZwSf31lxtGhS3SCLmLCLn5SrV8zbi4L64Rf7Neth2w0gPaCTOz1mq OADw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JAoBz8aoMGUtkfGWAKV8DQjUNcnX+pc6qT9VuQpXWc0=; fh=t5ckFe1iifY1wq3g6za/3F2QK0Ucp01M/Pw5m9Xn0aU=; b=wCJX5feZlNEciaQW2Zrz3iAqqW2iHbA3pMCWXPfLi0RHCViASyLVz6+kUeOwPcVDm2 9hvH+QRGcOpAf9q8c/9Hl/6K61bGZBS03edyqz1qzRL4YWfKbu7P803SARSB0l2fwQXx sexss67It0js826YRRq0bc/4VTmL9iod8gixtGJgNqL4vIrk3cWeBs3PC7XArdFcse/g N+9zP8AQ65Q1C+9WBb8MciVTPFlbY6LtmmbRK9WgQRoxCT+xnn7pQf/1MjBrHgP17zGm Z7grmceNYtlGk7y73o+k9fZ+Kz1GbE+PeIi+z5kdArBPaMGXEJ3bgLLov32sNa7KsYgI pZmA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uigCCNJY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s6-20020a05622a178600b0043980b93f21si9179467qtk.634.2024.05.06.05.40.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 May 2024 05:40:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uigCCNJY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3xdk-0002X3-FY; Mon, 06 May 2024 08:40:20 -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 1s3xdh-0002I0-0f for qemu-devel@nongnu.org; Mon, 06 May 2024 08:40:17 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3xdf-0002Rk-3C for qemu-devel@nongnu.org; Mon, 06 May 2024 08:40:16 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-34d99ec52e1so1165529f8f.3 for ; Mon, 06 May 2024 05:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714999213; x=1715604013; darn=nongnu.org; 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=JAoBz8aoMGUtkfGWAKV8DQjUNcnX+pc6qT9VuQpXWc0=; b=uigCCNJYID6Wu/qX+qzNWl+O/WIpAJbet0JjbVfoKne1YF7QBofhc3qffq+3goKSxm 39wK3kgj7G8bJK9sD7/utKUprhBhfK1xWR1zzEgvnHDLeWcyPej+WPEEZwHlxdGzDmhb o6hDeMaJJiksdR6lPvOqobkY7JLQvUKwduJuaGD5UIaoEjbLUERBwjbNoxHxj5wj2nQS 5yNaP9SNshh+LliqOc6eYNp/ZiPcYeOnJQlUNZcZimycvzrLlRpfb/7/TIl0wY9t2JpH LwbRYupcD5NHCh52LPBg4SKWdJ5tQj475N+DU+d2cD1RYrw+e0/S4mqTRyNVVcRkXR4u 7Gkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714999213; x=1715604013; 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=JAoBz8aoMGUtkfGWAKV8DQjUNcnX+pc6qT9VuQpXWc0=; b=csR07Uqt0GbGlJks1r9rUZEG6h4YnepRhxyxUAJUWWIJgqYAa5lTokizRsdYWSbdrI OXNd/0XRIo3FqyvH/tOC15+LfoqoAu5sgxZnADS1Wj5wsrHN0rla/pp7AKsubhQCi6Ln XoxbsQ9yK57/RRzj/m9p5BsRVVZergJKgu8vJrR51UNexGxgcJFITOz2pREH3UkUPZfh oJpuTOeunR7A2SvbyK9KVJIR67O3qwsYxNFoTftB4gtoJX2VY/2Te5Nxvjj4UvUHJudm ihyTYLej011fFBe4sxIO500OzPBNMzGtW6mhsVoxd98ucxbhbIQeBuW4vWNCgJjU9DDb fLJw== X-Gm-Message-State: AOJu0YxWCqZ6n512wriAnBReL5kAlJ+2kOqzAPtSb8Pc7Z8WS95yg62J I5Qxn7cKms/icUjIyw/9FXzTpNC3d/+BBW6rGH3gp1IA/EOAesyZF9chl6leEWnv+tcNoNcydHD y X-Received: by 2002:a5d:5511:0:b0:34d:74cb:c0be with SMTP id b17-20020a5d5511000000b0034d74cbc0bemr6789600wrv.35.1714999213228; Mon, 06 May 2024 05:40:13 -0700 (PDT) Received: from m1x-phil.lan ([176.187.211.4]) by smtp.gmail.com with ESMTPSA id d18-20020adfef92000000b0034c71090653sm10579327wro.57.2024.05.06.05.40.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 06 May 2024 05:40:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Stefano Stabellini , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PULL 24/28] xen: mapcache: Break out xen_invalidate_map_cache_single() Date: Mon, 6 May 2024 14:37:24 +0200 Message-ID: <20240506123728.65278-25-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240506123728.65278-1-philmd@linaro.org> References: <20240506123728.65278-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: "Edgar E. Iglesias" Break out xen_invalidate_map_cache_single(). No functional changes. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240430164939.925307-10-edgar.iglesias@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/xen/xen-mapcache.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c index 3e6a1a0a93..c8a0f4fbc2 100644 --- a/hw/xen/xen-mapcache.c +++ b/hw/xen/xen-mapcache.c @@ -513,17 +513,14 @@ void coroutine_mixed_fn xen_invalidate_map_cache_entry(uint8_t *buffer) } } -void xen_invalidate_map_cache(void) +static void xen_invalidate_map_cache_single(MapCache *mc) { unsigned long i; MapCacheRev *reventry; - /* Flush pending AIO before destroying the mapcache */ - bdrv_drain_all(); + mapcache_lock(mc); - mapcache_lock(mapcache); - - QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) { + QTAILQ_FOREACH(reventry, &mc->locked_entries, next) { if (!reventry->dma) { continue; } @@ -531,8 +528,8 @@ void xen_invalidate_map_cache(void) reventry->vaddr_req); } - for (i = 0; i < mapcache->nr_buckets; i++) { - MapCacheEntry *entry = &mapcache->entry[i]; + for (i = 0; i < mc->nr_buckets; i++) { + MapCacheEntry *entry = &mc->entry[i]; if (entry->vaddr_base == NULL) { continue; @@ -553,9 +550,17 @@ void xen_invalidate_map_cache(void) entry->valid_mapping = NULL; } - mapcache->last_entry = NULL; + mc->last_entry = NULL; - mapcache_unlock(mapcache); + mapcache_unlock(mc); +} + +void xen_invalidate_map_cache(void) +{ + /* Flush pending AIO before destroying the mapcache */ + bdrv_drain_all(); + + xen_invalidate_map_cache_single(mapcache); } static uint8_t *xen_replace_cache_entry_unlocked(MapCache *mc,