Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1292440lql; Tue, 12 Mar 2024 12:39:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUp82FRkw9Atzcho0+uUsfCU+5au6ZIGlkccx9HuUUrcyKCLRzTSywY9NgB6m77t9fQsLVFj0oVddjv00VPl7120Euhz8LqCenvEpG5Lw== X-Google-Smtp-Source: AGHT+IFDhskXOtP8TReSwNmRTaz2PgadJKN24GJ3PWXXqsJ6EFxvFNUi3++KdKwZHZnEsNqTQXBl X-Received: by 2002:a17:906:a18f:b0:a46:2a2d:4554 with SMTP id s15-20020a170906a18f00b00a462a2d4554mr870396ejy.46.1710272372272; Tue, 12 Mar 2024 12:39:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710272372; cv=pass; d=google.com; s=arc-20160816; b=uGxdHmEVU7hJJv8cx34CwU1TOPEXJjHpJ3HdTPbNytcXogT2LGIt+37dok5TWg/iKv ddhPZ2bBDQvIHLukByX/P46SV07G5/qZw7vpUdiHYvArtPG9OuHpEhVmREXZ//vVFPek QDXMH6nRPkPwyRhfqVNaizZuFk+6MAAp5JZpzBjNJDjNsNvKpOA976WitlhcOJUX9v/X CJN7hQ+Uc3dcQYWhjlIxRW/htKxaHwRoyR9BPgKRIBPY4oHqfVnrqrMMptqh+6n95Ic7 6DKtnFDRKSXoAKZGk6Ixxdcs4DQ6WdzdRVcpqVAtQ56rKlHro9jFIR2m6iUoe0ilz34m lOEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:reply-to:dkim-signature; bh=PE0BxFsqijsc/DHiegQ2xZUP1/bLz9mg3FtR8FbWE88=; fh=Ue94Gx/x5VO/ML+csECGEzX47n0UAeusjd81A+hQb+o=; b=XAA+UhFjhbykE+IZnQO2EFSQq+JxhWnS+NKmYaXMty2gftyPxbVTFRTNIPnGxogZPb GXKlP8Uc/aQ2+Nzbh036tZhMI07wgP2DYklIJpLk+1egUB1jovwH2EsixhMOJ29LiMmO +XlKKA2pDgy31nz6DA6QztHjkTFv/Q7VQa5b1cCo/m4pzv4DdOgr8tCKUfGR+dAl/wju P1eDwqBV/lo4ItBKcKAwp2OpbOVtipFlAcywAiRj4BD0j6Wj0eI6J52yHc8H8pXUU6Um xpRd8RcICqBlOlf6P6OC1iiybnflPmUgT+srHCynsBcl8u001PuVdPvxeLofxq2pwoyv dEeA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rS2iNbWW; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-100715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100715-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id fi6-20020a170906da0600b00a45fbe278f4si3682149ejb.588.2024.03.12.12.39.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 12:39:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rS2iNbWW; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-100715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100715-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 041A11F23765 for ; Tue, 12 Mar 2024 19:39:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 751FC14263A; Tue, 12 Mar 2024 19:39:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rS2iNbWW" Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E54C7CF20 for ; Tue, 12 Mar 2024 19:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710272364; cv=none; b=BJ7v3QGGXb8tDD/fGlBJaO/31qvlqM2jAXdwSm16HxdWld4Lx3PJQY2UPAnK0MrxDc6UpiYgGzWDfs/V6pw/FB5rI44Pik3ZKidzJqYUMioabNUE9RO9zNlKZMCDtUF78/bQ3qOB58kxK68lqVNpl0X1WZvayY+sX0Brp33JvjY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710272364; c=relaxed/simple; bh=d/RZlh/p7Lw4UMD+yfh2uAYxD+niqCzu25XwxbYDRxM=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=XMqXDbUpKoD/d+g6vb0hvzRozXTbJs7sj6qRLnqZn5lYuLNQbbkb+LxyYhqzVYSB+AFZcMYxKSgbwuYxfL+xLGiF8Um2a+75KANSSBYLKIXF1n86b195ru6zde9UbZmGxpOPeresEV8EpaWSqtJAMnE3jvHzCewEh99RcFu2xqY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rS2iNbWW; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5cfc2041cdfso3528872a12.2 for ; Tue, 12 Mar 2024 12:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710272362; x=1710877162; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=PE0BxFsqijsc/DHiegQ2xZUP1/bLz9mg3FtR8FbWE88=; b=rS2iNbWWUB5iIS5vmLfYbH7UKHMJ7yP/jrXeaQHk8czSm5yHMnnr4Q6nP9UYQBBGmR m5FCBEvIiDcgeA3IeGDEjlg1ENIAy9ZIbkqg463yxCS7aszafwLHgLMiOBOeqkSbNduP rZO4S64DjewH89+yDHrTzKVbIkqU0Z0AzK0+9PPt+Xey0Nypc90oa8sVV4j1ENFz7DUe z5DF+DD0QC5410v8IPHEIsTrOOEwvpXHypSq5GZKz025ZfD/sTmrHPLk7X9zQJzi2jVh zVzmwel+FSnqDi5OqmpTv7pjsHja/w1HilhDjVMTbPknBZT3TgPrUqFSVnh6geEeXcwu fy+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710272362; x=1710877162; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PE0BxFsqijsc/DHiegQ2xZUP1/bLz9mg3FtR8FbWE88=; b=PsyuVaP5kComkr1ryks5V8XEeBa3PUCczyPojKjnVUbA8BUK4vBCM9IvWk5HUMS5pf fD1v7b9NevtRnnJ8NqXFTyzi7LqstEsJRSB7fkyQVMpPw5nIZe2eQnuoSgxFXoXA0lVn 92+fLEzg4A/Za6e1MIjTzuXHWNR8RYTQxiD3v99hfsM5aTAN8xN86g/p8RssXR/323EC WGda3N4kgkZHsaEPkVBS14ZAOgrFbIQlzGDf5RoduxDOewbq+D8rp1G+cX7SEa16jxAI HinShF02I+e1xN71OPMGzjqU/sVqDnb52UzfH1LSa3X3N/qHXClYxOFRz7T0G6jBfvSN ojbw== X-Forwarded-Encrypted: i=1; AJvYcCXt1sKq35X/fPKwDhjVS6hCWFNGMLKEJ92MIV4wE3vnNi6WLP+iifcLDQ0NvV8l3jCrOIKtcvjUJzpyupzHM4J0u7PxT+DJEg9Hevk1 X-Gm-Message-State: AOJu0YzdeQVqVhGfErBsy8csyhhNAd0UpCUt60uhVVoVTBOTciGwIcSR 39ncWOeXgud2hGS4LI2UoFgs7i7PqRPOwiT5fwoIJonKwo9eBX72Z7TEPMzzw7ASv1K8mNFtpCU vUw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a65:6252:0:b0:5ca:43c7:a67 with SMTP id q18-20020a656252000000b005ca43c70a67mr24921pgv.9.1710272362441; Tue, 12 Mar 2024 12:39:22 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 12 Mar 2024 12:39:09 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240312193911.1796717-1-seanjc@google.com> Subject: [PATCH v2 0/2] sched/core: Fix spinlocks vs. PREEMPT_DYNAMIC=y From: Sean Christopherson To: Jonathan Corbet , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Will Deacon Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Valentin Schneider , Marco Elver , Frederic Weisbecker , David Matlack , Friedrich Weber , Ankur Arora , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Fix a bug in dynamic preemption where the kernel will yield contended spinlocks (and rwlocks) even if the selected preemption model is "none" or "voluntary". I say "bug" because this divergence from PREEMPT_DYNAMIC=n behavior effectively broke existing KVM configurations, e.g. vCPUs would get stuck and become unresponsive for multiple seconds if there was heavy KSM or NUMA balancing activity in the host. This isn't super urgent, as 6.8 has a fix in KVM for the over-aggressive yielding (commit d02c357e5bfa ("KVM: x86/mmu: Retry fault before acquiring mmu_lock if mapping is changing"), but I wouldn't be surprised if the behavior is causing other performance issues/regressions that are less severe and/or less visible. v2: - Rebase onto Linus' tree to deal with the code movement to spinlock.h. - Opportunistically document the behavior. - Add the PREEMPT_AUTO folks to Cc to get their eyeballs/input. v1: https://lore.kernel.org/all/20240110214723.695930-1-seanjc@google.com Sean Christopherson (2): sched/core: Move preempt_model_*() helpers from sched.h to preempt.h sched/core: Drop spinlocks on contention iff kernel is preemptible .../admin-guide/kernel-parameters.txt | 4 +- include/linux/preempt.h | 41 +++++++++++++++++++ include/linux/sched.h | 41 ------------------- include/linux/spinlock.h | 14 +++---- 4 files changed, 50 insertions(+), 50 deletions(-) base-commit: b29f377119f68b942369a9366bdcb1fec82b2cda -- 2.44.0.278.ge034bb2e1d-goog