Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4022200rdh; Tue, 28 Nov 2023 09:40:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8u3mitgUCopxja0ENm7MWZaNIuWAdcut27RYadXt3LtHFC2mWQ2mZw9+3+q0NLQwW96lB X-Received: by 2002:a05:6808:1313:b0:3b8:63ff:7dc7 with SMTP id y19-20020a056808131300b003b863ff7dc7mr12582143oiv.36.1701193226111; Tue, 28 Nov 2023 09:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701193226; cv=none; d=google.com; s=arc-20160816; b=ab3c1XMeM8nZhAAH8GDND28jRo8Fe+SIu1/NtHBJ39rFDYLKfAZmEJTJJb8Ds5UMYn QrZiPcGbZ5jai0p/bqxV1SsfgtcuPRuBsVqqoFbcgMtn9reNo0BJY3rNMcnFMfGoaI4P STVgKJ10y9RK3xtggmnmdFT83yUF5hmqejkaBfKyzXQDAw6+nRZCfkiDbdrKewWul/N+ QzcSGHbUCZmXlXbIgUuUrr1ZOIv4m1CX28xh6EPyh+3vgMREKbtGqX/ox6N8khHH6Fzi 1tBjjy6vDn/laq/thfxrXrKG6XZgTX+rctTEdbyV15iwWugnHggn38FIg0j+FogVg2aC 2+aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DEMb8ThSjJLXq3kPnCubCYIoftk/4Jx+HHM9AaBXX0U=; fh=FUiV7WDh+1+3MTW0HCeT4h/kK7i79xvAn8azjWNvGZY=; b=ZKu923COzyV02n/VBh1BvxDd7cIeI3Xsr4jVoPT4WpVugWQagyzxCRmvvgfyatMm1m VIdc4IAwdfk9BXh2GWBdkez9mD2DRT1v9fyRg/gNXCio1LcbucQGr6xLXtOpVdaCYOVf FEOlENwib/EfkVKzPYsVCKPTJOzM2fFe/dwORPn5xlzWDgmNaA8UPnV/L8/k71AfNyRy ybAwMle0UwIhBtf9ODPvkCMRByfkumbCMt9hkpkcV3mW9a8ifbllbC3AxcrkxFcrYXTP cpNKPjgIWIQPadIqZvvyXHCwAtTJBXnXVwOTuihum00jn04VWMRrXqybC0GDGwnN47St /qnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QeQSHW8i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id 23-20020a630c57000000b005ab7b51ab6csi12602808pgm.515.2023.11.28.09.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 09:40:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QeQSHW8i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id BF2F280A7F0A; Tue, 28 Nov 2023 09:40:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344975AbjK1RkH (ORCPT + 99 others); Tue, 28 Nov 2023 12:40:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345135AbjK1RkH (ORCPT ); Tue, 28 Nov 2023 12:40:07 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694C5D64; Tue, 28 Nov 2023 09:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701193213; x=1732729213; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=nwg4S88oJ6FyLcG9HKMCl3XnJS49yk8sadUfeEszzH0=; b=QeQSHW8iSF0MUK2oRFEUw/aj4F3sMBxQRUPD89Da7k5H8/pr7O4XuUmZ v7gwu70HeIPMWDvGje+rmGtgnSj0DuOucuIO+2g55WudAeWB6CLn++5LJ sESWp+qTce1RCYGnt7FsIL7R/SzotY2gLRxJAWV1Unrx8WIPZeoXbo6sj xscEbqGUbxgNh367Uy02yqJkkD3MRlEAkvNAMT+oh3Fq7/n3G+m+wZgIL OXfxIvIQhz6Gg8UxeK82ozsP8Li+GgA5zeTXyy23my7ySD/BuT/eGJ8RR +sx6Yrp+H41kBbQDIPst6EU4b/mvBqL48YQ0WlmBNRWBwxFXg/kVwCETz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10908"; a="372350016" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="372350016" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 09:40:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10908"; a="797647899" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="797647899" Received: from agluck-desk3.sc.intel.com (HELO agluck-desk3) ([172.25.222.74]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 09:40:12 -0800 Date: Tue, 28 Nov 2023 09:40:11 -0800 From: Tony Luck To: Dan Carpenter , Tom Lendacky Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [bug report] x86/split_lock: Make life miserable for split lockers Message-ID: References: <6bc08e77-812f-4e9e-938a-6a13263ce9d1@moroto.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6bc08e77-812f-4e9e-938a-6a13263ce9d1@moroto.mountain> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 09:40:23 -0800 (PST) On Tue, Nov 28, 2023 at 04:12:24PM +0300, Dan Carpenter wrote: > Hello Tony Luck, > > The patch b041b525dab9: "x86/split_lock: Make life miserable for > split lockers" from Mar 10, 2022 (linux-next), leads to the following > Smatch static checker warning: > > arch/x86/kernel/cpu/intel.c:1179 split_lock_warn() > warn: sleeping in atomic context > > arch/x86/kernel/cpu/intel.c > 1158 static void split_lock_warn(unsigned long ip) > 1159 { > 1160 struct delayed_work *work; > 1161 int cpu; > 1162 > 1163 if (!current->reported_split_lock) > 1164 pr_warn_ratelimited("#AC: %s/%d took a split_lock trap at address: 0x%lx\n", > 1165 current->comm, current->pid, ip); > 1166 current->reported_split_lock = 1; > 1167 > 1168 if (sysctl_sld_mitigate) { > 1169 /* > 1170 * misery factor #1: > 1171 * sleep 10ms before trying to execute split lock. > 1172 */ > 1173 if (msleep_interruptible(10) > 0) > 1174 return; > 1175 /* > 1176 * Misery factor #2: > 1177 * only allow one buslocked disabled core at a time. > 1178 */ > --> 1179 if (down_interruptible(&buslock_sem) == -EINTR) > 1180 return; > 1181 work = &sl_reenable_unlock; > 1182 } else { > 1183 work = &sl_reenable; > 1184 } > 1185 > 1186 cpu = get_cpu(); > 1187 schedule_delayed_work_on(cpu, work, 2); > 1188 > 1189 /* Disable split lock detection on this CPU to make progress */ > 1190 sld_update_msr(false); > 1191 put_cpu(); > 1192 } > > The call tree is: > > kernel_exc_vmm_communication() <- disables preempt > -> vc_raw_handle_exception() > -> vc_forward_exception() > -> exc_alignment_check() > -> __exc_alignment_check() > -> handle_user_split_lock() > -> split_lock_warn() > > I think maybe the mismatch is that kernel_exc_vmm_communication() calls > irqentry_nmi_enter(regs); which disable preemption but exc_alignment_check() > does local_irq_enable() which doesn't enable it. I think we need some arch/x86/kernel/sev.c expertise to explain the preemption requirements in that stack trace. Adding Tom Lendacky. > Also why does arch/x86 not have a dedicated mailing list? Good question. X86 was once the default architecture. So everything went to linux-kernel@vger.kernel.org. I'll add that to Cc: for this. But maybe it's time for an x86 specific list? > regards, > dan carpenter -Tony