Miguel Sousa Filipe
2008-Oct-16 13:40 UTC
crc32c implementation on x86 with SSE4.2... CONFIG_BTRFS_HW_SUM
Hi there, I noticed that btrfs, in the git tree, has its own implementation of crc32c for x86 with SSE4.2 that implement a crc32 instruction.. it appears. Its protected by a ifdef CONFIG_BTRFS_HW_SUM, and if we''re executing on the right cpu, that will bypass the kernel implementation of crc32c. please see: http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-unstable.git;a=blob_plain;f=fs/btrfs/crc32c.h;hb=HEAD Based on this understanding, should this be a implementation detail of crc32c, and be correctly implemented (and therefore patched) in the mainline kernel implementation of crc32c ? I know that checksumming is cpu expensive, and btrfs wants the best impl. possible. but that shouldn''t be a btrfs issue, that should be crc32c issue, and its the crc32c implementation that should be fixed, instead of having our own special crc32c in case we''re executing in the right cpu. Should I post a patch with this for the vanilla crc32c implementation? kind regards, -- Miguel Sousa Filipe -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Chris Mason
2008-Oct-16 13:49 UTC
Re: crc32c implementation on x86 with SSE4.2... CONFIG_BTRFS_HW_SUM
On Thu, 2008-10-16 at 14:40 +0100, Miguel Sousa Filipe wrote:> Hi there, > > I noticed that btrfs, in the git tree, has its own implementation of > crc32c for x86 with SSE4.2 that implement a crc32 instruction.. it > appears. > Its protected by a ifdef CONFIG_BTRFS_HW_SUM, and if we''re executing > on the right cpu, that will bypass the kernel implementation of > crc32c. >The Btrfs support for intel''s faster crc32c came from a patch intel posted to linux-kernel. I just hacked it up a bit at the time because I didn''t want to wait for mainline to include the work. I don''t see intel''s patches in mainline yet, but I know there was a plan to get them there. -chris -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Tomasz Torcz
2008-Oct-17 06:37 UTC
Re: crc32c implementation on x86 with SSE4.2... CONFIG_BTRFS_HW_SUM
Dnia 2008-10-16, czw o godzinie 09:49 -0400, Chris Mason pisze:> On Thu, 2008-10-16 at 14:40 +0100, Miguel Sousa Filipe wrote: > > Hi there, > > > > I noticed that btrfs, in the git tree, has its own implementation of > > crc32c for x86 with SSE4.2 that implement a crc32 instruction.. it > > appears. > I don''t see intel''s patches in mainline yet, but I know there was aplan> to get them there.It seems to be merged: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=8cb51ba8e06570a5fff674b3744d12a1b089f2d0 Using generic, replaceable by arch version is surely better. This way you can avoid implementing crc32 for each architecture (like, for example UltraSPARC T2, which computes crc at healthy 48 GB/s). -- Tomasz Torcz -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html