Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Big harddrive doesn't work (reported 1TB instead of 4TB)
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 11, 2023 2:51 pm    Post subject: Reply with quote

Sorry for my late follow-up, life of in the way :)

I've upgraded one of my other systems to kernel 6.1.19 and the USB-SATA bridge works fine without any patches. That brings it back to differences in config.
I'm now changing my new config to take away one difference at the time and see when things start working. It does quite a while because some settings trigger a full recompile of the kernel :?.
I also noticed the gcc version is different, but i don't expect that would result in a problem like this.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54799
Location: 56N 3W

PostPosted: Sun Jun 11, 2023 3:26 pm    Post subject: Reply with quote

pa4wdh,

You need to use a binary search.

Include half the changes in a kernel build.
If the problem has gone, it was caused by something in the removed half.
If it remains, it's in the half that you kept.

Apply the process recursively until only one option is left.
10 kernel builds lets you search 1024 option changes.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 11, 2023 5:11 pm    Post subject: Reply with quote

Well, i just did another test with turned different than i expected ...

First i copied the binary kernel from a working system to the not working system, just to verify it still works and it did. The drive is properly detected.
Then i used the kernel config from the working system and recompiled the kernel on the not working system with that configuration. That didn't work, the drive is detected as 1TB again.

The only difference between those two is the GCC version it's compiled with, so i'll see if i can downgrade from gcc 12 to gcc 11.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5353
Location: Bavaria

PostPosted: Sun Jun 11, 2023 5:24 pm    Post subject: Reply with quote

pa4wdh wrote:
[...] Then i used the kernel config from the working system and recompiled the kernel on the not working system with that configuration. That didn't work, the drive is detected as 1TB again.

The only difference between those two is the GCC version it's compiled with, so i'll see if i can downgrade from gcc 12 to gcc 11.

Before you downgrade you could do another check:

Do a "dmesg -t > kernellog.good" on the first machine, and then - with the same kernel configuration - a "dmesg -t > kernellog.bad" at your problem machine. Is there any difference (beside obvious like CPU) ?

If yes it could be a BIOS setting.
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sun Jun 11, 2023 5:34 pm    Post subject: Reply with quote

Thanks for the suggestion. The systems' BIOS is rather minimal, there are no settings regarding to storage or USB that point in this direction. Also, BIOS settings didn't change between the working binary kernel and the recompiled kernel with the same configuration.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6209
Location: Dallas area

PostPosted: Sun Jun 11, 2023 5:41 pm    Post subject: Reply with quote

