Message ID | 20230206100502.20243-2-wdehoog@exalondelft.nl (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | nvmem: brcm_nvram: use buffered nvram data for cell values | expand |
Hi Willem-Jan,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.2-rc7 next-20230206]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Willem-Jan-de-Hoog/firmware-bcm47xx_nvram-allow-to-read-from-buffered-nvram-data/20230206-180737
patch link: https://lore.kernel.org/r/20230206100502.20243-2-wdehoog%40exalondelft.nl
patch subject: [PATCH 1/2] firmware: bcm47xx_nvram: allow to read from buffered nvram data
config: sparc-randconfig-r035-20230205 (https://download.01.org/0day-ci/archive/20230207/202302071414.czB7JMnU-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/763f6661565b50b967e4f22e41cf46d27e14e58f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Willem-Jan-de-Hoog/firmware-bcm47xx_nvram-allow-to-read-from-buffered-nvram-data/20230206-180737
git checkout 763f6661565b50b967e4f22e41cf46d27e14e58f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/mtd/parsers/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/mtd/parsers/ofpart_linksys_ns.c:6:
include/linux/bcm47xx_nvram.h:56:2: error: expected identifier or '(' before ':' token
56 | }:
| ^
In file included from include/linux/uio.h:10,
from include/linux/mtd/mtd.h:10,
from drivers/mtd/parsers/ofpart_linksys_ns.c:7:
>> include/linux/mm_types.h:704:48: error: 'NR_MM_COUNTERS' undeclared here (not in a function)
704 | struct percpu_counter rss_stat[NR_MM_COUNTERS];
| ^~~~~~~~~~~~~~
vim +/NR_MM_COUNTERS +704 include/linux/mm_types.h
227a4aadc75ba2 Mathieu Desnoyers 2019-09-19 628
b279ddc3382426 Vegard Nossum 2017-02-27 629 /**
b279ddc3382426 Vegard Nossum 2017-02-27 630 * @mm_users: The number of users including userspace.
b279ddc3382426 Vegard Nossum 2017-02-27 631 *
c1a2f7f0c06454 Rik van Riel 2018-07-16 632 * Use mmget()/mmget_not_zero()/mmput() to modify. When this
c1a2f7f0c06454 Rik van Riel 2018-07-16 633 * drops to 0 (i.e. when the task exits and there are no other
c1a2f7f0c06454 Rik van Riel 2018-07-16 634 * temporary reference holders), we also release a reference on
c1a2f7f0c06454 Rik van Riel 2018-07-16 635 * @mm_count (which may then free the &struct mm_struct if
c1a2f7f0c06454 Rik van Riel 2018-07-16 636 * @mm_count also drops to 0).
b279ddc3382426 Vegard Nossum 2017-02-27 637 */
b279ddc3382426 Vegard Nossum 2017-02-27 638 atomic_t mm_users;
b279ddc3382426 Vegard Nossum 2017-02-27 639
b279ddc3382426 Vegard Nossum 2017-02-27 640 /**
b279ddc3382426 Vegard Nossum 2017-02-27 641 * @mm_count: The number of references to &struct mm_struct
b279ddc3382426 Vegard Nossum 2017-02-27 642 * (@mm_users count as 1).
b279ddc3382426 Vegard Nossum 2017-02-27 643 *
b279ddc3382426 Vegard Nossum 2017-02-27 644 * Use mmgrab()/mmdrop() to modify. When this drops to 0, the
b279ddc3382426 Vegard Nossum 2017-02-27 645 * &struct mm_struct is freed.
b279ddc3382426 Vegard Nossum 2017-02-27 646 */
b279ddc3382426 Vegard Nossum 2017-02-27 647 atomic_t mm_count;
b279ddc3382426 Vegard Nossum 2017-02-27 648
c4812909f5d5a9 Kirill A. Shutemov 2017-11-15 649 #ifdef CONFIG_MMU
af5b0f6a09e42c Kirill A. Shutemov 2017-11-15 650 atomic_long_t pgtables_bytes; /* PTE page table pages */
5a3fbef325e872 Kirill A. Shutemov 2015-04-14 651 #endif
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 652 int map_count; /* number of VMAs */
481b4bb5e370aa Richard Kennedy 2011-03-22 653
c1a2f7f0c06454 Rik van Riel 2018-07-16 654 spinlock_t page_table_lock; /* Protects page tables and some
c1a2f7f0c06454 Rik van Riel 2018-07-16 655 * counters
c1a2f7f0c06454 Rik van Riel 2018-07-16 656 */
2e3025434a6ba0 Feng Tang 2021-06-11 657 /*
2e3025434a6ba0 Feng Tang 2021-06-11 658 * With some kernel config, the current mmap_lock's offset
2e3025434a6ba0 Feng Tang 2021-06-11 659 * inside 'mm_struct' is at 0x120, which is very optimal, as
2e3025434a6ba0 Feng Tang 2021-06-11 660 * its two hot fields 'count' and 'owner' sit in 2 different
2e3025434a6ba0 Feng Tang 2021-06-11 661 * cachelines, and when mmap_lock is highly contended, both
2e3025434a6ba0 Feng Tang 2021-06-11 662 * of the 2 fields will be accessed frequently, current layout
2e3025434a6ba0 Feng Tang 2021-06-11 663 * will help to reduce cache bouncing.
2e3025434a6ba0 Feng Tang 2021-06-11 664 *
2e3025434a6ba0 Feng Tang 2021-06-11 665 * So please be careful with adding new fields before
2e3025434a6ba0 Feng Tang 2021-06-11 666 * mmap_lock, which can easily push the 2 fields into one
2e3025434a6ba0 Feng Tang 2021-06-11 667 * cacheline.
2e3025434a6ba0 Feng Tang 2021-06-11 668 */
da1c55f1b272f4 Michel Lespinasse 2020-06-08 669 struct rw_semaphore mmap_lock;
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 670
c1a2f7f0c06454 Rik van Riel 2018-07-16 671 struct list_head mmlist; /* List of maybe swapped mm's. These
c1a2f7f0c06454 Rik van Riel 2018-07-16 672 * are globally strung together off
c1a2f7f0c06454 Rik van Riel 2018-07-16 673 * init_mm.mmlist, and are protected
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 674 * by mmlist_lock
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 675 */
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 676
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 677
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 678 unsigned long hiwater_rss; /* High-watermark of RSS usage */
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 679 unsigned long hiwater_vm; /* High-water virtual memory usage */
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 680
e10d59f2c3deca Christoph Lameter 2011-10-31 681 unsigned long total_vm; /* Total pages mapped */
e10d59f2c3deca Christoph Lameter 2011-10-31 682 unsigned long locked_vm; /* Pages that have PG_mlocked set */
70f8a3ca68d3e1 Davidlohr Bueso 2019-02-06 683 atomic64_t pinned_vm; /* Refcount permanently increased */
30bdbb78009e67 Konstantin Khlebnikov 2016-02-02 684 unsigned long data_vm; /* VM_WRITE & ~VM_SHARED & ~VM_STACK */
30bdbb78009e67 Konstantin Khlebnikov 2016-02-02 685 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE & ~VM_STACK */
30bdbb78009e67 Konstantin Khlebnikov 2016-02-02 686 unsigned long stack_vm; /* VM_STACK */
e10d59f2c3deca Christoph Lameter 2011-10-31 687 unsigned long def_flags;
88aa7cc688d48d Yang Shi 2018-06-07 688
2e3025434a6ba0 Feng Tang 2021-06-11 689 /**
2e3025434a6ba0 Feng Tang 2021-06-11 690 * @write_protect_seq: Locked when any thread is write
2e3025434a6ba0 Feng Tang 2021-06-11 691 * protecting pages mapped by this mm to enforce a later COW,
2e3025434a6ba0 Feng Tang 2021-06-11 692 * for instance during page table copying for fork().
2e3025434a6ba0 Feng Tang 2021-06-11 693 */
2e3025434a6ba0 Feng Tang 2021-06-11 694 seqcount_t write_protect_seq;
2e3025434a6ba0 Feng Tang 2021-06-11 695
88aa7cc688d48d Yang Shi 2018-06-07 696 spinlock_t arg_lock; /* protect the below fields */
2e3025434a6ba0 Feng Tang 2021-06-11 697
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 698 unsigned long start_code, end_code, start_data, end_data;
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 699 unsigned long start_brk, brk, start_stack;
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 700 unsigned long arg_start, arg_end, env_start, env_end;
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 701
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 702 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 703
f1a7941243c102 Shakeel Butt 2022-10-24 @704 struct percpu_counter rss_stat[NR_MM_COUNTERS];
d559db086ff5be KAMEZAWA Hiroyuki 2010-03-05 705
801460d0cf5c52 Hiroshi Shimamoto 2009-09-23 706 struct linux_binfmt *binfmt;
801460d0cf5c52 Hiroshi Shimamoto 2009-09-23 707
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 708 /* Architecture-specific MM context */
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 709 mm_context_t context;
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 710
c1a2f7f0c06454 Rik van Riel 2018-07-16 711 unsigned long flags; /* Must use atomic bitops to access */
c92ff1bde06f69 Martin Schwidefsky 2007-10-16 712
Hi Willem-Jan, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v6.2-rc7 next-20230208] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Willem-Jan-de-Hoog/firmware-bcm47xx_nvram-allow-to-read-from-buffered-nvram-data/20230206-180737 patch link: https://lore.kernel.org/r/20230206100502.20243-2-wdehoog%40exalondelft.nl patch subject: [PATCH 1/2] firmware: bcm47xx_nvram: allow to read from buffered nvram data config: x86_64-randconfig-a006-20230206 (https://download.01.org/0day-ci/archive/20230209/202302090020.TxUXGMeJ-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/763f6661565b50b967e4f22e41cf46d27e14e58f git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Willem-Jan-de-Hoog/firmware-bcm47xx_nvram-allow-to-read-from-buffered-nvram-data/20230206-180737 git checkout 763f6661565b50b967e4f22e41cf46d27e14e58f # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:12: >> include/linux/bcm47xx_nvram.h:56:2: error: expected identifier or '(' }: ^ In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:14: In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h:9: In file included from include/linux/net.h:24: In file included from include/linux/mm.h:15: >> include/linux/mmap_lock.h:28:6: error: use of undeclared identifier '__tracepoint_mmap_lock_start_locking'; did you mean '__tracepoint_mmap_lock_released'? if (tracepoint_enabled(mmap_lock_start_locking)) ^ include/linux/tracepoint-defs.h:85:21: note: expanded from macro 'tracepoint_enabled' static_key_false(&(__tracepoint_##tp).key) ^ <scratch space>:48:1: note: expanded from here __tracepoint_mmap_lock_start_locking ^ include/linux/mmap_lock.h:16:1: note: '__tracepoint_mmap_lock_released' declared here DECLARE_TRACEPOINT(mmap_lock_released); ^ include/linux/tracepoint-defs.h:81:27: note: expanded from macro 'DECLARE_TRACEPOINT' extern struct tracepoint __tracepoint_##tp ^ <scratch space>:47:1: note: expanded from here __tracepoint_mmap_lock_released ^ 2 errors generated. vim +56 include/linux/bcm47xx_nvram.h 52 53 static inline int bcm47xx_nvram_read(unsigned int offset, char *val, size_t val_len) 54 { 55 return -ENOTSUPP; > 56 }: 57 #endif 58
Hi Willem-Jan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.2-rc8 next-20230215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Willem-Jan-de-Hoog/firmware-bcm47xx_nvram-allow-to-read-from-buffered-nvram-data/20230206-180737
patch link: https://lore.kernel.org/r/20230206100502.20243-2-wdehoog%40exalondelft.nl
patch subject: [PATCH 1/2] firmware: bcm47xx_nvram: allow to read from buffered nvram data
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20230215/202302152222.wtVZ1npH-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/763f6661565b50b967e4f22e41cf46d27e14e58f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Willem-Jan-de-Hoog/firmware-bcm47xx_nvram-allow-to-read-from-buffered-nvram-data/20230206-180737
git checkout 763f6661565b50b967e4f22e41cf46d27e14e58f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/net/ethernet/broadcom/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202302152222.wtVZ1npH-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/net/ethernet/broadcom/bgmac.c:15:
include/linux/bcm47xx_nvram.h:56:2: error: expected identifier or '(' before ':' token
56 | }:
| ^
In file included from include/linux/ethtool.h:19,
from include/linux/phy.h:16,
from drivers/net/ethernet/broadcom/bgmac.c:16:
>> include/uapi/linux/ethtool.h:125:49: warning: 'struct ethtool_cmd' declared inside parameter list will not be visible outside of this definition or declaration
125 | static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
| ^~~~~~~~~~~
include/uapi/linux/ethtool.h: In function 'ethtool_cmd_speed_set':
include/uapi/linux/ethtool.h:128:11: error: invalid use of undefined type 'struct ethtool_cmd'
128 | ep->speed = (__u16)(speed & 0xFFFF);
| ^~
include/uapi/linux/ethtool.h:129:11: error: invalid use of undefined type 'struct ethtool_cmd'
129 | ep->speed_hi = (__u16)(speed >> 16);
| ^~
include/uapi/linux/ethtool.h: At top level:
include/uapi/linux/ethtool.h:132:52: warning: 'struct ethtool_cmd' declared inside parameter list will not be visible outside of this definition or declaration
132 | static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
| ^~~~~~~~~~~
include/uapi/linux/ethtool.h: In function 'ethtool_cmd_speed':
include/uapi/linux/ethtool.h:134:19: error: invalid use of undefined type 'const struct ethtool_cmd'
134 | return (ep->speed_hi << 16) | ep->speed;
| ^~
include/uapi/linux/ethtool.h:134:41: error: invalid use of undefined type 'const struct ethtool_cmd'
134 | return (ep->speed_hi << 16) | ep->speed;
| ^~
vim +125 include/uapi/linux/ethtool.h
607ca46e97a1b6 David Howells 2012-10-13 124
607ca46e97a1b6 David Howells 2012-10-13 @125 static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
607ca46e97a1b6 David Howells 2012-10-13 126 __u32 speed)
607ca46e97a1b6 David Howells 2012-10-13 127 {
85a624403c77c3 Jesse Brandeburg 2016-10-13 128 ep->speed = (__u16)(speed & 0xFFFF);
607ca46e97a1b6 David Howells 2012-10-13 129 ep->speed_hi = (__u16)(speed >> 16);
607ca46e97a1b6 David Howells 2012-10-13 130 }
607ca46e97a1b6 David Howells 2012-10-13 131
diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c index 5f47dbf4889a..7e5c62dc702f 100644 --- a/drivers/firmware/broadcom/bcm47xx_nvram.c +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c @@ -182,6 +182,20 @@ static int nvram_init(void) return -ENXIO; } +int bcm47xx_nvram_read(unsigned int offset, char *val, size_t val_len) +{ + if (!nvram_len) + return -ENXIO; + + if ((offset+val_len) > nvram_len) + return -EINVAL; + + while (val_len--) + *val++ = nvram_buf[offset++]; + + return 0; +} + int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len) { char *var, *value, *end, *eq; diff --git a/include/linux/bcm47xx_nvram.h b/include/linux/bcm47xx_nvram.h index 7615f8d7b1ed..b265b8ce6434 100644 --- a/include/linux/bcm47xx_nvram.h +++ b/include/linux/bcm47xx_nvram.h @@ -20,6 +20,7 @@ static inline void bcm47xx_nvram_release_contents(char *nvram) { vfree(nvram); }; +int bcm47xx_nvram_read(unsigned int offset, char *val, size_t val_len); #else static inline int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size) @@ -48,6 +49,11 @@ static inline char *bcm47xx_nvram_get_contents(size_t *val_len) static inline void bcm47xx_nvram_release_contents(char *nvram) { }; + +static inline int bcm47xx_nvram_read(unsigned int offset, char *val, size_t val_len) +{ + return -ENOTSUPP; +}: #endif #endif /* __BCM47XX_NVRAM_H */