structs with bitfields and spinlocks/atomics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I would like to point out that xfs-code may need a review, whether it is affected by compiler issues as described in [1]. There has been a patch [2] for btrfs this year summarizing the problem as follows:

On ia64, powerpc64 and sparc64 the bitfield is modified through a RMW cycle and current gcc rewrites the adjacent 4B word, which in case of a spinlock or atomic has disaterous effect.

In xfs_aops.h we have
typedef struct xfs_ioend {
        struct xfs_ioend        *io_list;
        unsigned int            io_type;
        int                     io_error;
        atomic_t                io_remaining;
        unsigned int            io_isasync : 1;
        unsigned int            io_isdirect : 1;
[...]

where atomic_t, io_isasync and io_isdirect presumably share a common 8B word. I only found this occurrence so far.

Best regards
 Damian Lukowski

[1] https://lkml.org/lkml/2012/2/1/220
[2] btrfs: fix structs where bitfields and spinlock/atomic share 8B word (commit c08782dacd7a098f2b8bca7f4a57a5b402e9e1e5)
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux