All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Paweł Narewski" <pawel.narewski@nokia.com>, linux-gpio@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linusw@kernel.org, brgl@kernel.org,
	"Paweł Narewski" <pawel.narewski@nokia.com>,
	"Jakub Lewalski" <jakub.lewalski@nokia.com>
Subject: Re: [PATCH] gpiolib: fix race condition for gdev->srcu
Date: Wed, 24 Dec 2025 20:20:02 +0800	[thread overview]
Message-ID: <202512250122.ibtipV8L-lkp@intel.com> (raw)
In-Reply-To: <20251223084952.1847489-1-pawel.narewski@nokia.com>

Hi Paweł,

kernel test robot noticed the following build errors:

[auto build test ERROR on brgl/gpio/for-next]
[also build test ERROR on linus/master v6.19-rc2 next-20251219]
[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/Pawe-Narewski/gpiolib-fix-race-condition-for-gdev-srcu/20251223-165142
base:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
patch link:    https://lore.kernel.org/r/20251223084952.1847489-1-pawel.narewski%40nokia.com
patch subject: [PATCH] gpiolib: fix race condition for gdev->srcu
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20251225/202512250122.ibtipV8L-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251225/202512250122.ibtipV8L-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512250122.ibtipV8L-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpio/gpiolib.c:1109:2: error: no member named 'rwsem' in 'struct raw_notifier_head'
    1109 |         BLOCKING_INIT_NOTIFIER_HEAD(&gdev->line_state_notifier);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/notifier.h:86:23: note: expanded from macro 'BLOCKING_INIT_NOTIFIER_HEAD'
      86 |                 init_rwsem(&(name)->rwsem);     \
         |                 ~~~~~~~~~~~~~~~~~~~~^~~~~~
   include/linux/rwsem.h:121:16: note: expanded from macro 'init_rwsem'
     121 |         __init_rwsem((sem), #sem, &__key);                      \
         |                       ^~~
   1 error generated.


vim +1109 drivers/gpio/gpiolib.c

  1044	
  1045	int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
  1046				       struct lock_class_key *lock_key,
  1047				       struct lock_class_key *request_key)
  1048	{
  1049		struct gpio_device *gdev;
  1050		unsigned int desc_index;
  1051		int base = 0;
  1052		int ret;
  1053	
  1054		/*
  1055		 * First: allocate and populate the internal stat container, and
  1056		 * set up the struct device.
  1057		 */
  1058		gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
  1059		if (!gdev)
  1060			return -ENOMEM;
  1061	
  1062		gdev->dev.type = &gpio_dev_type;
  1063		gdev->dev.bus = &gpio_bus_type;
  1064		gdev->dev.parent = gc->parent;
  1065		rcu_assign_pointer(gdev->chip, gc);
  1066	
  1067		gc->gpiodev = gdev;
  1068		gpiochip_set_data(gc, data);
  1069	
  1070		device_set_node(&gdev->dev, gpiochip_choose_fwnode(gc));
  1071	
  1072		ret = ida_alloc(&gpio_ida, GFP_KERNEL);
  1073		if (ret < 0)
  1074			goto err_free_gdev;
  1075		gdev->id = ret;
  1076	
  1077		ret = dev_set_name(&gdev->dev, GPIOCHIP_NAME "%d", gdev->id);
  1078		if (ret)
  1079			goto err_free_ida;
  1080	
  1081		if (gc->parent && gc->parent->driver)
  1082			gdev->owner = gc->parent->driver->owner;
  1083		else if (gc->owner)
  1084			/* TODO: remove chip->owner */
  1085			gdev->owner = gc->owner;
  1086		else
  1087			gdev->owner = THIS_MODULE;
  1088	
  1089		ret = gpiochip_get_ngpios(gc, &gdev->dev);
  1090		if (ret)
  1091			goto err_free_dev_name;
  1092	
  1093		gdev->descs = kcalloc(gc->ngpio, sizeof(*gdev->descs), GFP_KERNEL);
  1094		if (!gdev->descs) {
  1095			ret = -ENOMEM;
  1096			goto err_free_dev_name;
  1097		}
  1098	
  1099		gdev->label = kstrdup_const(gc->label ?: "unknown", GFP_KERNEL);
  1100		if (!gdev->label) {
  1101			ret = -ENOMEM;
  1102			goto err_free_descs;
  1103		}
  1104	
  1105		gdev->ngpio = gc->ngpio;
  1106		gdev->can_sleep = gc->can_sleep;
  1107	
  1108		rwlock_init(&gdev->line_state_lock);
> 1109		BLOCKING_INIT_NOTIFIER_HEAD(&gdev->line_state_notifier);
  1110		BLOCKING_INIT_NOTIFIER_HEAD(&gdev->device_notifier);
  1111	
  1112		ret = init_srcu_struct(&gdev->srcu);
  1113		if (ret)
  1114			goto err_free_label;
  1115	
  1116		ret = init_srcu_struct(&gdev->desc_srcu);
  1117		if (ret)
  1118			goto err_cleanup_gdev_srcu;
  1119	
  1120	
  1121		scoped_guard(mutex, &gpio_devices_lock) {
  1122			/*
  1123			 * TODO: this allocates a Linux GPIO number base in the global
  1124			 * GPIO numberspace for this chip. In the long run we want to
  1125			 * get *rid* of this numberspace and use only descriptors, but
  1126			 * it may be a pipe dream. It will not happen before we get rid
  1127			 * of the sysfs interface anyways.
  1128			 */
  1129			base = gc->base;
  1130			if (base < 0) {
  1131				base = gpiochip_find_base_unlocked(gc->ngpio);
  1132				if (base < 0) {
  1133					ret = base;
  1134					base = 0;
  1135					goto err_cleanup_desc_srcu;
  1136				}
  1137	
  1138				/*
  1139				 * TODO: it should not be necessary to reflect the
  1140				 * assigned base outside of the GPIO subsystem. Go over
  1141				 * drivers and see if anyone makes use of this, else
  1142				 * drop this and assign a poison instead.
  1143				 */
  1144				gc->base = base;
  1145			} else {
  1146				dev_warn(&gdev->dev,
  1147					 "Static allocation of GPIO base is deprecated, use dynamic allocation.\n");
  1148			}
  1149	
  1150			gdev->base = base;
  1151	
  1152			ret = gpiodev_add_to_list_unlocked(gdev);
  1153			if (ret) {
  1154				gpiochip_err(gc, "GPIO integer space overlap, cannot add chip\n");
  1155				goto err_cleanup_desc_srcu;
  1156			}
  1157		}
  1158	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

      parent reply	other threads:[~2025-12-24 12:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23  8:42 [PATCH] gpiolib: fix race condition for gdev->srcu Paweł Narewski
2025-12-23 20:14 ` kernel test robot
2025-12-24  3:47 ` kernel test robot
2025-12-24  6:21 ` kernel test robot
2025-12-24  8:21 ` Bartosz Golaszewski
2025-12-24 12:20 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202512250122.ibtipV8L-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=brgl@kernel.org \
    --cc=jakub.lewalski@nokia.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pawel.narewski@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.