Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp847605pxb; Tue, 19 Oct 2021 14:26:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxowQaDPHHQEJjhmtHchiBD6uG1IhHIb6hufg++BZuPgdK6KLiUmGRgLVY90lsDNAQD2AwT X-Received: by 2002:a17:907:2bdf:: with SMTP id gv31mr40094508ejc.521.1634678811417; Tue, 19 Oct 2021 14:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634678811; cv=none; d=google.com; s=arc-20160816; b=dyN4Geco9nvZzX6VXJcFqFSToqC7klnhwVCJhQ2kh+dSpat9qF5uj8zOve4/NH0J7I QfBNvNicoICzKQ0ZV6Ko3MZY+48SFpzCwF7zUTxZcOTfjhMhJD6mNvTfkVp4bFnVakMh whW2ILa4MCb33Nw9zgYwEbAOCeTv2/jNuDogqSOgPxO35wxkWZ4shzWFTnAqpAAetx+I dwg174iVq7tUS3fnK3hIMEMtQ+CnrCdoFWhM+Q1OzqrOS26CgeuSgxd2+ti/G5elKQF+ qQOYnnGKidf5kAb3gePCVARjZJH2U1GxO2onbWVwx+3ZDnpHxRaEjeLpbNH8f6VuFKnX EFcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=S1si5m6BF6jZCqxr99Qj6El0HYO83QaZGvDIz0S0L30=; b=bz/YXOPJixb1oERNm93ax5PibiBc6N8qjolGauyYdqVcTVCGELiAO/UjfpljYuo9Ih zoKS3Vg4so2gFHicOaBAZtoD3yDLag0kU29v8kZ0iemV717jtqJaQrt/WJGZv4nnpyyT IKkH+PZCjmDx4TPwpHVh76Qn0w9j8HS/nWS0OGGIDuZJ6JhSRxDZ5N0HSnEekj5d1qHn RsqDaDj3DwqQenomhn/jJVuH+0SgGoFWE8kDqGGjzwRDUqDX9BAt0jI24JQE2jPUGIR9 39MSrv2tJAa7MipdbWAnM51xOYgG3potW6bpsP0OmpcmTv6zMlp7XNty5R1NRHOPyzxF le3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=W80OU86D; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si460599edc.193.2021.10.19.14.26.26; Tue, 19 Oct 2021 14:26:51 -0700 (PDT) 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=@google.com header.s=20210112 header.b=W80OU86D; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbhJSV0u (ORCPT + 99 others); Tue, 19 Oct 2021 17:26:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbhJSV0u (ORCPT ); Tue, 19 Oct 2021 17:26:50 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9518C061746 for ; Tue, 19 Oct 2021 14:24:36 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id j190so13829928pgd.0 for ; Tue, 19 Oct 2021 14:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S1si5m6BF6jZCqxr99Qj6El0HYO83QaZGvDIz0S0L30=; b=W80OU86DZhWDlHKYd/h6qPAN/PtnItZBIHXq8zniXU26IVK7CrfyrUU5+EKGh8LdHH ogdbRaptDNWRY3KhmeDJxthim2uUsObmoq7ujp6+Gq528vT/dkvisHHNWrtizMmvFHvD CxzX6256nD5KUaVbxSp83dSVFF/wLffiKJUptudpTbTlVugAZESMjKyZ83oumJYneHAc Karlj3m/udREInvXvJXWJ2fMSHE6O1afYk9J6wPzt9lU4rKUPa0NVF1wkXiBdJIS4yUY yj8P/dTK1kT3m5sAY8aJ7ZmB4TsDn0Pz/Nfei6dnB0AArFXOjnBKrXjnkwQhyoTEWt+i p8vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S1si5m6BF6jZCqxr99Qj6El0HYO83QaZGvDIz0S0L30=; b=fBBRcXHbwKsphxVCa4DhXbzbLncYsIbVxSv0nKbmfN068CHv2mc0kKZOmbTzwLOD3D D/r9HRZ2KsoZtMi0z/iTjnSSfPoG4d9jDpXZ+V4xmcu8jEU/SpO0Pqyf2AcE1q6fEH8O PKtTnbFP1DVKDHpBWjvroXjULjFB5i103kqIaVI2IHVMbDFS8WGzyDKt5sLdlxlZBnFD ILlBa9nYZV/O3BCdg8wY2zCg/3rCVz6v71qzscA3q3nCmEacykpKQwMs5f1sYFBbvNX6 0VDmyIdWy9onT32qlIZq6/k/aJCrB10JCH6kgaUjtjjmmlgubGjghK/jVSPesbJt49JE zJmg== X-Gm-Message-State: AOAM5330aBdNhoDu3ZACK241ZE0sPNj8zYj1x87qyJkJNqh+REM7z8XG Wfz7MHh9d8+Bl+2UCs8HichmCu5wrCgVg/BhVdXvQSPKQwE= X-Received: by 2002:a63:3483:: with SMTP id b125mr30964529pga.79.1634678676292; Tue, 19 Oct 2021 14:24:36 -0700 (PDT) MIME-Version: 1.0 References: <20210915195306.612966-1-kaleshsingh@google.com> <20210915195306.612966-3-kaleshsingh@google.com> <20211019164543.2ca20830@gandalf.local.home> In-Reply-To: <20211019164543.2ca20830@gandalf.local.home> From: Kalesh Singh Date: Tue, 19 Oct 2021 14:24:25 -0700 Message-ID: Subject: Re: [PATCH 2/5] tracing: Add division and multiplication support for hist triggers To: Steven Rostedt Cc: Suren Baghdasaryan , Hridya Valsaraju , Namhyung Kim , Jonathan Corbet , Ingo Molnar , Shuah Khan , Tom Zanussi , Masami Hiramatsu , "open list:DOCUMENTATION" , LKML , "open list:KERNEL SELFTEST FRAMEWORK" , "Cc: Android Kernel" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 1:45 PM Steven Rostedt wrote: > > On Wed, 15 Sep 2021 19:52:46 +0000 > Kalesh Singh wrote: > > > +static u64 hist_field_div(struct hist_field *hist_field, > > + struct tracing_map_elt *elt, > > + struct trace_buffer *buffer, > > + struct ring_buffer_event *rbe, > > + void *event) > > +{ > > + struct hist_field *operand1 = hist_field->operands[0]; > > + struct hist_field *operand2 = hist_field->operands[1]; > > + > > + u64 val1 = operand1->fn(operand1, elt, buffer, rbe, event); > > + u64 val2 = operand2->fn(operand2, elt, buffer, rbe, event); > > + > > + /* Return -1 for the undefined case */ > > + if (!val2) > > + return -1; > > + > > + return val1 / val2; > > This wont work on x86 32 bit machines, as u64 division will trigger > floating point arithmetic by the compiler, and cause a fault. Thanks for catching this. I'll address it in the next version. - Kalesh > > You'll need to use one of the div64() helpers. > > -- Steve > > > > +} > > +