From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752033AbcFWRiv (ORCPT ); Thu, 23 Jun 2016 13:38:51 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:34454 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751628AbcFWRiu convert rfc822-to-8bit (ORCPT ); Thu, 23 Jun 2016 13:38:50 -0400 MIME-Version: 1.0 In-Reply-To: <28A97E4D-3B8D-4151-8F94-627629E89263@163.com> References: <1466659667-99144-1-git-send-email-wangnan0@huawei.com> <1466659667-99144-8-git-send-email-wangnan0@huawei.com> <28A97E4D-3B8D-4151-8F94-627629E89263@163.com> From: Nilay Vaish Date: Thu, 23 Jun 2016 12:38:09 -0500 Message-ID: Subject: Re: [PATCH v10 07/10] perf record: Read from overwritable ring buffer To: pi3orama Cc: Wang Nan , acme@kernel.org, Linux Kernel list , He Kuang , Arnaldo Carvalho de Melo , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , Zefan Li Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23 June 2016 at 09:31, pi3orama wrote: > > > 发自我的 iPhone > >> 在 2016年6月23日,下午10:27,Nilay Vaish 写道: >> >>> On 23 June 2016 at 00:27, Wang Nan wrote: >>> @@ -542,6 +568,79 @@ static struct perf_event_header finished_round_event = { >>> .type = PERF_RECORD_FINISHED_ROUND, >>> }; >>> >>> +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; >> >> >> Wang, thanks for making the changes I suggested. >> The patch overall looks fine to me. Just as a matter >> of style, I probably would not write case labels that >> do not have any statements associated with them. >> I'll let default take care of those labels. >> > > I don't like them either. > > You have to do this when you start working > on perf code. It turns on -Wall and -Werror, > without these case gcc will complain, > compiling will fail. > Oops! Did not realize that compiler would complain. I guess we have to leave them as they are. Patch is good to be committed. Thanks Nilay