Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1548132pxt; Sat, 7 Aug 2021 15:12:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0GF1ZISyRUxxIiqhmDUjGAU5f9aMkf+lEp1w9pEeJ6GhaylXzV8/ymFbmGCwZmy7vsSJh X-Received: by 2002:aa7:dada:: with SMTP id x26mr20949116eds.156.1628374331820; Sat, 07 Aug 2021 15:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628374331; cv=none; d=google.com; s=arc-20160816; b=Lf6TTouAx9DqYdhl9tXNWTyEX2KZfg4vTc1E8kVvI/KrK9CURswcNXmHnEKTtD2H7W qiiSZHhFrYm6oLwk+Ug2VnpeM63g+9KpZZMzzHdF8FjmIFE2bUtdpwnBGQPzTnAVYysB AKj83RgF5tJwKy3qRRlnenG9F1PzLD2ohoyEs624HVt1uwlqH1Csg0qqGKqxdyn3Ez+e sA0syuK/Kk1gabmpOyWjEFn1VkV5p7ogu7tfarIFw0bXboeRAj9nzP6r8usabc5e36W6 C7Jp9Yo7usqDojg2jSMMUaIjTtb4A1o1Clmni52XaofuUYAVsGn78TlEx8lQ3PR2kLOF G0Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=4Ouhso+fXGviI6knKE4P53n2vIYIknqTkdYBIyB7lgc=; b=bOkhVI4oK271ON1AwdaXb8sDPXrcBfCfRzPW+eIA9Wlq6RqeYaofnKgevYIKeS2c7K zrmhHmD5Zji9BevsW7CiMHKxR1ubyHqYUj4Ousk3EoULVT/z68YzmIXYFPfmZ6TOMCtW pHQvkiIw3vEpKMFUjXY8yVo6zyLMdF058/tY3ybDkbcGLHrXpx6hjl+YuYJztSRM2fpK LogdJmc2Mx+EdJaw/CIAWSPIc6fq1UFG8Bnx0mk6KpgMo4ggQPx7sv/YEje7qvYsNXSz Dx1vpp5qNiWVI+IYBgpuGZtPRKbE+KW7Tm2CRGpeafJeELVOhXwOqTMJJZApZFcLkmId /ewQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mf6If6r4; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si13293700ejj.202.2021.08.07.15.11.22; Sat, 07 Aug 2021 15:12:11 -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=@redhat.com header.s=mimecast20190719 header.b=Mf6If6r4; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbhHGVyr (ORCPT + 99 others); Sat, 7 Aug 2021 17:54:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44347 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbhHGVyq (ORCPT ); Sat, 7 Aug 2021 17:54:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628373267; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Ouhso+fXGviI6knKE4P53n2vIYIknqTkdYBIyB7lgc=; b=Mf6If6r4T61+ZQPIIMdFNTDMpMYH8y+NZB+fIyBPDGzTQldoTXJUcq4bGt+o1XHZZ4R+sy hvigszGhNX6sZ6GPbfAJhtBnrPzgQFTQsR1CLC62rL86+zIcTTK0dY1sLVl5k+WukbLnTq w7TpNaJcEJp++2iDNUZlLVqXcZi0IMk= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-CD_f0CFdMCW7-ZJF2v296Q-1; Sat, 07 Aug 2021 17:54:26 -0400 X-MC-Unique: CD_f0CFdMCW7-ZJF2v296Q-1 Received: by mail-qv1-f72.google.com with SMTP id kk20-20020a0562145094b029034e3ec4ffb4so3256625qvb.11 for ; Sat, 07 Aug 2021 14:54: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:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4Ouhso+fXGviI6knKE4P53n2vIYIknqTkdYBIyB7lgc=; b=eU42GEUYvUHO08zN7njwvZAD/XQE1gNqODnhTt7CZYmOcesJzn8RTYMDEccMz4qE3e TmnAhwwDx8MLO386qGK1CQDv5c8V7PiPqXtwG9A5UKAdDMgbocODgTlzCu561wI4kaUA LCDFBuGh4AGigTEw4kJw0Fob5YptzdC3gjqDzXod1AX/SvGPLBxT6QbfAs83+6gENA+H 45T3P1r1kQhQRbdLuHZkzA0RLlXdi0SQiJGLSBDFYNMX0uaz5qIjBaXFiDKiHon9NmW3 7ibd6LcSpV/TwNTG/XTiNf9hn+sQFX3dbfks1U+qGbBK6XZbptOixuAlFKurEf9OpPZx 9NRg== X-Gm-Message-State: AOAM530tYnWyXscEfVEMo7ZcwI9qvmRa09ZUpmr56F1UL6y3Yzf0tc8F V8FY/k8JxijdBWV4JefZk1MHzV5T915qe31N03v8F9/aRyPCypre9KhBSpss5D6EeSV/ZdFds+3 N9BuBTkxy8aWYDY78ySdzCQKT3QEEv0qBpynzKxgLSs5o5x/R6uI46PVVzXXJwm6ssCy/GiuIbh sM X-Received: by 2002:ac8:4d8e:: with SMTP id a14mr14314799qtw.157.1628373265829; Sat, 07 Aug 2021 14:54:25 -0700 (PDT) X-Received: by 2002:ac8:4d8e:: with SMTP id a14mr14314780qtw.157.1628373265536; Sat, 07 Aug 2021 14:54:25 -0700 (PDT) Received: from jtoppins.rdu.csb ([107.15.110.69]) by smtp.gmail.com with ESMTPSA id j185sm6781368qkf.28.2021.08.07.14.54.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Aug 2021 14:54:25 -0700 (PDT) Subject: Re: [PATCH net-next 2/2] bonding: combine netlink and console error messages To: Joe Perches , netdev@vger.kernel.org Cc: Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org References: <37c7bbbb01ede99974fc9ce3c3f5dad4845df9ee.camel@perches.com> From: Jonathan Toppins Message-ID: Date: Sat, 7 Aug 2021 17:54:24 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <37c7bbbb01ede99974fc9ce3c3f5dad4845df9ee.camel@perches.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/6/21 11:52 PM, Joe Perches wrote: > On Fri, 2021-08-06 at 23:30 -0400, Jonathan Toppins wrote: >> There seems to be no reason to have different error messages between >> netlink and printk. It also cleans up the function slightly. > [] >> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c > [] >> +#define BOND_NL_ERR(bond_dev, extack, errmsg) do { \ >> + NL_SET_ERR_MSG(extack, errmsg); \ >> + netdev_err(bond_dev, "Error: " errmsg "\n"); \ >> +} while (0) >> + >> +#define SLAVE_NL_ERR(bond_dev, slave_dev, extack, errmsg) do { \ >> + NL_SET_ERR_MSG(extack, errmsg); \ >> + slave_err(bond_dev, slave_dev, "Error: " errmsg "\n"); \ >> +} while (0) > > If you are doing this, it's probably smaller object code to use > "%s", errmsg > as the errmsg string can be reused > > #define BOND_NL_ERR(bond_dev, extack, errmsg) \ > do { \ > NL_SET_ERR_MSG(extack, errmsg); \ > netdev_err(bond_dev, "Error: %s\n", errmsg); \ > } while (0) > > #define SLAVE_NL_ERR(bond_dev, slave_dev, extack, errmsg) \ > do { \ > NL_SET_ERR_MSG(extack, errmsg); \ > slave_err(bond_dev, slave_dev, "Error: %s\n", errmsg); \ > } while (0) > > I like the thought and would agree if not for how NL_SET_ERR_MSG is coded. Unfortunately it does not appear as though doing the above change actually generates smaller object code. Maybe I have incorrectly interpreted something? $ git show commit 6bb346263b4e9d008744b45af5105df309c35c1a (HEAD -> upstream-bonding-cleanup) Author: Jonathan Toppins Date: Sat Aug 7 17:34:58 2021 -0400 object code optimization diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 46b95175690b..e2903ae7cdab 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1714,12 +1714,12 @@ void bond_lower_state_changed(struct slave *slave) #define BOND_NL_ERR(bond_dev, extack, errmsg) do { \ NL_SET_ERR_MSG(extack, errmsg); \ - netdev_err(bond_dev, "Error: " errmsg "\n"); \ + netdev_err(bond_dev, "Error: %s\n", errmsg); \ } while (0) #define SLAVE_NL_ERR(bond_dev, slave_dev, extack, errmsg) do { \ NL_SET_ERR_MSG(extack, errmsg); \ - slave_err(bond_dev, slave_dev, "Error: " errmsg "\n"); \ + slave_err(bond_dev, slave_dev, "Error: %s\n", errmsg); \ } while (0) /* enslave device to bond device */ $ git log --oneline -3 6bb346263b4e (HEAD -> upstream-bonding-cleanup) object code optimization a36c7639a139 bonding: combine netlink and console error messages 88916c847e85 bonding: remove extraneous definitions from bonding.h jtoppins@jtoppins:~/projects/linux-rhel7$ git rebase -i --exec "make drivers/net/bonding/bond_main.o; ls -l drivers/net/bonding/bond_main.o" HEAD^^ hint: Waiting for your editor to close the file... Error detected while processing /home/jtoppins/.vim/bundle/cscope_macros.vim/plugin/cscope_macros.vim: line 42: E568: duplicate cscope database not added Press ENTER or type command to continue Executing: make menuconfig *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. Executing: make drivers/net/bonding/bond_main.o; ls -l drivers/net/bonding/bond_main.o CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool DESCEND bpf/resolve_btfids CC [M] drivers/net/bonding/bond_main.o -rw-r--r--. 1 jtoppins jtoppins 1777896 Aug 7 17:37 drivers/net/bonding/bond_main.o Executing: make drivers/net/bonding/bond_main.o; ls -l drivers/net/bonding/bond_main.o CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool DESCEND bpf/resolve_btfids CC [M] drivers/net/bonding/bond_main.o -rw-r--r--. 1 jtoppins jtoppins 1778320 Aug 7 17:37 drivers/net/bonding/bond_main.o Successfully rebased and updated refs/heads/upstream-bonding-cleanup. It appears the change increases bond_main.o by 424 (1778320-1777896) bytes.