Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1460636rwi; Thu, 3 Nov 2022 05:41:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ABuBkYIinKbcee3SxyhHqPr6i8Kc3scEmM108quPETHCGZXbd2LwA6Km5/KMnHjNpz0T8 X-Received: by 2002:a17:902:d50d:b0:187:2cd8:3de with SMTP id b13-20020a170902d50d00b001872cd803demr17092576plg.67.1667479275991; Thu, 03 Nov 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667479275; cv=none; d=google.com; s=arc-20160816; b=DWgPvbI6trwkDFdJCwjWP9f/WRplIVfY/D60ox/JkrGH55M7Uodz6/svSpSp97uVYv GYu6Z/tCG1opquiUnimfCV062SVx/ZZ+Itq6hKM1XrRR3bwJwFF98RBGBLioTMc6CMHY Qp8RpuxPfu+9f46rgKZSuTaTBRRtSfZ0hmR72YSwr/QM0yvAWT619f0KJsDlFgA2varI cBFgviFIG20U3suvK5dBscCtCyPmTDq3md29fhg53b3c4GcKSGYBHqy8pISBm3ozOQkh DtsENQBgunvBAPydC5foyzt6dZLfJuB493bwOuT3RhjsVWkUtaluJfNvmZeDVGaZlS4Z 3qFg== 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=c5YMV9yUNvIid7Fs8dSYFPL0djGzo2bChVrVUTEnC/4=; b=0B27OnSF/fINmCsAzzO6KgB/Gq8dfaZ8uADk/zKBbSv9A3FCqHaKrkuR2gEoIFw+kp G5EwO9KBVIx+jHGnWnduS4hMxUoFAvKG4DCf6qQ34d/FeBg9ahyW5udqaKnOZUe5KDpC pARflMjv7N969Fn9WIAt0Ob2emE1ReeHQ1aOvlK3y/gltNRWlE56bsUDbai7nFcVZbVC yeFAQovGvyVkpKi7lXBy7rUmRE1RXrNLw+kYk5WCY1Z/AOKCYrTheqHS64ULS0wRdi6l JUKMhFGJpphFvegJhAqG5eAMA8lKQFH1l96JdEvfeuJ8hVK7keI4FFkfFJC6Zk/ThS3I 7zrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=TaQlsQou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a17090301c600b001868431ecdbsi718987plh.20.2022.11.03.05.41.02; Thu, 03 Nov 2022 05:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=TaQlsQou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231658AbiKCMdy (ORCPT + 97 others); Thu, 3 Nov 2022 08:33:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbiKCMdw (ORCPT ); Thu, 3 Nov 2022 08:33:52 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A81C64C4; Thu, 3 Nov 2022 05:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=c5YMV9yUNvIid7Fs8dSYFPL0djGzo2bChVrVUTEnC/4=; b=TaQlsQou6F9DUu+vSB9GMRqfQ7 b8Zsl9kuEiSltVX+qU9sJc3EYv0YN8JUTOn1EHkSXSu0XvtFN3Uaiw3umC1qzHCL40hupSMSzhey+ Dn7NRad7NQs+7J9fG7jyytdUjAPrbWZpPS5PAQghIQiilIOOYzVd29SH/i9K3HfKsF8IKXncdYoPD bnbqQ+nIPOZCslhIf1ZFMXTGx99qNreVpOq/J3CI3lOkQJP5ILV21VM60Ib+vYt6FWkDYNz2HKyiE q0G2IyTcRKaE8foUUQxxKWJVVZYn4aX2iR2YTRh6RFCNA9P4Xy1JpM6GkYzLyb7tMx3l91o5DIpgB mbIA8eVw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqZPW-008gCC-4Q; Thu, 03 Nov 2022 12:33:31 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1D33930012F; Thu, 3 Nov 2022 13:33:29 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F14E62011672D; Thu, 3 Nov 2022 13:33:28 +0100 (CET) Date: Thu, 3 Nov 2022 13:33:28 +0100 From: Peter Zijlstra To: Ravi Bangoria Cc: Naresh Kamboju , Arnaldo Carvalho de Melo , Borislav Petkov , Ingo Molnar , linux-perf-users@vger.kernel.org, open list , regressions@lists.linux.dev, lkft-triage@lists.linaro.org, Stephane Eranian , Sandipan Das Subject: Re: Perf: BUG: kernel NULL pointer dereference, address: 0000000000000198 Message-ID: References: <4429582f-155a-04d2-d139-a834bb325612@amd.com> <5bec4620-2e2b-abe0-1e82-528c084d4d16@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 03, 2022 at 05:15:30PM +0530, Ravi Bangoria wrote: > Sorry was distracted a bit. So, this seems to be happening because of > race between amd_pmu_enable_all() and perf event NMI. Something like: > > amd_pmu_enable_all() > { > if (!test_bit(idx, cpuc->active_mask)) > > --->/* perf NMI entry */ > ... > x86_pmu_stop() { > __clear_bit(hwc->idx, cpuc->active_mask); > cpuc->events[hwc->idx] = NULL; > } > ... > <---/* perf NMI exit */ > > amd_pmu_enable_event(cpuc->events[idx]); > } Hmm, do you have more information? Something like that would require calling amd_pmu_enable_all() while it is already active -- and that seems suspect at first glance. That is, you shouldn't be getting an NMI for @idx before amd_pmu_enable_event().