From patchwork Mon Nov 20 11:38:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Gross X-Patchwork-Id: 13461095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58A66C197A0 for ; Mon, 20 Nov 2023 11:39:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.636630.992225 (Exim 4.92) (envelope-from ) id 1r52c5-0004FL-4t; Mon, 20 Nov 2023 11:38:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 636630.992225; Mon, 20 Nov 2023 11:38:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r52c5-0004FE-2J; Mon, 20 Nov 2023 11:38:49 +0000 Received: by outflank-mailman (input) for mailman id 636630; Mon, 20 Nov 2023 11:38:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r52c3-0004F8-MR for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 11:38:47 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5da66d84-8799-11ee-98df-6d05b1d4d9a1; Mon, 20 Nov 2023 12:38:46 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id ED66B2190B; Mon, 20 Nov 2023 11:38:45 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6F58413499; Mon, 20 Nov 2023 11:38:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5o/GGUVFW2WqPQAAMHmgww (envelope-from ); Mon, 20 Nov 2023 11:38:45 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5da66d84-8799-11ee-98df-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700480325; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NLwENRVTo357k+tumrzZ4ap5+XiZP8RkIEcBvoKnH9Y=; b=LejPns590LIlN0YhxaZ+zPC9xbLNuvEWDg4Iu1GJgQsVt6r3rl9oXRpEQ97pb8KiBKTMJR TzOlEQ+r6YZpEtX/jQoMJxClhc56yQOO/p9x/5G4KMJQIeL9Tn3qm6Fa3m5KxWKUxvC00Z E5TXq4zyJMjtu6BGls2MP0TT8+rB1ZU= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: javi.merino@cloud.com, Juergen Gross , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Paul Durrant , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Tamas K Lengyel , Lukasz Hawrylko , "Daniel P. Smith" , =?utf-8?q?Mateusz_M=C3=B3?= =?utf-8?q?wka?= Subject: [PATCH v3 00/13] xen/spinlock: make recursive spinlocks a dedicated type Date: Mon, 20 Nov 2023 12:38:29 +0100 Message-Id: <20231120113842.5897-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [0.70 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-0.999]; RCPT_COUNT_TWELVE(0.00)[18]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Instead of being able to use normal spinlocks as recursive ones, too, make recursive spinlocks a special lock type. This will make the spinlock structure smaller in production builds and add type-safety. This allows to increase the maximum number of physical cpus from 8191 to 65535 without increasing the size of the lock structure in production builds (the size of recursive spinlocks in debug builds will grow to 12 bytes due to that change). Changes in V2: - addressed comments by Jan Beulich - lots of additional cleanups - reorganized complete series Changes in V3: - addressed comments by Jan Beulich Juergen Gross (13): xen/spinlock: fix coding style issues xen/spinlock: reduce lock profile ifdefs xen/spinlock: make spinlock initializers more readable xen/spinlock: introduce new type for recursive spinlocks xen/spinlock: rename recursive lock functions xen/spinlock: add rspin_[un]lock_irq[save|restore]() xen/spinlock: make struct lock_profile rspinlock_t aware xen/spinlock: add explicit non-recursive locking functions xen/spinlock: add another function level xen/spinlock: add missing rspin_is_locked() and rspin_barrier() xen/spinlock: split recursive spinlocks from normal ones xen/spinlock: remove indirection through macros for spin_*() functions xen/spinlock: support higher number of cpus xen/arch/arm/domain.c | 4 +- xen/arch/arm/mm.c | 4 +- xen/arch/x86/domain.c | 20 +-- xen/arch/x86/include/asm/mm.h | 2 +- xen/arch/x86/mm.c | 12 +- xen/arch/x86/mm/mem_sharing.c | 16 +- xen/arch/x86/mm/mm-locks.h | 6 +- xen/arch/x86/mm/p2m-pod.c | 6 +- xen/arch/x86/mm/p2m.c | 4 +- xen/arch/x86/tboot.c | 4 +- xen/arch/x86/traps.c | 14 +- xen/common/domain.c | 6 +- xen/common/domctl.c | 4 +- xen/common/grant_table.c | 10 +- xen/common/ioreq.c | 54 +++---- xen/common/memory.c | 4 +- xen/common/numa.c | 4 +- xen/common/page_alloc.c | 30 ++-- xen/common/spinlock.c | 296 +++++++++++++++++++++++----------- xen/drivers/char/console.c | 48 ++---- xen/drivers/passthrough/pci.c | 8 +- xen/include/xen/console.h | 5 +- xen/include/xen/sched.h | 10 +- xen/include/xen/spinlock.h | 176 ++++++++++++-------- 24 files changed, 449 insertions(+), 298 deletions(-)