From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 967F2A0524; Tue, 13 Apr 2021 17:07:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C6A0160FC0; Tue, 13 Apr 2021 17:07:32 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 29F32160FBA for ; Tue, 13 Apr 2021 17:07:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618326449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8Cp3VVMcmdCENzSopLYoJTEDK6JT3j/UWlnWZQnbgY0=; b=HaBuXCGsASpdAdbQpal6Fol8ZrA91ymUIuD7vTWjTYkpJi3afx/9AEV4JqYq8Yjerv5TWz 6wuA2K1rID5SDzn0AoGvAcENXYSd6C9Vp+xSLP6Uu0GT5lwUVj6eItwqpX90XTF6mNTfXW 1swuMEZG2CBfwxlbsUIB1WRwz4/RSQ8= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-zZ3xEXXAPNetKzchWtPKdA-1; Tue, 13 Apr 2021 11:07:26 -0400 X-MC-Unique: zZ3xEXXAPNetKzchWtPKdA-1 Received: by mail-vs1-f70.google.com with SMTP id f29-20020a67e09d0000b02901fd5c649b72so1253844vsl.18 for ; Tue, 13 Apr 2021 08:07:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8Cp3VVMcmdCENzSopLYoJTEDK6JT3j/UWlnWZQnbgY0=; b=hsUBIdG82lyyzY+sglFVA0ZU0fmeUKr9zAgm6sWqmzI4khlrbnQgusMYRcMgx7wAML RQWPMpzhTIet7S4uVjlKqLbFwv3O9Klvlh01ch1yLZ1zjkY2QX/OGjYvhwdmuuCBKIpQ UYzh2v5qXewaPgQKFE6TugePY9kK2HDtSvmLyy/fIk+RFWkqlhT8y3zxxg/1UJUOiYDr yLNJSa/vl3Mi31MBaf1c3GN6MMLnBKWGxvWjt/BDn/VVaBrQAmJ6oVk0iWmd+Zop8JzK E6Fp3j1db1M8vrzifGbZj2MV9tjclojVR6hhRdslbgrQwOSlfE76nVH9Xpyksfrs5Xpc mGHg== X-Gm-Message-State: AOAM531UmPL6Gw4NiG4Q9mrd0siGR8iP5RqaB3f6Gn9T3kGyM5baCmu/ uBEvMy76jFcfLXOoDYnSmYpNazHOrhRglBT4B1lydYYrUybo/T3f3uiYrjGDASMnqEl+qx0tA1T JndJWQ/bbUaA78tKn8Eo= X-Received: by 2002:a67:efd4:: with SMTP id s20mr22056010vsp.27.1618326445886; Tue, 13 Apr 2021 08:07:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq+a9OrjBp+M5Jqc9vmxA2BqYbWsOCoNuGXQ7zcSqsE6/fMUq3vjU/x5ve5yB5zvY273emnww5LE+XJ1S+nrs= X-Received: by 2002:a67:efd4:: with SMTP id s20mr22055974vsp.27.1618326445569; Tue, 13 Apr 2021 08:07:25 -0700 (PDT) MIME-Version: 1.0 References: <20210409124334.24479-1-david.marchand@redhat.com> <20210409130145.GA1381@bricha3-MOBL.ger.corp.intel.com> In-Reply-To: <20210409130145.GA1381@bricha3-MOBL.ger.corp.intel.com> From: David Marchand Date: Tue, 13 Apr 2021 17:07:14 +0200 Message-ID: To: Bruce Richardson Cc: dev , Thomas Monjalon , Andrew Rybchenko Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] log: deduce log type from filename X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Apr 9, 2021 at 3:01 PM Bruce Richardson wrote: > > On Fri, Apr 09, 2021 at 02:43:34PM +0200, David Marchand wrote: > > Let's try to enforce the convention where drivers use a pmd. logtype > > with their class reflected in it and libraries use a lib. logtype. > > > > RTE_LOG_REGISTER now interprets the log type name: > > - if none or a name starting with a . is passed, then the default logtype > > is used as a prefix, > > - else the name is used as is to deal with components that do not comply > > with the current convention, > > > > Note: achieved with below command (+ manual edit on crypto/virtio, > > compress/mlx5 and regex/mlx5). > > $ git grep -l RTE_LOG_REGISTER drivers/ | > > while read file; do > > pattern=${file##drivers/}; > > class=${pattern%%/*}; > > pattern=${pattern#$class/}; > > pattern=pmd.$class.${pattern%%/*}; > > sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\(\|\..*\),/RTE_LOG_REGISTER(\1, \2,/' $file; > > done > > > > $ git grep -l RTE_LOG_REGISTER lib/ | > > while read file; do > > pattern=${file##lib/librte_}; > > pattern=lib.${pattern%%/*}; > > sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\(\|\..*\),/RTE_LOG_REGISTER(\1, \2,/' $file; > > done > > > > Signed-off-by: David Marchand > > --- > > This is an alternative to the devtools check I had proposed [1]. > > This can be seen as a RFC, but if people are happy with it, I don't see > > much to add. > > > > 1: https://patchwork.dpdk.org/project/dpdk/list/?series=15796 > > > > --- > > > diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c > > index 91bee65e7b..fb315f02e9 100644 > > --- a/drivers/common/dpaax/dpaax_iova_table.c > > +++ b/drivers/common/dpaax/dpaax_iova_table.c > > @@ -460,4 +460,4 @@ dpaax_handle_memevents(void) > > dpaax_memevent_cb, NULL); > > } > > > > -RTE_LOG_REGISTER(dpaax_logger, pmd.common.dpaax, ERR); > > +RTE_LOG_REGISTER(dpaax_logger, , ERR); > > Sorry, but this blank field looks really wrong to me, and I'd rather find a > better solution. > > How about as part of the cflags for each component adding > "-D" flag with the default component log name, that can be used in place of > the blank, or added to as needed? Ok, resolving this name at build time is better. I prefer separate macros though: - keeping RTE_LOG_REGISTER untouched (and usable out of the dpdk tree) - introducing RTE_LOG_REGISTER_DEFAULT_LOGTYPE(type, level) (for components who need only one handle) - introducing RTE_LOG_REGISTER_LOGTYPE(type, suffix, level) (for those who want more). -- David Marchand