This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM57X: usb3.0 can be forced to run as usb2.0 always?

Now I am using process sdk 03.02.05 for am572x.

condition:

usb3.0 disk connect to usb3.0 port.

usb2.0 disk connect to usb2.0 port.

Linux will be crash by  PAGE_FLAGS_CHECK_AT_PREP when Copying files(total size is about 1GB) between usb3.0and usb2.0  disk.

condition:

usb3.0 disk connect to usb2.0 port.

usb2.0 disk connect to usb3.0 port.

all is ok when doing the same thing above.

Is there any patch to solved this problem?

Or any way to force usb3.0 port always run as usb2.0, even though connet with usb 3.0 disk.

  • Hi Junhu,

    Please provide following details.

    - Is this happening on your custom board or TI EVM? If your board, please post the usb portion of the schematics, showing which port is the USB3.0 port and which is the USB2.0 port.
    - What is the SDK/kernel version?
    - Please attach the full kernel log showing the crash.
    - how many different USB devices have you tested?

    By the way, there is no other way to force USB3.0 port to work in usb2.0 mode in software, other than adding a usb2.0 hub.
  • - Is this happening on your custom board or TI EVM? If your board, please post the usb portion of the schematics, showing which port is the USB3.0 port and which is the USB2.0 port.

    yes, it is my custom board.

    usb portion of the schematics

    7587.usb.pdf

    - What is the SDK/kernel version?

    PSDK: 03.02.05, Kernel:4.4.32

    - Please attach the full kernel log showing the crash.

    After crash, the cp still continue.

    ZOC1811.LOG

    - how many different USB devices have you tested?

    USB3.0: TOSHIBA  TransMemory-Mx USB Disk; Kingston DataTraveler 100G3 USB Disk; Transcend USB3.0 SD card Reader with Different SD Card(8G, 16G)

    USB2.0: SSK USB 2.0 SD card Reader with Different SD Card(8G, 16G)

  • This is the config file of my kernel.

    siui_am57xx_defconfig.txt

  • Hi Jinhu,

    The kernel dump is due to a kernel memory allocation failure (flag PAGE_FLAGS_CHECK_AT_PREP is set) in kernel Memory Management. I don't know what causes the failure at the moment, but it could be a bug in kernel core. Can you please test with the latest Processor SDK to see if the issue still happens?
  • yes, I think it is a bug in kernel core too.

    But due to product deadline, I have no time tu port all to the lastest SDK.

    I want to know there is any patch to solved my problem? or change some kernel option?

    I check all comit on git from kernel SDK 03.02.05 to 03.03.00, but no comit seems to solve the problem.
  • I will try to update kernel to lastest version of SDK.
  • Yes, you don't have to port the entire SDK, please just test with the new kernel in the latest SDK v5.1.
  • Can you give me the git of "board-suppor/extra-driver"?

    I don't want to download and extract all of lastest sdk.

  • To test usb itself, you don't have to use the extra-drivers.
    Or you can download the SDK source package am57xx-evm-linux-sdk-src-05.01.00.11.tar.xz, which is smaller, about 1.2GB.
    software-dl.ti.com/.../am57xx-evm-linux-sdk-src-05.01.00.11.tar.xz
  • The result is the same with kernel 4.14.67.
    during cp, the kernel says PAGE_FLAGS_CHECK_AT_KEEP.

    Any idea to solve this problem?

    Or any kernel option is wrong?
  • Is it the memory problem or kernel BUG?
  • Not only USB3.0, but also USB2.0

    I use "dd if=/dev/zero of=./zeros bs=1M count=4096"

    Both are crash.

    It seems the page is not freed.


    Any idea to solve problem?

  • Hi Jinhu,

    I cannot explain the problem at the moment, I didn't see this issue before.
    But I am going to run the same test on AM57x EVM to see if I can reproduce the issue, then I can debug it.
    Can you please attach your kernel config file /proc/config.gz for both sdk 03.02 and sdk 5.1 kernels?
  • config.gz for SDK 03.02

    5327.config.gz

    After updating kernel to 05.01, but useless, so I reverted to SDK 03.02, and need to do it again to udpate to 05.01, so config.gz will be later.

    But I do not change any config for kenel 05.01, only thing is to make menuconfig and save, then solve some error during make.

  • Please test first for SDK 03.02, and tell me the result, thanks.
  • I tested with Processor SDK v3.2 pre-built images and re-built kernel image with your config.gz on AM57x GP EVM, but I am unable to see the crash.

    Do you use the am57x GP EVM as in the link below?
    www.ti.com/.../tmdsevm572x

    Searching PAGE_FLAGS_CHECK_AT_PREP on internet doesn't reveal much information, but some suggest it could be power supply and memory related.

    Do you use the power supply which comes with the EVM package?
    Do you see the crash every time in your tests?
    Have you tested with different boards?
  • Thanks.

    I finally find the bug where is.

    It comes from code from third partry pci driver.

    //---------------------------------------------------------------------------------------------------------------------------------

        pMemObject->pKernelVa =
            dma_alloc_coherent(
                &pdx->pPciDevice->dev,
                pMemObject->Size,
                &BusAddress,
                GFP_KERNEL | __GFP_NOWARN
                );
    
        printk("pMemObject->pKernelVa:%p, size:%d\n", pMemObject->pKernelVa, pMemObject->Size);
    
        if (pMemObject->pKernelVa == NULL)
        {
            return NULL;
        }
    
        // Store the bus address
        pMemObject->BusPhysical = (ADS_UINT_PTR)BusAddress;
    
    #if 0
        // Tag all pages as reserved
        for (virt_addr = (ADS_UINT_PTR)pMemObject->pKernelVa;
             virt_addr < ((ADS_UINT_PTR)pMemObject->pKernelVa + pMemObject->Size);
             virt_addr += PAGE_SIZE)
        {
            SetPageReserved(virt_to_page(ADS_INT_TO_PTR(virt_addr)));
        }
    #endif
    
        // Get CPU physical address of buffer
        pMemObject->CpuPhysical = (ADS_UINT_PTR)virt_to_phys(pMemObject->pKernelVa);
    
        // Clear the buffer
        memset(pMemObject->pKernelVa, 0, pMemObject->Size);
    
        DebugPrintf(("Allocated physical memory...\n"));

    //------------------------------------------------------------------------------------------------------------------------------------------

    The bug is cause by SetPageReserved, and I do not know why to use, becasuse the driver do not support mmap.

    After comment the code block, it seems ok.

    By the way:

    The kernel version I use is 4.4.32, and git branches of 03.02 SDK is 4.4.150.

    Must I update to the 4.4.150?

  • Hi,

    jinhu wu said:
    The bug is cause by SetPageReserved, and I do not know why to use, becasuse the driver do not support mmap.

    I am glad to see the issue is solved.

    jinhu wu said:

    The kernel version I use is 4.4.32, and git branches of 03.02 SDK is 4.4.150.

    Must I update to the 4.4.150?

    In general it is recommended to update to the latest kernel dot releases, but it is always a good idea to review the new patches to ensure they don't create new regressions which affect your project.