Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux kernel 当与卡的通信超时时,停止MMC队列获取新请求_Linux Kernel_Arm_Sd Card_Omap - Fatal编程技术网

Linux kernel 当与卡的通信超时时,停止MMC队列获取新请求

Linux kernel 当与卡的通信超时时,停止MMC队列获取新请求,linux-kernel,arm,sd-card,omap,Linux Kernel,Arm,Sd Card,Omap,我们使用的是运行3.2版内核的定制板,但在测试MMC层的健壮性时遇到了一些问题 首先,我们的MMC插槽没有卡检测pin。所涉问题包括以下内容: 加载模块(omap\U hsmmc)。通电时检测到该卡, 并适当安装 从SD卡读取内容(即cat foo.txt) 读取文件时,卸下卡 多次尝试失败后,系统挂起 现在,我已经跟踪到了以下代码部分,在drivers/mmc/card/queue.c中: static int mmc\u queue\u线程(void*d) {

我们使用的是运行3.2版内核的定制板,但在测试MMC层的健壮性时遇到了一些问题

首先,我们的MMC插槽没有卡检测pin。所涉问题包括以下内容:

  • 加载模块(omap\U hsmmc)。通电时检测到该卡, 并适当安装
  • 从SD卡读取内容(即
    cat foo.txt
  • 读取文件时,卸下卡
  • 多次尝试失败后,系统挂起
  • 现在,我已经跟踪到了以下代码部分,在
    drivers/mmc/card/queue.c
    中:

    static int mmc\u queue\u线程(void*d)
    {                                                                                                                       
    结构mmc_队列*mq=d;
    struct request_queue*q=mq->queue;
    当前->标志|=PF|U MEMALLOC;
    向下(&mq->thread\u sem);
    做{
    结构请求*req=NULL;
    结构mmc_队列_请求*tmp;
    自旋锁(q->队列锁);
    设置当前状态(任务可中断);
    req=blk_取数_请求(q);
    mq->mqrq\u cur->req=req;
    旋转解锁irq(q->队列锁定);
    如果(请求| mq->mqrq|u prev->req){
    设置当前状态(任务正在运行);
    mq->问题(mq,请求);
    }否则{
    如果(kthread_should_stop()){
    设置当前状态(任务正在运行);
    打破
    }                                                                                                              
    向上(&mq->thread\u sem);
    附表();
    向下(&mq->thread\u sem);
    }                                                                                                                 
    /*当前请求变成以前的请求,反之亦然。*/
    mq->mqrq_prev->brq.mrq.data=NULL;
    mq->mqrq_prev->req=NULL;
    tmp=mq->mqrq_prev;
    mq->mqrq\u prev=mq->mqrq\u cur;
    mq->mqrq_cur=tmp;
    }而(1),;
    向上(&mq->thread\u sem);
    返回0;
    }
    
    研究这段代码,我发现它挂在
    mq->issue\fn(mq,req)
    调用中。此函数准备并发出适当的命令来填充传递给它的请求,并且它知道在无法与卡通信时发生的任何错误。在我看来,错误是以一种笨拙的方式处理的,并且不会“冒泡”到
    mmc\u queue\u线程。然而,我已经将我的版本代码与最新的内核版本(4.9)的代码进行了对比,除了更好地分离每个错误案例(处理方式非常相似)之外,我没有发现对此类错误的处理有任何区别

    我怀疑问题是由于上层无法停止向MMC卡发出新的读取请求所致


    我所尝试的:

    • 重写代码以便传递错误,以便我可以执行
      ret=mq->issue\u fn(mq,req)
    • 由于能够识别出具体的错误,我试图取消
      commit a8ad82cc1b22d04916d9cdb1dc75052e80ac803c
      Author: Sujit Reddy Thumma <sthumma@codeaurora.org>
      Date:   Thu Dec 8 14:05:50 2011 +0530
      
          mmc: card: Kill block requests if card is removed
      
          Kill block requests when the host realizes that the card is
          removed from the slot and is sure that subsequent requests
          are bound to fail. Do this silently so that the block
          layer doesn't output unnecessary error messages.
      
          Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
          Acked-by: Adrian Hunter <adrian.hunter@intel.com>
          Signed-off-by: Chris Ball <cjb@laptop.org>