Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Enable XplatEventLogger on all non-Windows platforms #3879

Merged
merged 1 commit into from
Apr 20, 2016

Conversation

manu-st
Copy link

@manu-st manu-st commented Mar 23, 2016

Ensure that even if FEATURE_EVENTSOURCE_XPLAT is not defined it, the
implementation provides a dummy implementation. This is required because
mscorlib defines FEATURE_EVENTSOURCE_XPLAT even if this is not supported
by the underlying platform.

@manu-st manu-st changed the title OXplat Enable XplatEventLogger on all non-Windows platforms Mar 23, 2016
@jkotas
Copy link
Member

jkotas commented Mar 23, 2016

@manu-silicon Could you please take a look at the OSX build break? Looks like the condition for XplatEventLogger.cs in mscorlib.shared.sources.props needs to be fixed up.

@manu-st
Copy link
Author

manu-st commented Mar 23, 2016

@jkotas Just pushed a change to always include XplatEventLogger.cs.

@jkotas
Copy link
Member

jkotas commented Mar 23, 2016

LGTM. Could you please squash into single commit?

@manu-st
Copy link
Author

manu-st commented Mar 23, 2016

Squashed.

@ramarag
Copy link
Member

ramarag commented Mar 24, 2016

Hey instead of this big change, you can just conditionally turn on FEATURE_EVENTSOURCE_XPLAT in the VM for non windows,
currently it is turned on only if FEATURE_EVENT_TRACE is specified, look at https://github.com/dotnet/coreclr/blob/master/CMakeLists.txt#L786

This would keep the feature self contained

@ramarag
Copy link
Member

ramarag commented Mar 24, 2016

Correct me if i am wrong, this would not have raised if we had ways to trun off features for different flavors of linux in mscorlib

@manu-st
Copy link
Author

manu-st commented Mar 24, 2016

