Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel: remove numactl #25041

Merged
merged 11 commits into from
Feb 19, 2025
Merged

bazel: remove numactl #25041

merged 11 commits into from
Feb 19, 2025

Conversation

rockwotj
Copy link
Contributor

@rockwotj rockwotj commented Feb 5, 2025

Incorporate libnuma into the Bazel build. We force dynamic linking because it's LGPL. The dynamic linking forcing is really annoying, but honestly less annoying than the new way of doing things with cc_shared_library. However I ran into issues using the cc_shared_library approach, so I just fallback to using the "old school" stable ways of making shared libraries.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.3.x
  • v24.2.x
  • v24.1.x

Release Notes

  • none

@rockwotj rockwotj force-pushed the numactl branch 3 times, most recently from 691a390 to 982e68b Compare February 7, 2025 22:09
@rockwotj rockwotj marked this pull request as ready for review February 7, 2025 22:12
@dotnwat
Copy link
Member

dotnwat commented Feb 7, 2025

but honestly less annoying than the new way of doing things with cc_shared_library

i'm not saying we should do this, but from what I can tell seastar's libnuma dependency is a single call to mbind in memory.cc to set a policy on some memory regions.

looking at this:

https://github.com/lrita/numa/blob/29f88905963797c57362861a2dd8adb14a6f152a/numa_linux.go#L161

i do wonder if freeing ourselves from the libnuma dependency would be as simple as writing our own version of this

func MBind(addr unsafe.Pointer, length, mode, flags int, nodemask Bitmask) (err error) {
	var mask, maxnode uintptr
	if maxnode = uintptr(nodemask.Len()); maxnode != 0 {
		mask = uintptr(unsafe.Pointer(&nodemask[0]))
	}
	_, _, errno := syscall.Syscall6(syscall.SYS_MBIND, uintptr(addr),
		uintptr(length), uintptr(mode), mask, maxnode, uintptr(flags))
	if errno != 0 {
		err = errno
	}
	return
}

dotnwat
dotnwat previously approved these changes Feb 7, 2025
@@ -6,7 +6,8 @@ edition = "2021"
publish = false

[lib]
path = "/dev/null"
# Use a fake path here, but rules_rust requires something.
path = "./dev/null"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. i had gone with fake.rs

@rockwotj
Copy link
Contributor Author

rockwotj commented Feb 8, 2025

but honestly less annoying than the new way of doing things with cc_shared_library

i'm not saying we should do this, but from what I can tell seastar's libnuma dependency is a single call to mbind in memory.cc to set a policy on some memory regions.

looking at this:

https://github.com/lrita/numa/blob/29f88905963797c57362861a2dd8adb14a6f152a/numa_linux.go#L161

i do wonder if freeing ourselves from the libnuma dependency would be as simple as writing our own version of this


func MBind(addr unsafe.Pointer, length, mode, flags int, nodemask Bitmask) (err error) {

	var mask, maxnode uintptr

	if maxnode = uintptr(nodemask.Len()); maxnode != 0 {

		mask = uintptr(unsafe.Pointer(&nodemask[0]))

	}

	_, _, errno := syscall.Syscall6(syscall.SYS_MBIND, uintptr(addr),

		uintptr(length), uintptr(mode), mask, maxnode, uintptr(flags))

	if errno != 0 {

		err = errno

	}

	return

}

ooh maybe I will send a patch to seastar and see what drama unfolds...

@rockwotj rockwotj changed the title bazel: fix numactl bazel: remove numactl Feb 17, 2025
@rockwotj
Copy link
Contributor Author

Updated to remove numactl using the pending upstream patch in seastar

@rockwotj rockwotj force-pushed the numactl branch 2 times, most recently from 06d6976 to def94ad Compare February 17, 2025 21:20
@rockwotj rockwotj requested a review from dotnwat February 17, 2025 21:47
@rockwotj
Copy link
Contributor Author

I snuck in a few clang-19 fixes into this PR. I have a lot of the tree building with a couple of small seastar patches.

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Feb 18, 2025

CI test results

