Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2338826pxb; Thu, 11 Feb 2021 09:50:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0WlcrN7r5Y9zVs4tv41yXAZc6wHKBzuDneyW3rpBdr6mY4fnD4c0r7YJXkq+I9JyZYf1A X-Received: by 2002:a17:906:755:: with SMTP id z21mr9834030ejb.514.1613065815974; Thu, 11 Feb 2021 09:50:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613065815; cv=none; d=google.com; s=arc-20160816; b=kZtNyPANI2kPsKblLmfin79uAuRtL2br4xuMYs0Uk1Sk5okZAa2+rEJPPUvyJfFnpb BuBzmRLvnUsHHkqz6aEchBYdD2oTZe0MJyd8SdubFXLhqS6kUjZZuvVnuIjIXyW0k8tg fskiP5Pwrek+c41n9B8NKU4hZTyC9Y7Soq6iqF167IhI7EsV8nLbmEiRmb4fK0okf9jz NHoEDMYunDLfP0ksN/ECPxcTqpt1HmhfmhkzZ4caOUUSdB4/uhncPWGwM38Omhe9ygeK N4BEwcqAHOIXi9XXXZ8xIW7yXXcTSmR/KYjuQYZQU6Gv+rnUH2IDSD/lXPLlopWVs5ll kQ/Q== 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=RNEzzC/Q1zqVj5kngi1mYCrGmAfldTTUTISPqW7CKxU=; b=kOOChCa7GlaWByN+xJhOEW6vY/ZWoFqZRNgMbJ6/7nvFvffIjrVgwUcAiIj6Q8kk3C 1FNvb40FuhoY468CuQiZYxXa+jAoL1/7q9Mk+/5gwsHfWPuuibT3I0GRYTTBXQQkzqFD bONwvc+pJtcFtbuqnaWV88XLo8UAL3UM88JjYWsDuwu+GMjS5HiOT9f0Zwbio7IUWavQ l9X0OfCct2djHuO572aPrsqCT9FN0jGLZdYlpPu7jhp/cBA3Hu4CSy+5KDKnVEUaP1qU eYuk06gcO4AOW6CejXzvoJXwhtYzbIg6SEk3ygRgO3rIYBTU0rVcqgl3Pp1N2cR9gwaB FMoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rWWiaClV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si4111483edz.214.2021.02.11.09.49.51; Thu, 11 Feb 2021 09:50:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rWWiaClV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232635AbhBKRs3 (ORCPT + 99 others); Thu, 11 Feb 2021 12:48:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:43418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231311AbhBKRLe (ORCPT ); Thu, 11 Feb 2021 12:11:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9292164E87; Thu, 11 Feb 2021 17:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613063452; bh=ErLkorkez6UPatXvEwAqDcGbrjhv7rz60Ia1Tjb57mw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rWWiaClVrhP+gnom5QxULHjQagcNmC9qD/BvZB5QxNW+pUmyQWLhJpxNKG7p+VHKK ighMK4dj4TbxUnY31Fh2HFGvCI3oQxLMIauK1wuUbzVdfRrhpMDtRpiJX/wN26SSGo PDcAcK1OBocQJydRF/ctU3OiUZB40eg7cYHPhy5XlvMUvPShqqappc7R6xnI2FgFbR ampDV+0SS1BZpc0GKvbgLCdvfDK1kxLS8eyVqqJIviVaRN3b5jnLKndBVZITeH10UX JSgur5AyZzIZSidfmiR/7ieWqLNUMonAKzSSCZw4yN85/hF8lJuC9xMI9IU95iAW/7 C8Z1rFVEAuvlg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E0E3B40513; Thu, 11 Feb 2021 14:10:48 -0300 (-03) Date: Thu, 11 Feb 2021 14:10:48 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Namhyung Kim , Jiri Olsa , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Michael Petlan , Ian Rogers , Alexei Budankov Subject: Re: [PATCH 06/24] perf daemon: Add config file support Message-ID: <20210211171048.GF1131885@kernel.org> References: <20210208200908.1019149-1-jolsa@kernel.org> <20210208200908.1019149-7-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Feb 11, 2021 at 05:45:38PM +0100, Jiri Olsa escreveu: > On Thu, Feb 11, 2021 at 03:01:12PM +0900, Namhyung Kim wrote: > > Hi Jiri, > > > > On Tue, Feb 9, 2021 at 5:09 AM Jiri Olsa wrote: > > > +static int daemon__reconfig(struct daemon *daemon) > > > +{ > > > + struct daemon_session *session, *n; > > > + > > > + list_for_each_entry_safe(session, n, &daemon->sessions, list) { > > > + /* No change. */ > > > + if (session->state == OK) > > > + continue; > > > + > > > + /* Remove session. */ > > > + if (session->state == KILL) { > > > + if (session->pid > 0) { > > > + daemon_session__kill(session); > > > + pr_info("reconfig: session '%s' killed\n", session->name); > > > + } > > > + daemon_session__remove(session); > > > + continue; > > > + } > > > + > > > + /* Reconfig session. */ > > > + if (session->pid > 0) { > > > + daemon_session__kill(session); > > > + pr_info("reconfig: session '%s' killed\n", session->name); > > > + } > > > + if (daemon_session__run(session, daemon)) > > > + return -1; > > > > Shouldn't it be 'continue'? If there's a problematic session > > it'll prevent others from being processed. And it seems this > > code will try to run it again and again. Maybe we can put it > > in the KILL state (or a new FAILED state) IMHO. > > so if there is misconfigured session, it will get executed, > and then we catch that it exited, like: > > # ./perf daemon start -f > [2021-02-11 17:38:19.718166] daemon started (pid 1167439) > [2021-02-11 17:38:19.719757] reconfig: ruining session [cycles:1167440]: abc -m 10M -e cycles --overwrite --switch-output -a > [2021-02-11 17:38:19.720861] reconfig: ruining session [sched:1167441]: -m 20M -e sched:* --overwrite --switch-output -a > [2021-02-11 17:38:21.132511] session 'cycles' exited, status=255 > > session will be removed > > when the config is fixed and updated, daemon will pick it up: > > [2021-02-11 17:42:59.241140] reconfig: ruining session [cycles:1167642]: -m 10M -e cycles --overwrite --switch-output -a > > > daemon_session__run fails only there's no memory for allocation, > if mkdir fails (for other error than EEXIST) and if fork fails, > so pretty serious errors, where we want to bail out anyway I know you love documentation, that is why I think that it would be a good idea to have these questions and answers in a FAQ for 'perf daemon', don't you think? ;-) - Arnaldo