From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751694AbcG2EAk (ORCPT ); Fri, 29 Jul 2016 00:00:40 -0400 Received: from mail4.hitachi.co.jp ([133.145.228.5]:46981 "EHLO mail4.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750718AbcG2EAj (ORCPT ); Fri, 29 Jul 2016 00:00:39 -0400 From: "Tomoki Sekiyama" To: "'Masami Hiramatsu'" Cc: , , =?iso-2022-jp?B?GyRCPzlDKz8/PHdIfhsoQiAvIE1PUklUQU5JGyRCISQbKEJNQVNVTUk=?= , "Jiri Olsa" , "David Ahern" , "Namhyung Kim" , "Peter Zijlstra" References: <1469635660-29303-1-git-send-email-tomoki.sekiyama.qu@hitachi.com> <20160728084306.9b2ea62c38c34760bf86d6db@kernel.org> In-Reply-To: <20160728084306.9b2ea62c38c34760bf86d6db@kernel.org> Subject: RE: [PATCH v2] perf sched: fix wrong conversion of task state Date: Fri, 29 Jul 2016 13:00:34 +0900 Message-ID: <000001d1e94d$c24dfea0$46e9fbe0$@hitachi.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHR6CKydMrojwUW3kyRzCAe05pe0qAsWhkAgADZIAA= Content-Language: ja X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hiramatsu-san, On 2016/7/28, 2016 8:43, Masami Hiramatsu wrote: > Hmm, this includes several fixes and enhancements. > 1. Use first bit of the state instead of state itself (critical bug to avoid crash?) > 2. Check the range of the array and return '?' if out (minor bug, it can access data area) > 3. Fix TASK_STATE_TO_CHAR_STR to swap X and Z. > 4. Add new 'N+' to TASK_STATE_TO_CHAR_STR. (how about 'n'?) > 5. Treat a preempted task as THREAD_WAIT_CPU. > > so IMHO, it is better to split this patch into atleast 2, #1 and #2 (critical bugfix), > #3, #4, and #5 (minor update). This time I will fix only the invalid array access and adapting to the current kernel TASK_STATE, and leave the preempted task handling for later follow-up. [..] >> @@ -897,9 +898,10 @@ static int thread_atoms_insert(struct perf_sched *sched, struct thread *thread) >> + return bit < sizeof(str) - 1 ? str[bit] : '?'; > > You'd better use ARRAY_SIZE(str) instead of sizeof() for array here. OK, will change this to use ARRAY_SIZE on the next update. Thanks, Tomoki Sekiyama