Skip to contentSkip to conversation

: documented Oops running big-endian reiserfs on parisc architecture

PATCH Andi Kleen 4 participants 4 messages Sep 4, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw
Quoted 3 lines · Jeff Mahoney

I did kick around the idea of making those macros the default accessors for the deh_state member (which is the only place they're used), but it unfairly penalizes arches that don't need them.

On archs that don't need them {get,put}_unaligned should be just normal assignments. They are certainly on i386.

-Andi

#2 lore raw

From: Andi Kleen <[email protected]>
Date: 04 Sep 2001 11:44:30 +0200

Quoted 3 lines · Jeff Mahoney

I did kick around the idea of making those macros the default accessors for the deh_state member (which is the only place they're used), but it unfairly penalizes arches that don't need them.

On archs that don't need them {get,put}_unaligned should be just normal assignments. They are certainly on i386.

I can also almost guarentee you that the x86 will sometimes not execute these bitops atomically on SMP.

We had some obscure bug on SMP/x86 years ago, and Linus discovered that removing an unaligned spinlock or bitop made the problem go away.

Reiserfs is broken and needs to be fixed.

If you make the unaligned accessors there the default for everyone, you solve the problem _AND_ there is no penalization. Look at what the compiler makes of the code generated, it is going to be almost entirely identical. The compiler should be able to compute it all via constants. If not, oh you get 1 or 2 instructions here or there, and that is MINISCULE compared to the cost of the atomic operation itself.

What's more, you will have less QA'ing to do, since this code will always be in use and thus tested.

FACT: Doing bitops on something not "long" aligned is a bug and
will always be a bug. You must fix it.

Later,
David S. Miller
[email protected]

#3 lore raw

Re: [SOLVED + PATCH]: documented Oops running big-endian reiserfs

Quoted 2 lines

I can also almost guarentee you that the x86 will sometimes not execute these bitops atomically on SMP.

unaligned operations are indeed generally not atomic on x86.

#4 lore raw
In reply to a message not in the archive
Quoted 9 lines · Andi Kleen
Quoted 3 lines · Jeff Mahoney

I did kick around the idea of making those macros the default accessors for the deh_state member (which is the only place they're used), but it unfairly penalizes arches that don't need them.

On archs that don't need them {get,put}_unaligned should be just normal assignments. They are certainly on i386.

Sorry, I guess I wasn't clear.

When I mentioned "make those macros the default ..", I was referring to the reiserfs-defined macros, not the asm/unaligned.h macros.

In my previous message, I had mentioned that the get/put _unaligned macros from asm/unaligned.h don't work in all cases. Specifically, the S/390 (and S/390x) versions won't work with ReiserFS, since they're nothing more than a normal access/mutate put into a compatible macro. Through testing on the S/390{,x}, I found that using the reiserfs-defined unaligned macros did the trick. The only place these reiserfs-defined macros are used is to access/mutate the reiserfs_de_head->deh_state member, which contains flags for the on-disk directory entry representation.

Are the S/390 asm/unaligned.h versions broken, or is the ReiserFS code doing something not planned for? It's a 16-bit member, at a 16-bit alignment in the structure. The structure itself need not be aligned in any particular manner as it is read directly from disk, and is a packed structure.

-Jeff

Signature · 3 lines
Jeff Mahoney           |   "Bill Gates is a monocle and a Persian cat away
[email protected]         |    from being the villain in a James Bond movie."
[email protected]      |                   -- Dennis Miller