Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp913984lqb; Fri, 15 Mar 2024 09:42:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJdMpS1IH1/oKGDdLHMQEXTnO7w/LSluAQQdTTjZR3spr9QluOk8fHsBth4f0wa0UvFzULfUNdM35BsARw+lsVQSzAaXXzHSdVZyp5IQ== X-Google-Smtp-Source: AGHT+IEROOSSm88O8dEU+9mRfp6oBhkhqRGtUm5oOlVDNXFPFGx+qzhra74eA5TRdpCJN7J9m1OA X-Received: by 2002:a05:6102:3129:b0:476:6097:ae8b with SMTP id f9-20020a056102312900b004766097ae8bmr2607075vsh.2.1710520953319; Fri, 15 Mar 2024 09:42:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710520953; cv=pass; d=google.com; s=arc-20160816; b=ry0GVdqQCZIl7Lum8CcpampRQF1WIaWXw7zt4DmjB+WaUCWwnDK+0B2FNHwfIXB0/p bHxUUfVH7jXE23zwBpX9eyzzje+Su/qisJlxvdCebzr79AXbHVSM/mQy+4piNhvRK7i0 EoA8rRjgl7DCvAq9VFb25khxM9/Lk4n8o2N9nOlTghdWYxYnqqscGYqqowtgaBcwhcmM VxqOIJeLIMjB8Onx4Exqm9eIaApJqNYdIGFV8sPHHGX2wFqinU8/KfrdhmRiGuC8DZiK H7J7cQupCa78U17OrnT+HdYDLCojTD4Qp6/3qhyLejCgSQ07HuNGaKARcS2utO9LII4J TtuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=am/PWCEeHNB3+7UJCgYcRSSjRqhgq8ufptHRIWrU5Kw=; fh=XM0h+BhTuNg63JcQThGO4tBxQ3pJZI6rZmDWKtbl6+Q=; b=D1Ilxpttkw25ontGO+DvEORq/i0YDiH/45DPOev24hIlJpP83L4VV8wY0FudU7sWS4 iKYGJ3T91MBwPczJXK9pFs/EAGWAgCgkjM9eantVGL1UPT5oA1JIQeZuG8RooAUwswmQ LMGQ+90gzjPp/l2W5BCg+NG3LZ7XSIuWd5ED4vXU8mOFoHzyDq0hBOrkcsRRKH6dqzRa rkZhN6oAhHi0ZrGMsrXynbWjTrqW5mLYygOsGTFDKha/WgqsHoCqgFEUkklmRehFVO8Z dYvGcViRt0VWo/g7qhrJuA7tMAJBPOYVFkJflfD28bYe5ifrr6omuT9Vjf0XC6KcRY/L vLuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=hot1eDZm; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-104633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104633-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e12-20020a0562141d0c00b0068f1387c655si3257223qvd.187.2024.03.15.09.42.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 09:42:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=hot1eDZm; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-104633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104633-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0F0791C21701 for ; Fri, 15 Mar 2024 16:42:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 031593C680; Fri, 15 Mar 2024 16:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hot1eDZm" Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 1281F2208A for ; Fri, 15 Mar 2024 16:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710520946; cv=none; b=MuKwXMAW1hR6vwKGJl+at9RX4FVbgnDBgO7enAAMGx78eAcyEGDndubM7sPHSxqJJCmrEVT2NvOEebtRjGXmhvoRmTEaBYDb3p9uqZXQEyobIKqvtSXd6aCkJ9+yA1/aOhqOgbYDlw0YEPRUveAWjh+HFhmYd2tre6rxuNUcHMY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710520946; c=relaxed/simple; bh=hIwLeauctgBMp7l98Z9Pbwy1HUT5HKtfynYgMSjBHg0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=u6HSA3GtZuAH9UccTJtg6clUSWscUkNz4sQLAmJH7EYvl5Bo9asl9/AP+tyVPoCeN4mjyvcXAIyyiBqIcJYa1rGG3wGLfHQZDNJ/nyCQOwyVszrlSJcc4i1Y8c0voz8nwQEOjVTbBNNojozzL0Q/xG69vKUN+6s+VyTfOwXdZy4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hot1eDZm; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a466fc8fcccso265688866b.1 for ; Fri, 15 Mar 2024 09:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1710520942; x=1711125742; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=am/PWCEeHNB3+7UJCgYcRSSjRqhgq8ufptHRIWrU5Kw=; b=hot1eDZm7ba76H0z6cOyp9dL6RNJBuOT9lv/Ffziji28AqOAjsrOAnsqUkN1ratakk HxjvZWdUtxTeyICmncBaKSVYm+cS4omySbTo7afLezo6sBTVnQ/WnjnCr6u9G3GYCn6D y6JaWwSB4/jUJBbJhqSpXqMzI7VyVbqxtsKPw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710520942; x=1711125742; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=am/PWCEeHNB3+7UJCgYcRSSjRqhgq8ufptHRIWrU5Kw=; b=r6bEQMrKIBkNAlirDrhCG28fJ6jqVDTadHNkJyRYJdiknNBZW2m7boyur5o9R2Xciq krHColnRwOfeLtkO5l0zrPKtMgykAEp6NEQBVPY8TUwR0ysqML88nD7Y0VKTb6OjLaMJ fpAqg/vGe4IASYufzeOb+56E/AfR02U6YavhXexjEp4hNZ3Lz5pCqanFiTMt4amijg7r 4KURAzOA98MxfMG18/N5EBzD0k2EyuM30L3HkOHPw2sELWFBhrmVPJIKLGRQ6Zr1QKok f/qMHb53IIh2TniAx2l1tECvJ1pb1Aw8hM5QeCYxh4nSdqbWePxcuXdEtS+7VAtjb0qJ qZgA== X-Forwarded-Encrypted: i=1; AJvYcCVHl1PMHRASEpZVqfvs94tS93vYqBc0SLkIgqbnus2Ju2t1/YjOXnqqaHfKSWx7VQrOamHruROUP9rgV0la+shtjrnksrJk6A9aK1zE X-Gm-Message-State: AOJu0YwjwVlckiMzLbWAW0DrUFyVhndxyQh1wWZO8D2+Bm7nsMf9hN1A KQnD9nQp041G7yluCQby6Mweae+u69aVlBQ2WKkdgBVps1HSNU+8QYfUtWLcWJgtOSxhUpI3EI+ d1s8= X-Received: by 2002:a17:906:561a:b0:a45:ac83:8743 with SMTP id f26-20020a170906561a00b00a45ac838743mr3267497ejq.33.1710520942035; Fri, 15 Mar 2024 09:42:22 -0700 (PDT) Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com. [209.85.218.50]) by smtp.gmail.com with ESMTPSA id ws4-20020a170907704400b00a468c11b8eesm577541ejb.30.2024.03.15.09.42.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Mar 2024 09:42:21 -0700 (PDT) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a3fb8b0b7acso250174166b.2 for ; Fri, 15 Mar 2024 09:42:21 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCU3aIx7xVXXQ4vNULfD9MsVBXwn2Nr+ICE5m5CWvnMUH7B7+cG23JX1QtFa7uPYTdd1sv5R67O2MQs54UuWJ1yQ2YTpyt5GUvX7IJ10 X-Received: by 2002:a17:906:bfc8:b0:a45:5be1:6e20 with SMTP id us8-20020a170906bfc800b00a455be16e20mr3108974ejb.23.1710520940765; Fri, 15 Mar 2024 09:42:20 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240303235029.555787150@linutronix.de> <20240304005104.622511517@linutronix.de> In-Reply-To: From: Linus Torvalds Date: Fri, 15 Mar 2024 09:42:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 5/9] x86: Cure per CPU madness on UP To: Guenter Roeck Cc: Thomas Gleixner , LKML , x86@kernel.org, Uros Bizjak , linux-sparse@vger.kernel.org, lkp@intel.com, oe-kbuild-all@lists.linux.dev Content-Type: text/plain; charset="UTF-8" On Fri, 15 Mar 2024 at 09:17, Guenter Roeck wrote: > > [ 3.291087] RIP: 0010:rapl_cpu_online+0xf2/0x110 > [ 3.291087] Code: 05 ff 8e 07 03 40 42 0f 00 48 89 43 60 e8 56 5f 12 00 8b 15 b4 84 61 02 48 8b 05 01 8f 07 03 48 c7 83 90 00 00 00 e0 84 80 b6 <48> 89 9c d0 38 01 00 00 e9 2b ff ff ff b8 f4 ff ff ff e9 47 ff ff The code is mov %rax,0x60(%rbx) call 0x125f5f mov 0x26184b4(%rip),%edx mov 0x3078f01(%rip),%rax movq $0xffffffffb68084e0,0x90(%rbx) mov %rbx,0x138(%rax,%rdx,8) <-- trapping instruction jmp with %rdx being some index having the value 0xffffffed (-19). That's ENODEV. Without line numbers (if you have debug info for that kernel, it's good to run "scripts/decode_stacktrace.sh" on stack traces) it's hard to really know what's up, but I strongly suspect that it's this: rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu; because we have topology_logical_die_id(cpu) -> (cpu_data(cpu).topo.logical_die_id) and we have c->topo.logical_die_id = topology_get_logical_id(apicid, TOPO_DIE_DOMAIN); and topology_get_logical_id() does this: if (lvlid >= MAX_LOCAL_APIC) return -ERANGE; if (!test_bit(lvlid, apic_maps[at_level].map)) return -ENODEV; so that -ENODEV is not entirely unlikely for a UP run. This also explains why it *used* to work - that whole thing is new to the current merge window and came in through commit ca7e91776912 ("Merge tag 'x86-apic-2024-03-10' of ..."). Thomas, over to you. I wonder if maybe all those topology macros should just return 0 on an UP build, but that topology_get_logical_id() thing looks a bit wrong regardless. It really shouldn't depend on local apic data for configs that may not *have* a local apic. Linus