[dpdk-dev] [PATCH v10 11/20] unci: add netlink exec
Ferruh Yigit
ferruh.yigit at intel.com
Thu Jul 6 12:45:48 CEST 2017
On 7/5/2017 8:07 PM, Stephen Hemminger wrote:
> 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.
Thank you for the review,
I will send a new version addressing all comments.
Thanks,
ferruh
More information about the dev
mailing list