[dpdk-dev] [PATCH v10 11/20] unci: add netlink exec

Stephen Hemminger stephen at networkplumber.org
Wed Jul 5 21:07:03 CEST 2017


On Tue,  4 Jul 2017 17:13:28 +0100
Ferruh Yigit <ferruh.yigit at intel.com> wrote:

> +int unci_nl_exec(u32 cmd, struct net_device *dev, void *in_data,
> +		size_t in_data_len, void *out_data, size_t out_data_len)
> +{
> +	struct unci_dev *unci = netdev_priv(dev);
> +	int err = -EINVAL;
> +	int ret;
> +
> +	if (out_data_len > UNCI_NL_MSG_LEN) {
> +		pr_err("Message is too big to receive:%zu\n", out_data_len);
> +		return err;
> +	}
> +
> +	mutex_lock(&sync_lock);
> +	ret = unci_response_buffer_register(cmd, out_data, out_data_len,
> +			&unci->msg_received, &err);
> +	if (ret) {
> +		mutex_unlock(&sync_lock);
> +		return -EINVAL;
> +	}
> +
> +	ret = unci_nl_send(cmd, unci->port_id, unci->pid, in_data, in_data_len);
> +	if (ret) {
> +		unci_response_buffer_unregister(response_buffer.magic);
> +		mutex_unlock(&sync_lock);
> +		return ret;
> +	}
> +
> +	ret = wait_for_completion_interruptible_timeout(&unci->msg_received,
> +			 msecs_to_jiffies(UNCI_CMD_TIMEOUT));

Blocking for completion with mutex held? 
Sleeping with mutex held is not allowed in Linux.

You will see this if you run with lockdep and all the other kernel debug
config options.


More information about the dev mailing list