Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1662680lqt; Wed, 20 Mar 2024 10:12:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUCGySdZ3wTAA/U2yGNGfR+bK58u5M+LV5Wy9s8AW+Z46W2irtSLXFMuG0db+IJ5HAFah7XuAUkreR2F1LLewa0zmOpWYZRcKEv0z5Itw== X-Google-Smtp-Source: AGHT+IGCTubzR3XyGWoV65XEuFafVmHFoOjhYvhtx+iNhA7KgLFmZz4Z3xVuxNIANs7/PgaVyDUN X-Received: by 2002:a05:6512:3134:b0:513:caf3:51b1 with SMTP id p20-20020a056512313400b00513caf351b1mr12842907lfd.0.1710954769679; Wed, 20 Mar 2024 10:12:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710954769; cv=pass; d=google.com; s=arc-20160816; b=lrKP1kG4XEgl0qGpuWTXNEGYv3f1s1fnHLcBdGCAT2sl0j/UgFqjfsZn+j9uO3Ib7U qOi5UOccsZ7d/pJl5UeuFhYi9H0FlIXCpYO+TLBgtoNEg+8M4edgXW6eNz1ztt7C3736 PjOVKKyYTRDjwyTU95YSZ4h//J1ZauhL5GXRzryAglAfwTN4G41DMLF0fDNrKLm/e1kD cCgOQBwYXx2WI44v9lOxfzgUWMlFDKk0vaEVqQ8tYIbaFggN4anKmtednvpKxc0wlPQc 824TI5gFroxIZvWZ+GQOmIFqWfNsUJDjZoLJRxoCXAVJY+IbfAjDSUXLK2xv90k4BOLO VFnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=vtlXaUKV8MbYVPM6yTjo6nLU+yu9LOmZyKXE7JEylEs=; fh=MRj/5EZuwI1dKMCo8SGPiyXDetpuzrox/A7KuG3HsQA=; b=mJR3EbATEmsQ0IGjJT4V9s4ti4/U3cd2QFZQzdiWixUd53InZ+21ampBkDkusBmU+h bvl0aA21+4RIVQMd4UUsLclROhUPaSqMSJ5KwQlxRYSk455tgLwXyK46nPcs9KBPC/HS LhJIKnxV9O7lrersIaEPTclYsWrrgR0HwaRS2bdtJFEiyenGWYlgOoTSBliJ1XOcqKtU edhJBc7qe5ByvscwYitseQc/DU2cUGJOeUfHyyTnbVGGclVoQyz0a0ECiqEUuZi2cIfp pqxxnOOVQMR+pUD90I3Z/Beu32xV8dNbP6aIauxxBwM4kAMODWJjUIPNCPGOkvQM5pe2 Ztjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tx1+fgFN; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-109211-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109211-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bw9-20020a170906c1c900b00a4657cc568asi6355778ejb.505.2024.03.20.10.12.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 10:12:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109211-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=@intel.com header.s=Intel header.b=Tx1+fgFN; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-109211-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109211-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 4F8881F22FF2 for ; Wed, 20 Mar 2024 17:12:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 956826A02A; Wed, 20 Mar 2024 17:12:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Tx1+fgFN" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42F3E3EA64; Wed, 20 Mar 2024 17:12:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954757; cv=none; b=Q84u9FGQIohNLhMUV9M4McVfKJQaYgBWPPm32b0uhCYKDGYrjRGvFkQSqLWLYXWjiWLTRTgIJ36hP/M3AFv0du9hP8dfntbDrLvw/YWXFv11d6BRGHaRmByiJj3C475Lqx4AXMmgF3Vrb9GZj6xa+ezyqP64am6289jLrTVPZjQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954757; c=relaxed/simple; bh=NS4x9r2TFhkTcyObcZJpU6SIzpzXoCPOlYMJEotNZqs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sbfQ7PAMvFdUqww/OCYyVt1+JO7hOBKqUu1UOYCqing8e7wuZtxT0+I0UuAO8j69HSlNOSUwwrGxTL5I0q0fdv+8nf6b0OUD7nJOfRrrYLzXywBaHee4fszve9XE6I/3T6OYreHqhQYbZ9ztEYR72+6C+x1p1+JA3RyYqIJAvMw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Tx1+fgFN; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710954756; x=1742490756; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=NS4x9r2TFhkTcyObcZJpU6SIzpzXoCPOlYMJEotNZqs=; b=Tx1+fgFNloggEUmgCNmr2qexTAu0mEpUt6iVzvoD22npKi89lS3GRFZZ 2sM1h9233k6z8vrdt5yAQZPJ72yiImzI7g1LFmwa2+a/XZmSoEXiD5OFu ZBpMxrzwhqSS+UGiSgfz9WE57z7BhBofUC/dIUYeOzNhmc+EpThuz5kUf 6K5xU1P+2mCTj8MZYNMpHQwEvzrsMu8946rfb3R4nMDTdY7i0u/siKc/5 xKyfmsZMI8F3SjBxctu1sY04XVRrKo4jfSW62hfTLwrRGfJAYHBl+dYZD aM8NQpxOHxUHjiFXXyxjh37pc1hoAjtY9YScRCGBvurEzeIgIZ/VJHRPo w==; X-IronPort-AV: E=McAfee;i="6600,9927,11019"; a="5771437" X-IronPort-AV: E=Sophos;i="6.07,140,1708416000"; d="scan'208";a="5771437" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2024 10:12:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,140,1708416000"; d="scan'208";a="14618463" Received: from linux.intel.com ([10.54.29.200]) by orviesa007.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2024 10:12:35 -0700 Received: from [10.212.76.154] (kliang2-mobl1.ccr.corp.intel.com [10.212.76.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 477B9580E13; Wed, 20 Mar 2024 10:12:33 -0700 (PDT) Message-ID: Date: Wed, 20 Mar 2024 13:12:31 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 02/41] perf: Support guest enter/exit interfaces To: Raghavendra Rao Ananta , Xiong Zhang Cc: seanjc@google.com, pbonzini@redhat.com, peterz@infradead.org, mizhang@google.com, kan.liang@intel.com, zhenyuw@linux.intel.com, dapeng1.mi@linux.intel.com, jmattson@google.com, kvm@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, zhiyuan.lv@intel.com, eranian@google.com, irogers@google.com, samantha.alt@intel.com, like.xu.linux@gmail.com, chao.gao@intel.com References: <20240126085444.324918-1-xiong.y.zhang@linux.intel.com> <20240126085444.324918-3-xiong.y.zhang@linux.intel.com> Content-Language: en-US From: "Liang, Kan" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2024-03-20 12:40 p.m., Raghavendra Rao Ananta wrote: > Hi Kan, > >> >> +static void __perf_force_exclude_guest_pmu(struct perf_event_pmu_context *pmu_ctx, >> + struct perf_event *event) >> +{ >> + struct perf_event_context *ctx = pmu_ctx->ctx; >> + struct perf_event *sibling; >> + bool include_guest = false; >> + >> + event_sched_out(event, ctx); >> + if (!event->attr.exclude_guest) >> + include_guest = true; >> + for_each_sibling_event(sibling, event) { >> + event_sched_out(sibling, ctx); >> + if (!sibling->attr.exclude_guest) >> + include_guest = true; >> + } >> + if (include_guest) { >> + perf_event_set_state(event, PERF_EVENT_STATE_ERROR); >> + for_each_sibling_event(sibling, event) >> + perf_event_set_state(event, PERF_EVENT_STATE_ERROR); >> + } > Does the perf core revert the PERF_EVENT_STATE_ERROR state somewhere > from the perf_guest_exit() path, or is it expected to remain in this > state? > IIUC, in the perf_guest_exit() path, when we land into > merge_sched_in(), we never schedule the event back if event->state <= > PERF_EVENT_STATE_OFF. > The perf doesn't revert event with the ERROR STATE. A user asks to profile both guest and host, but the pass-through mode doesn't allow the profiling of the guest. So it has to error out and remain the ERROR STATE. Thanks, Kan