The issue was that on Linux ARM mscorlib assumed that Xplat was available but the native part had been disabled due to poor support (see #2824). And indeed if we could have turned on/off some features in mscorlib, it would have matched the native part and there would not have been an issue.

@ramarag
Copy link
Member

ramarag commented Mar 24, 2016

That is exactly the above mentioned solution would do, instead of matching mscorlib to native, we would be changing native to match mscorlib ,only for this instance
so
if(CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
endif(CLR_CMAKE_PLATFORM_UNIX)

needs to be moved out of
if(FEATURE_EVENT_TRACE)

@jkotas
Copy link
Member

jkotas commented Mar 24, 2016

Yes, that would work too - but it would required keeping the managed and unmanaged settings in sync somehow.

The typical approach taken in corefx is to build the managed code general purpose, and have the fine-grained differences in unmanaged C++ wrappers only. Here is one example from many: https://github.com/dotnet/corefx/blob/1db0c74f3f525365c2573458aa1f454cacf00453/src/Native/System.Security.Cryptography.Native/pal_ssl.cpp#L49.

This corefx approach make it easier to maintain different configurations. It is why I have suggested it here as well.

@jkotas
Copy link
Member

jkotas commented Mar 24, 2016

I see - you are basically suggesting to use FEATURE_EVENTSOURCE_XPLAT instead of FEATURE_PAL to ifdef this, because of FEATURE_EVENTSOURCE_XPLAT is almost unused with this change. I do not have opinion what looks better. @manu-silicon What do you think?

@ramarag
Copy link
Member

ramarag commented Mar 24, 2016

Ok, it makes sense from that point of view, although composition is lost.
@manu-silicon : Can you remove all occurrences of EATURE_EVENTSOURCE_XPLAT, as it no longer has any meaning

@manu-st
Copy link
Author

manu-st commented Mar 24, 2016

@jkotas @ramarag Looks like I'm receiving mix-messages here and I'm not entirely following the reasoning of keeping either or of FEATURE_PAL or FEATURE_EVENTSOURCE_XPLAT. The former is to distinguish between Unix and Windows and the later for Unix only to see if something is available or not.

@ramarag
Copy link
Member

ramarag commented Mar 24, 2016

The reason behind is FEATURE_EVENTSOURCE_XPLAT is to compose functionality for logging EventSource Events distinctly from ETW period. This could potentially be reused on windows too [ not gonna happen- but still saying]

FEATURE_PAL implies non windows to be exact

For the record - I would like to keep FEATURE_EVENTSOURCE_XPLAT, as it a nice way to turn of the feature. If the current change is going to be merged,please clean all usages of FEATURE_EVENTSOURCE_XPLAT, as it no longer makes any sense

@jkotas
Copy link
Member

jkotas commented Mar 24, 2016

Ok. @manu-silicon Could you please make these changes:

  • Turn on FeatureXplatEventSource in clr.coreclr.props for all Unix (move it couple of lines down to the Unix block)
  • Turn on DFEATURE_EVENTSOURCE_XPLAT=1 in CMakeLists.txt for all Unix
  • Use FEATURE_EVENTSOURCE_XPLAT instead of FEATURE_PAL for ifdefing this

Sorry about the back and forth on this one...

@jkotas
Copy link
Member

jkotas commented Mar 24, 2016

The ifdef for real implementation vs. the dummy implementation in eventtracepriv.h should be #ifdef FEATURE_EVENT_TRACE

@manu-st
Copy link
Author

manu-st commented Mar 24, 2016

@jkotas Thanks for the clarification. I'll have a second pass at it tomorrow.

@ramarag
Copy link
Member

ramarag commented Mar 24, 2016

by turning on FEATURE_EVENTSOURCE_XPLAT for all Linux, you do not need to have dummy implementation anywhere, this was the case when the feature got checked in, the current status is due to consolidation from this change dd9c20c in CMakeLists.txt [The piece I pointed above]

@jkotas
Copy link
Member

jkotas commented Mar 24, 2016

I think you still need to have the dummy implementation even when FEATURE_EVENTSOURCE_XPLAT is turned on for all Unix. Lttng will be still available only when FEATURE_EVENT_TRACE is defined.

@ramarag
Copy link
Member

ramarag commented Mar 24, 2016

Almost all of the functionality defined by FEATURE_EVENT_TRACE and not used by FEATURE_EVENTSOURCE_XPLAT should have dummy default implementations already if it is not defined.

@manu-st manu-st force-pushed the xplat branch 2 times, most recently from 74aa690 to 89d31c6 Compare March 28, 2016 09:29
@manu-st
Copy link
Author

manu-st commented Mar 28, 2016

@jkotas @ramarag Here is my latest take on the matter. Compared to the original code, the only change is that now you can disable FEATURE_EVENTSOURCE_XPLAT when FEATURE_EVENT_TRACE is enabled, which was not possible before.

However, disabling FEATURE_EVENT_TRACE on Unix requires the set of changes I made originally if we do not want to change the way mscorlib is compiled. So I gave up doing that, which means that if someone disable it in CMakeLists.txt, it has to disable it in mscorlib too.

Let me know what you think.

@@ -408,13 +408,17 @@ class BulkStaticsLogger

#endif // __EVENTTRACEPRIV_H__

#if defined(FEATURE_EVENTSOURCE_XPLAT)
#if defined(FEATURE_EVENT_TRACE)
Copy link
Member

Choose a reason for hiding this comment

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

I think this should stay FEATURE_EVENTSOURCE_XPLAT

@jkotas
Copy link
Member

jkotas commented Mar 28, 2016

FEATURE_EVENTSOURCE_XPLAT should control only whether the two internal calls from mscorlib to VM exists.

Please let me know if there is anything that I am missing...

@manu-st
Copy link
Author

manu-st commented Apr 18, 2016

Seems to work for me. @myungjoo @leemgs Could you try this to see if this addresses all issues?

@myungjoo
Copy link

@prajwal-aithal , Could you please test this one? (Me and @leemgs are away for a week and cannot test ARM devices)

@jkotas
Copy link
Member

jkotas commented Apr 18, 2016

The OSX build is failing. The problem is that FEATURE_EVENTSOURCE_XPLAT has to be defined for Unix unconditionally in the root CMakefile.txt.

@manu-st
Copy link
Author

manu-st commented Apr 18, 2016 via email

@manu-st
Copy link
Author

manu-st commented Apr 18, 2016

Do you mean having something like that in the CMakeLists.txt

if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_PLATFORM_ARCH_AMD64)
  set(FEATURE_EVENT_TRACE 1)
endif()
if(CLR_CMAKE_PLATFORM_UNIX)
  add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
endif()

?

I just tried on my Mac and it works. I did not test if that would work for arm but will try tomorrow.

@jkotas
Copy link
Member

jkotas commented Apr 18, 2016

Yes, exactly that.

@manu-st
Copy link
Author

manu-st commented Apr 18, 2016

I pushed the changes. It works for me on Mac and Linux ARM. Did not test anything else.

@ramarag
Copy link
Member

ramarag commented Apr 19, 2016

If it is not too much too ask can you build on top of ramarag@84a8d4d ?

@jkotas
Copy link
Member

jkotas commented Apr 19, 2016

@ramarag I would like to get this done in steps. Make one small step to get it working - because of there are people waiting for this, and then work on better factoring. The implementation of the event tracing is very entangled and the history of this PR shows that it is hard to do bigger steps here (e.g. there are still build breaks).

@@ -412,9 +412,13 @@ class BulkStaticsLogger
class XplatEventSourceLogger
{
public:
#ifdef FEATURE_EVENT_TRACE
Copy link
Member

Choose a reason for hiding this comment

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

This conditional compilation is done for FireEtw* and XplatEventLogger::IsEventLoggingEnabled under the hoods. If it is not pressing to check in the change as it is please do look to build on top of ramarag@84a8d4d

Copy link
Author

Choose a reason for hiding this comment

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

Do you mean compiling just your commit? or Mine and yours combined?

Copy link
Author

Choose a reason for hiding this comment

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

With your commit, it seems to work.

Copy link
Member

Choose a reason for hiding this comment

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

yes i meant add your changes on top of ramarag/coreclr@84a8d4d

@jkotas
Copy link
Member

jkotas commented Apr 19, 2016

@manu-silicon The global CMakefile is sensitive to order in which things are defined. You have moved them earlier and it broke the build. Could you please keep it where it was, and just tweak the ifdef?

@manu-st
Copy link
Author

manu-st commented Apr 19, 2016

@jkotas I wanted to put them together. I've pushed the change

@jkotas
Copy link
Member

jkotas commented Apr 19, 2016

@dotnet-bot test Ubuntu x64 Checked Build and Test please

@jkotas
Copy link
Member

jkotas commented Apr 19, 2016

@manu-silicon I am sorry - I have just merged a number of other PRs while the CI was running on this one, and it has conflict now. Could you please resolve it?

@jkotas
Copy link
Member

jkotas commented Apr 19, 2016

@ramarag I have created issue #4403 about the cleanup that you are suggesting.

@manu-st
Copy link
Author

manu-st commented Apr 19, 2016

@jkotas Just pushed the changed.

Because on non-Windows platform, we assume event tracing, we also requires
it to compile native code for non-Windows platform.
Event tracing is only enabled on AMD64 devices for now on Unix platforms.
@jkotas
Copy link
Member

jkotas commented Apr 20, 2016

@dotnet-bot test Ubuntu x64 Checked Build and Test please

@jkotas jkotas merged commit 0eff733 into dotnet:master Apr 20, 2016
@jkotas
Copy link
Member

jkotas commented Apr 20, 2016

@manu-silicon Thank you for all work you have put into this one!

@manu-st
Copy link
Author

manu-st commented Apr 20, 2016

@jkotas Not much work, but it was definitely time consuming. Glad we can now on.
@ramarag I can try to test your code, but could you update your branch to the latest master to make the process easier on me. Thanks!

@ramarag
Copy link
Member

ramarag commented Apr 20, 2016

@manu-silicon : i have updated the changes to ramarag@0ec237e

picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Enable XplatEventLogger on all non-Windows platforms

Commit migrated from dotnet/coreclr@0eff733
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants