Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1437664

Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer

From "Wangnan (F)" <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer
Date 2016-07-06 14:10 +0200
Message-ID <rRTOp-Bq-1@gated-at.bofh.it> (permalink)
References <rR5yh-2a2-3@gated-at.bofh.it> <rR5yh-2a2-9@gated-at.bofh.it> <rRTlo-bj-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 2016/7/6 19:38, Jiri Olsa wrote:
> On Mon, Jul 04, 2016 at 06:20:06AM +0000, Wang Nan wrote:
>
> SNIP
>
>> +static void
>> +record__toggle_overwrite_evsels(struct record *rec,
>> +				enum overwrite_evt_state state)
>> +{
>> +	struct perf_evlist *evlist = rec->overwrite_evlist;
>> +	enum overwrite_evt_state old_state = rec->overwrite_evt_state;
>> +	enum action {
>> +		NONE,
>> +		PAUSE,
>> +		RESUME,
>> +	} action = NONE;
>> +
>> +	switch (old_state) {
>> +	case OVERWRITE_EVT_RUNNING: {
>> +		switch (state) {
>> +		case OVERWRITE_EVT_DATA_PENDING:
>> +			action = PAUSE;
>> +			break;
>> +		case OVERWRITE_EVT_RUNNING:
>> +		case OVERWRITE_EVT_EMPTY:
>> +		default:
>> +			goto state_err;
>> +		}
>> +		break;
>> +	}
>> +	case OVERWRITE_EVT_DATA_PENDING: {
>> +		switch (state) {
>> +		case OVERWRITE_EVT_EMPTY:
>> +			break;
>> +		case OVERWRITE_EVT_RUNNING:
>> +		case OVERWRITE_EVT_DATA_PENDING:
>> +		default:
>> +			goto state_err;
>> +		}
>> +		break;
>> +	}
>> +	case OVERWRITE_EVT_EMPTY: {
>> +		switch (state) {
>> +		case OVERWRITE_EVT_RUNNING:
>> +			action = RESUME;
>> +			break;
>> +		case OVERWRITE_EVT_EMPTY:
>> +		case OVERWRITE_EVT_DATA_PENDING:
>> +		default:
>> +			goto state_err;
>> +		}
>> +		break;
>> +	}
>> +	default:
>> +		WARN_ONCE(1, "Shouldn't get there\n");
>> +	}
>> +
>> +	rec->overwrite_evt_state = state;
>> +
>> +	if (!evlist)
>> +		return;
> I'd expect this check at the begining

I think even evlist is NULL the state changing is still required.
Actually, the state machine is independent with aux evlist. Even
we without overwritable evsels the state machine is still valid.
So let the state machine runs unconditionally.

> jirka

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v13 5/8] perf record: Read from overwritable ring buffer Wang Nan <wangnan0@huawei.com> - 2016-07-04 08:30 +0200
  Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer Jiri Olsa <jolsa@redhat.com> - 2016-07-06 13:40 +0200
  Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer Jiri Olsa <jolsa@redhat.com> - 2016-07-06 13:40 +0200
    Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer "Wangnan (F)" <wangnan0@huawei.com> - 2016-07-06 14:10 +0200
      Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer Jiri Olsa <jolsa@redhat.com> - 2016-07-06 14:40 +0200
        Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer "Wangnan (F)" <wangnan0@huawei.com> - 2016-07-07 07:10 +0200

csiph-web