Do you have both the usb2 and usb3 connectors plugged in? (The manual mentions that both can't be connected at the same time)
(I believe it's j9 and j10)
It doesn't say what happens if both are connected at the same time (either inconsistent results or doesn't work at all)

Other than that, if anything in the bios affects it, it would be in the usb area.


Edit to add: never mind - what I linked to was wrong.

Did you originally have UAS turned off on the "bad" machine? If not recompile with UAS completely turned off.
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland


Last edited by Anon-E-moose on Mon Jun 12, 2023 9:10 am; edited 1 time in total
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2660

PostPosted: Sun Jun 11, 2023 7:39 pm    Post subject: Reply with quote

pa4wdh wrote:

Then i used the kernel config from the working system and recompiled the kernel on the not working system with that configuration. That didn't work, the drive is detected as 1TB again.


What about the initramfs? How is it produced on one machine compared to the other?

Best Regards,
Georgi
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Mon Jun 12, 2023 5:02 pm    Post subject: Reply with quote

Anon-E-moose wrote:
Do you have both the usb2 and usb3 connectors plugged in? (The manual mentions that both can't be connected at the same time)
(I believe it's j9 and j10)
It doesn't say what happens if both are connected at the same time (either inconsistent results or doesn't work at all)

Good find. I checked the manual and couldn't find the comment in the manual. But anyway, only USB3 is connected.

Quote:
Other than that, if anything in the bios affects it, it would be in the usb area.

Other than a enable/disable for USB there are no settings

Quote:
Did you originally have UAS turned off on the "bad" machine? If not recompile with UAS completely turned off.
[/quote]
I don't have UAS support in my kernel, the USB SATA bridge doesn't have UAS support. I've switched it on for test somewhere in the start of this topic and that didn't help.

Quote:
What about the initramfs? How is it produced on one machine compared to the other?

I don't use an initramfs, the kernel has everthing built-in and loadable module support is switched off.

Edit:
I've just finished the tests with gcc 11.
A recompile with gcc 11 and the kernel config from the working machine worked, the drive is detected as 4 TB. I think this is a strong pointer that something is related to gcc11/12.
As a lucky shot i've also tried my initial config (the one i had when i started this topic) and gcc 11, and unfortunately that didn't work.

The diff between the config made for gcc12 and gcc11 may give some insights in where to search for problems:
Code:

< CONFIG_CC_VERSION_TEXT="gcc (Gentoo 11.3.1_p20230427 p9) 11.3.1 20230427"
---
> CONFIG_CC_VERSION_TEXT="gcc (Gentoo 12.2.1_p20230428-r1 p2) 12.2.1 20230428"
7c7
< CONFIG_GCC_VERSION=110301
---
> CONFIG_GCC_VERSION=120201
4215a4216,4218
> CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
> CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
> CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
4217,4219c4220,4221
< # CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set
< # CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set
< # CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set
---
> # CONFIG_INIT_STACK_ALL_PATTERN is not set
> # CONFIG_INIT_STACK_ALL_ZERO is not set

_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6209
Location: Dallas area

PostPosted: Mon Jun 12, 2023 5:39 pm    Post subject: Reply with quote

Given that there are no obvious problems, I can only assume that jmicron (enclosure) and intel usb chipset don't work well together.
And it's not that it doesn't work it just needs the quirk for it to work right.
I've had motherboards in the past where I couldn't use some usb devices fully, and had to use the quirk files to get around problems.

At this point, I would leave the quirk, and just use the drive (as long as it keeps working).

Edit to add: this is from the scsiglue.c file in usb/storage
Code:
        /*
         * Many devices do not respond properly to READ_CAPACITY_16.
         * Tell the SCSI layer to try READ_CAPACITY_10 first.
         * However some USB 3.0 drive enclosures return capacity
         * modulo 2TB. Those must use READ_CAPACITY_16
         */


Which further tells me the quirk you put in place is the correct thing to do.

Edit to add: gcc 12.3 is out, maybe gcc 12.2 generates some questionable code *shrugs*
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Mon Jun 12, 2023 6:01 pm    Post subject: Reply with quote

I understand the quirk is a way to solve this. There are also a few reasons to assume it only to work around a symptom of other problems:
- The drive/bridge has been working without the quirk for years on many different systems
- With a different kernel config and compiled with gcc 11 it works correctly with on hardware where it initially misbehaved
- The comment in scsiglue.c mentions "capacity modulo 2TB" which is not the case with my problem: 4TB modulo 2TB should be either close to 0 or close to 2TB depending on the exact numbers, my drive reports 1TB
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6209
Location: Dallas area

PostPosted: Mon Jun 12, 2023 6:33 pm    Post subject: Reply with quote

Quote:
- The drive/bridge has been working without the quirk for years on many different systems


Yes, the drive works, do you have another machine with the same intel chipset (bad machine) that does work with the enclosure?
Otherwise it's the interaction between the chipsets that's the problem or more precisely the firmware on the chipsets.

I put the comment to show that sometimes, some devices don't work well with all motherboards.
It's not that they don't work, they don't work well with all machines, without a little fiddling.
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Tue Jun 13, 2023 5:50 pm    Post subject: Reply with quote

It has even been working on the "bad machine" with a kernel build on that system with gcc 11 (reported a few posts back), it doesn't get better than that :). It's just that the rest of the used config is not tuned to that PC, so i'd like to find out which setting it is that makes the difference.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Wed Jun 14, 2023 12:54 pm    Post subject: Reply with quote

It took me quite some steps, and quite some time because most of the changes triggered a full rebuild of the kernel.

The offending setting is: CONFIG_PM which has to be not set. I would never have guessed that.

Now knowing this, especially in drivers/usb there is a lot of code for CONFIG_PM and CONFIG_PM_SLEEP, so that somewhat makes sense.

Edit:
I've done two additional tests:
1) Reverted back to the original config i started this topic with, only changed CONFIG_PM and recompiled with gcc 11. This worked and drive is detected properly.
2) Using the config from the previous step, i switched my compiler to gcc 12 again. This also worked and the drive is detected properly.

I don't really understand where the gcc thing came from, but now it seems that only CONFIG_PM was the cause of the problems.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum