Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755803AbZCUXUb (ORCPT ); Sat, 21 Mar 2009 19:20:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753690AbZCUXUW (ORCPT ); Sat, 21 Mar 2009 19:20:22 -0400 Received: from bilbo.ozlabs.org ([203.10.76.25]:55514 "EHLO bilbo.ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752146AbZCUXUW (ORCPT ); Sat, 21 Mar 2009 19:20:22 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18885.29855.433194.463455@cargo.ozlabs.ibm.com> Date: Sun, 22 Mar 2009 10:13:35 +1100 From: Paul Mackerras To: Andrew Morton Cc: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] perfcounters: record time running and time enabled for each counter In-Reply-To: <20090321055252.eb0673ea.akpm@linux-foundation.org> References: <18884.55232.197620.696687@cargo.ozlabs.ibm.com> <20090321055252.eb0673ea.akpm@linux-foundation.org> X-Mailer: VM 8.0.9 under Emacs 22.2.1 (i486-pc-linux-gnu) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1590 Lines: 50 Andrew Morton writes: > Perhaps one of the reasons why this code is confusing is the blurring > between the "time" at which an event occured and the "time" between the > occurrence of two events. A weakness in English, I guess. Using the term > "interval" in the latter case will help a lot. Except that we aren't measuring an "interval", we're measuring the combined length of a whole series of intervals. What's a good word for that? > > + atomic64_t child_time_enabled; > > + atomic64_t child_time_running; > > These read like booleans, but why are they atomic64_t's? OK so this file could use more comments, but I did answer that question in the patch description. > > - return put_user(cntval, (u64 __user *) buf) ? -EFAULT : sizeof(cntval); > > + if (count != n * sizeof(u64)) > > + return -EINVAL; > > + > > + if (!access_ok(VERIFY_WRITE, buf, count)) > > + return -EFAULT; > > + > > > > Oh. > > It would be a lot more reassuring to verify `uptr', rather than `buf' here. > > The patch adds new trailing whitespace. checkpatch helps. > > > + for (i = 0; i < n; ++i) > > + if (__put_user(values[i], uptr + i)) > > + return -EFAULT; > > And here we iterate across `n', whereas we verified `count'. And the fact that we just verified count == n * 8, four lines above, doesn't give you any comfort? Paul. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/