test results on build#61934
test_id test_kind job_url test_status passed
rptest.tests.compaction_recovery_test.CompactionRecoveryTest.test_index_recovery ducktape https://buildkite.com/redpanda/redpanda/builds/61934#01951640-53cb-4170-b5cc-b598a05ede4e FLAKY 1/2
rptest.tests.delete_records_test.DeleteRecordsTest.test_delete_records_concurrent_truncations.cloud_storage_enabled=True.truncate_point=start_offset ducktape https://buildkite.com/redpanda/redpanda/builds/61934#01951640-53cb-4f0f-acbe-87b2d578f419 FLAKY 1/3
rptest.transactions.producers_api_test.ProducersAdminAPITest.test_producers_state_api_during_load ducktape https://buildkite.com/redpanda/redpanda/builds/61934#01951640-53cc-42c1-9675-789a02bdbb75 FLAKY 1/2
test results on build#61942
test_id test_kind job_url test_status passed
rptest.tests.compaction_recovery_test.CompactionRecoveryTest.test_index_recovery ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-3811-4b73-9a88-cf50fba3c5a4 FLAKY 1/2
rptest.tests.datalake.simple_connect_test.RedpandaConnectIcebergTest.test_translating_avro_serialized_records.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-380f-4ec4-acdd-92bc8273a34b FLAKY 1/2
rptest.tests.log_compaction_test.LogCompactionTest.compaction_stress_test.cleanup_policy=compact.delete.key_set_cardinality=1000.storage_compaction_key_map_memory_kb=10 ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-3811-4b73-9a88-cf50fba3c5a4 FLAKY 1/2
rptest.tests.log_compaction_test.LogCompactionTest.compaction_stress_test.cleanup_policy=compact.delete.key_set_cardinality=1000.storage_compaction_key_map_memory_kb=3 ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-380f-4ec4-acdd-92bc8273a34b FLAKY 1/2
rptest.tests.log_compaction_test.LogCompactionTest.compaction_stress_test.cleanup_policy=compact.key_set_cardinality=1000.storage_compaction_key_map_memory_kb=10 ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-380f-4ec4-acdd-92bc8273a34b FLAKY 1/2
rptest.tests.log_compaction_test.LogCompactionTest.compaction_stress_test.cleanup_policy=compact.key_set_cardinality=1000.storage_compaction_key_map_memory_kb=3 ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-3811-4b73-9a88-cf50fba3c5a4 FLAKY 1/2
rptest.tests.partition_movement_test.SIPartitionMovementTest.test_shadow_indexing.num_to_upgrade=0.cloud_storage_type=CloudStorageType.ABS ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-3811-4b73-9a88-cf50fba3c5a4 FLAKY 1/2
rptest.tests.random_node_operations_test.RandomNodeOperationsTest.test_node_operations.enable_failures=True.mixed_versions=False.with_tiered_storage=False.with_iceberg=False.with_chunked_compaction=True.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-380f-4205-a0ea-b5bd4403ce08 FLAKY 1/2
rptest.tests.random_node_operations_test.RandomNodeOperationsTest.test_node_operations.enable_failures=True.mixed_versions=False.with_tiered_storage=True.with_iceberg=False.with_chunked_compaction=False.cloud_storage_type=CloudStorageType.ABS ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-3811-4b73-9a88-cf50fba3c5a4 FLAKY 1/2
rptest.tests.scaling_up_test.ScalingUpTest.test_scaling_up_with_recovered_topic ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179f-3811-4b73-9a88-cf50fba3c5a4 FLAKY 1/3
rptest.transactions.consumer_offsets_test.VerifyConsumerOffsetsThruUpgrades.test_consumer_group_offsets.versions_to_upgrade=1 ducktape https://buildkite.com/redpanda/redpanda/builds/61942#0195179b-9717-4170-a76f-3e7f1a771897 FLAKY 1/2
test results on build#62027
test_id test_kind job_url test_status passed
rptest.tests.controller_log_limiting_test.ControllerLogLimitMirrorMakerTests.test_mirror_maker_with_limits ducktape https://buildkite.com/redpanda/redpanda/builds/62027#01951f49-c215-4f5e-8900-d7dcbffeeef0 FLAKY 1/2
rptest.tests.log_compaction_test.LogCompactionTest.compaction_stress_test.cleanup_policy=compact.delete.key_set_cardinality=1000.storage_compaction_key_map_memory_kb=10 ducktape https://buildkite.com/redpanda/redpanda/builds/62027#01951f49-c218-4b4a-bd92-52e16dcfb9f1 FLAKY 1/2
rptest.tests.log_compaction_test.LogCompactionTest.compaction_stress_test.cleanup_policy=compact.delete.key_set_cardinality=1000.storage_compaction_key_map_memory_kb=3 ducktape https://buildkite.com/redpanda/redpanda/builds/62027#01951f49-c215-4f5e-8900-d7dcbffeeef0 FLAKY 1/2

@rockwotj rockwotj requested review from r-vasquez, kbatuigas and a team as code owners February 18, 2025 04:29
dotnwat
dotnwat previously approved these changes Feb 19, 2025
@@ -47,6 +47,7 @@ bazel_dep(name = "yaml-cpp", version = "0.8.0")
bazel_dep(name = "zlib", version = "1.3.1.bcr.3")
bazel_dep(name = "zstd", version = "1.5.6")
bazel_dep(name = "patchelf", version = "0.18.0")
bazel_dep(name = "bzip2", version = "1.0.8.bcr.2")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bazel: upgrade bzip2

but this commit is adding bzip2, right? was bzip2 being depended on indirectly, and this new bazel_dep line then causes all bzip2 instances to use the bcr.2 version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah exactly, you can see this in the lock file

This breaks in bazel 8, so fix it now
required to work with Bazel 8
These have landed upstream
To prevent 500 errors from sourceware.org
Newer libcpp uses a wrapped iterator type for string_view so we aren't
comparing the right types between string_view and ss::sstring
In newer libcpp iterators are not pointers, fix the usage here.
To address a clang-19 warning
@rockwotj
Copy link
Contributor Author

Force push: fix conflicts in MODULE.bazel.lock

@rockwotj rockwotj merged commit d42779f into redpanda-data:dev Feb 19, 2025
24 checks passed
@rockwotj rockwotj deleted the numactl branch February 19, 2025 21:10
@travisdowns
Copy link
Member

travisdowns commented Feb 27, 2025

@rockwotj is there a specific reason we are applying these changes as patches in our redpanda-side bazel build rather than checking them into our seastar fork? Is it because if we put them into our fork it won't build (cmake style) any more?

@rockwotj
Copy link
Contributor Author

@rockwotj is there a specific reason we are applying these changes as patches in our redpanda-side bazel build rather than checking them into our seastar fork? Is it because if we put them into our fork it won't build (cmake style) any more?

No we should be applying them to our seastar fork, especially since this is upstreamed and not in the cmake build once we rebase.

@rockwotj
Copy link
Contributor Author

See: scylladb/seastar#2645

@travisdowns
Copy link
Member

See: scylladb/seastar#2645

Very nice. I will cherry pick this into our fork.

@rockwotj
Copy link
Contributor Author

Thanks, it's on my list of things to get too 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants