Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2522657pxb; Thu, 11 Feb 2021 14:54:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSMNasDBy2kxsoLQYoUM5ZWDM4/Of3dtfkEeqPi6BRA3B5Ts+uGEo9W2czIQaiqf9QU1Fa X-Received: by 2002:a17:906:798:: with SMTP id l24mr6460ejc.92.1613084095909; Thu, 11 Feb 2021 14:54:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613084095; cv=none; d=google.com; s=arc-20160816; b=NnbdeqNHjkAsrUK9GMvDf6pLqBoZTH88TdcgBFik5n9PSgZUX441dZ9FjUCngAj7TJ j3LQTovPpGH9iGrlsjqQQF+rS3jm5sqjiCL5KZyunLlsQ+i4mowgESAkwVNIFRriXetr 6GqWZc6EEVsbI0lNSJcuuw2xHm9oU8c3aii3Kinb/iwdBGz5Df9EKCxUh7MdwEucAtKX UdTMBdHkYPckNO7G0hR7my0GSpqE29rr2cNZ6gnOUBAMm9ih4VK0z1ODAhE4saEAZ5Iz BJygaj/TdofiMWnI2Cb7DIHSlgXOHn9bHeSL6dPr8s3pcWvkmxcIfw75d7FPlttuGbE2 /saA== 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=5D7tx96hW8+iSr7h+SWJ+R1lPALPC4lcJQq6hJqdBtk=; b=KhbbDcRiw1GvRY9taw03uEjYZf0+kVG72zUMR3NfPuZno3Qo1jUmri5KKijXL2XBui SstlphJgNpt+4mvRD3c1ieexzJd8T7HW9v2BsgQZLvhHIwPb9feDiDBjRVDJcMUHfUnu eurF9LAPtVjJrgZt+VyJCzBLClxPR47Oa3gQcxtUM5pMw/aHCAQVah10w1/6GkL5FWAC /2ZW9NGtlTScqLfD4o//F4KnDS0iqiuTt7WR3B3pWzwUME+1GFN0aeTMb8MBpp/ZJv6v XLM6T+ij7g9kCnql16BvjriQYwUQ0SP4TDsmmZS3bbUth/XL0MRboOX5v7eTdV3UmYfW qK6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D860JI0X; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si5631275edl.186.2021.02.11.14.54.32; Thu, 11 Feb 2021 14:54:55 -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=@redhat.com header.s=mimecast20190719 header.b=D860JI0X; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229871AbhBKWxg (ORCPT + 99 others); Thu, 11 Feb 2021 17:53:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59889 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbhBKWxf (ORCPT ); Thu, 11 Feb 2021 17:53:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613083929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5D7tx96hW8+iSr7h+SWJ+R1lPALPC4lcJQq6hJqdBtk=; b=D860JI0X/iFRXKJERUjm6HMJ2TV3LM6ZbT55eql1GR1Lp0nOcqweJGfcuNY0W93tVULMA2 cdjQVzBUa3SHAPu/+w9sdE/CL1LlgntmA0kEuHMzjRfdsXnx73NVmnppEubY++u5zWDqxn kxI+rvOfnersDoAiemOWWZPuM8SOpr8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-OuLTCceuNxe7Tg90bgHOtA-1; Thu, 11 Feb 2021 17:52:07 -0500 X-MC-Unique: OuLTCceuNxe7Tg90bgHOtA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F6D9107ACE8; Thu, 11 Feb 2021 22:52:05 +0000 (UTC) Received: from krava (unknown [10.40.192.118]) by smtp.corp.redhat.com (Postfix) with SMTP id 33FB55D764; Thu, 11 Feb 2021 22:52:03 +0000 (UTC) Date: Thu, 11 Feb 2021 23:52:02 +0100 From: Jiri Olsa To: Arnaldo Carvalho de Melo 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: References: <20210208200908.1019149-1-jolsa@kernel.org> <20210208200908.1019149-7-jolsa@kernel.org> <20210211171048.GF1131885@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210211171048.GF1131885@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 11, 2021 at 02:10:48PM -0300, Arnaldo Carvalho de Melo wrote: > 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? ;-) heh, sure.. I can add something like that as section to perf-daemon man page jirka